/* Qubit – dark mode, blue accent, minimalist
   All visual settings in this file for easy customization. */

:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-muted: rgba(59, 130, 246, 0.2);
  --border: #30363d;
  --error: #f87171;
  --success: #4ade80;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  min-height: 6rem;
  height: 6rem;
  box-sizing: border-box;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  height: 80%;
  max-height: 80%;
  text-decoration: none;
  line-height: 0;
}

.logo-img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 320px;
  object-fit: contain;
}

.logo:hover .logo-img {
  opacity: 0.9;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-header nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--accent);
}

.site-header nav .inline-form {
  display: inline-flex;
  align-items: center;
}

.site-header nav .btn {
  margin-top: 0;
}

.lang-switcher {
  margin-right: 0.5rem;
}

.lang-switcher a {
  color: var(--text-muted);
}

.lang-switcher a.active {
  color: var(--accent);
  font-weight: 600;
}

.lang-sep {
  color: var(--text-muted);
  margin: 0 0.25rem;
}

.inline-form {
  display: inline;
}

.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.site-footer {
  padding: 1rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer .footer-sep {
  margin: 0 0.5rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-family: inherit;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--accent-muted);
  color: var(--accent);
}

.btn-secondary:hover {
  background: rgba(59, 130, 246, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--accent);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}

/* Forms */
label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

label:first-of-type {
  margin-top: 0;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input[type="password"],
.password-wrap input[type="text"] {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  padding: 0.25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 0;
}

.password-toggle:hover {
  color: var(--accent);
}

.password-toggle svg {
  display: block;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle.is-visible .icon-eye {
  display: none;
}

.password-toggle.is-visible .icon-eye-off {
  display: block;
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-muted);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

button[type="submit"],
.btn {
  margin-top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Flash messages */
.flash-messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.flash-success {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.flash-error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Hero / index */
.hero {
  text-align: center;
  padding: 1.5rem 2rem;
  max-width: 640px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.75rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.hero-points {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
  text-align: left;
  display: inline-block;
}

.hero-points li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.35rem;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text);
}

.hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent);
  border-radius: 50%;
}

.tagline {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.hero .cta {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.hero-actions .btn {
  min-width: 140px;
}

.mobile-notice {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.index-layout {
  display: flex;
  flex-direction: column;
}

.newsletter-cta {
  text-align: center;
  padding: 0.75rem 1.5rem;
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.newsletter-cta .newsletter-text {
  margin: 0 0 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Auth */
.auth-box {
  max-width: 400px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-box h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.encryption-info {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius);
}

.encryption-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.encryption-info p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hint {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.checkbox-group {
  margin-top: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 0;
  font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.checkbox-label span {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.checkbox-label a {
  color: var(--accent);
  text-decoration: none;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

.auth-link {
  margin-top: 1rem;
  font-size: 0.875rem;
}

.auth-link a {
  color: var(--accent);
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

.profile-nickname {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-family: monospace;
}

.conv-nickname-display {
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  word-break: break-all;
}

/* Dashboard home */
.dashboard-home {
  max-width: 500px;
  margin: 0 auto;
  padding: 2rem 0;
  text-align: center;
}

.dashboard-home h1 {
  margin-bottom: 1.5rem;
}

.dashboard-stats {
  margin-bottom: 1.5rem;
}

.dashboard-stats .stat-line {
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.dashboard-stats .praise {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 1rem;
}

/* Dashboard (channels list) */
.dashboard h2 {
  margin-top: 0;
}

.dashboard-filter {
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.dashboard-filter .filter-label {
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.dashboard-filter .filter-link {
  color: var(--text-muted);
  text-decoration: none;
}

.dashboard-filter .filter-link:hover {
  color: var(--accent);
}

.dashboard-filter .filter-link.active {
  color: var(--accent);
  font-weight: 500;
}

.dashboard-filter .filter-sep {
  margin: 0 0.5rem;
  color: var(--text-muted);
}

.nickname-box {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: var(--radius);
}

.nickname-box-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--accent);
  font-weight: 600;
}

.nickname-box-value {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.02em;
  word-break: break-all;
  color: var(--text);
}

.nickname-box-hint {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.nickname-box .copy-nickname-btn {
  margin-top: 0;
}

.dashboard-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.channel-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.channel-link {
  flex: 1;
  text-decoration: none;
  color: var(--text);
}

.channel-link:hover {
  color: var(--accent);
}

.channel-label {
  display: block;
  font-weight: 500;
}

.channel-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  font-weight: normal;
  color: var(--error);
  background: rgba(248, 113, 113, 0.15);
  border-radius: 4px;
}

.channel-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.empty-state {
  color: var(--text-muted);
}

.empty-state a {
  color: var(--accent);
}

/* Channel view */
.channel-view {
  display: flex;
  flex-direction: column;
  min-height: 60vh;
}

.channel-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.channel-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.channel-title-row h2 {
  margin: 0;
}

.btn-icon {
  padding: 0.35rem;
  min-width: auto;
  line-height: 1;
  color: var(--text-muted);
}

.btn-icon:hover {
  color: var(--accent);
}

.btn-icon .icon-pencil {
  display: block;
}

.display-name-form.is-hidden {
  display: none;
}

.display-name-form {
  margin-bottom: 1rem;
}

.display-name-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.display-name-row input {
  flex: 1;
  margin-top: 0;
}

.display-name-row .btn {
  margin-top: 0;
  flex-shrink: 0;
}

.channel-view-actions {
  display: flex;
  gap: 0.5rem;
}

.messages-list {
  flex: 1;
  min-height: 200px;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow-y: auto;
}

.message {
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  max-width: 85%;
}

.message-mine {
  margin-left: auto;
  background: var(--accent-muted);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.message-theirs {
  margin-right: auto;
  background: var(--bg);
  border: 1px solid var(--border);
}

.message-time {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.message-error {
  background: rgba(248, 113, 113, 0.1);
  color: var(--error);
}

.message-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.message-form textarea {
  flex: 1;
  margin-top: 0;
  min-height: 44px;
}

.message-form .btn {
  margin-top: 0;
  flex-shrink: 0;
}

.partner-closed-notice {
  padding: 1rem;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius);
}

.partner-closed-notice .partner-closed-text {
  margin: 0 0 0.75rem 0;
  color: var(--text);
  font-size: 0.9375rem;
}

.partner-closed-notice .inline-form {
  margin: 0;
}

.error {
  color: var(--error);
}

/* Docs */
.docs-content {
  max-width: 720px;
}

.docs-content h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.docs-content h3 {
  margin-top: 1rem;
  font-size: 1.0625rem;
}

.docs-content p,
.docs-content li {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.docs-content ul {
  padding-left: 1.25rem;
}

.legal-doc .legal-updated {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.docs-content a {
  color: var(--accent);
}

.docs-content a:hover {
  text-decoration: underline;
}

.faq-item {
  margin-bottom: 1rem;
}

.faq-item strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text);
}

/* Responsive */
@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    min-height: 0;
    height: auto;
    padding: 1rem 1.5rem;
  }

  .logo {
    height: auto;
    max-height: 4rem;
  }

  .logo-img {
    height: 3rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .channel-item {
    flex-direction: column;
    align-items: stretch;
  }

  .message-form {
    flex-direction: column;
  }

  .message-form .btn {
    width: 100%;
  }

  .display-name-row {
    flex-direction: column;
    align-items: stretch;
  }

  .display-name-row .btn {
    width: 100%;
  }
}
