/* ============================================================
Auth & Shared Styles
   ============================================================ */

/* ── RESET ─────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── DESIGN TOKENS ──────────────────────────────────────── */
:root {
  /* Colors */
  --green-dark:    #2F4F3E;   /* primary green */   /* Authority / Headers / Primary CTA */
  --green-mid:     #264233;   /* hover green */   /* Hover states */
  --green-light:   #3F6B55;   /* secondary green */   /* Accents / Highlights / Success */
  --green-tint:    #DDE5DF;   /* sage tint */   /* Light green backgrounds */

  --off-white:     #F6F4F1;   /* warm cream page bg */   /* Page background */
  --white:         #FFFFFF;   /* card surface */   /* Cards */
  --soft-gray:     #E6E3DF;   /* borders */   /* Borders */
  --light-gray:    #FBFAF8;   /* subtle surface / hover */   /* Subtle UI / hover */

  --charcoal:      #1E1E1E;   /* primary text */   /* Primary text */
  --muted:         #6F6F6F;   /* secondary text */   /* Secondary text */
  --placeholder:   #9A9A9A;   /* muted / placeholder */   /* Input placeholders */

  --wood:          #D8B38A;   /* Accent — use very sparingly */

  --red:           #C4554D;   /* Danger — never bright */
  --red-tint:      #FAF0EF;   /* Danger background */

  /* Typography */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Radii */
  --radius-sm:     10px;
  --radius-md:     12px;
  --radius-lg:     16px;
  --radius-xl:     20px;

  /* Shadows */
  --shadow-card:   0 2px 10px rgba(0,0,0,0.04);
  --shadow-hover:  0 8px 24px rgba(0,0,0,0.06);
  --shadow-modal:  0 16px 48px rgba(0,0,0,0.10);

  /* Focus */
  --focus-ring:    0 0 0 3px rgba(47,79,62,0.22);

  /* Transitions */
  --transition: 0.18s ease;
}

/* ── BASE ───────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  font-size: 16px;
  color: var(--charcoal);
  line-height: 1.6;
  background: var(--off-white);
  -webkit-font-smoothing: antialiased;
}

/* ── NAV (public pages) ─────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--off-white);
  z-index: 1000;
  border-bottom: 1px solid var(--soft-gray);
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.logo-img {
  height: auto;
  max-height: 24px;
  width: auto;
  display: block;
}

.logo span {
  color: var(--green-light);
}

.nav-auth-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  background: var(--green-dark);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition);
  white-space: nowrap;
}

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

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--white);
  color: var(--green-dark);
  border: 1.5px solid var(--green-dark);
  border-radius: var(--radius-md);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--green-tint);
}

.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.btn-danger:hover {
  background: #a8453e;
}

.btn-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 7px 14px !important;
  font-size: 13px !important;
}

.nav-cta {
  padding: 9px 20px;
  background: var(--green-dark);
  color: var(--white);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition);
}

.nav-cta:hover {
  background: var(--green-mid);
}

.nav-cta-outline {
  padding: 9px 20px;
  border: 1.5px solid var(--green-dark);
  color: var(--green-dark);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.nav-cta-outline:hover {
  background: var(--green-dark);
  color: var(--white);
}

/* ── AUTH CONTAINER ─────────────────────────────────────── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 20px 60px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 44px 48px;
  max-width: 440px;
  width: 100%;
  border: 1px solid var(--soft-gray);
  box-shadow: var(--shadow-card);
}

.auth-card h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 6px;
  letter-spacing: -0.4px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ── GOOGLE BUTTON ──────────────────────────────────────── */
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1.5px solid var(--soft-gray);
  border-radius: var(--radius-md);
  background: var(--white);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal);
  cursor: pointer;
  transition: all var(--transition);
}

.google-btn:hover {
  border-color: #bbb;
  background: var(--light-gray);
}

/* ── DIVIDER ────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--soft-gray);
}

.divider span {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── FORM ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-group label,
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
  letter-spacing: 0.1px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--soft-gray);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--sans);
  color: var(--charcoal);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-input:focus {
  border-color: var(--green-light);
  box-shadow: var(--focus-ring);
}

.form-group input::placeholder,
.form-input::placeholder {
  color: var(--placeholder);
}

.form-group select,
.form-input[type="select"],
select.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--soft-gray);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--sans);
  color: var(--charcoal);
  background: var(--white);
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.form-group select:focus,
select.form-input:focus {
  border-color: var(--green-light);
  box-shadow: var(--focus-ring);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0 0;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}

.forgot-link {
  font-size: 13px;
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 500;
}

.forgot-link:hover {
  text-decoration: underline;
}

.required {
  color: var(--red);
}

/* ── MESSAGES ───────────────────────────────────────────── */
.error-message {
  background: var(--red-tint);
  color: var(--red);
  border: 1px solid rgba(196,85,77,0.2);
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.5;
}

.success-message {
  background: var(--green-tint);
  color: var(--green-dark);
  border: 1px solid rgba(95,175,143,0.3);
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.5;
}

/* ── AUTH SWITCH ────────────────────────────────────────── */
.auth-switch {
  text-align: center;
  margin-top: 22px;
  font-size: 13px;
  color: var(--muted);
}

.auth-switch a {
  color: var(--green-dark);
  text-decoration: none;
  font-weight: 600;
}

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

/* ── HELP TEXT ──────────────────────────────────────────── */
.help-text { font-size: 12px; color: var(--muted); margin-top: 4px; }
.success-text { color: var(--green-dark) !important; }
.error-text { color: var(--red) !important; }

/* ── HANDLE INPUT ───────────────────────────────────────── */
.input-with-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--soft-gray);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-with-prefix:focus-within {
  border-color: var(--green-light);
  box-shadow: var(--focus-ring);
}

.input-prefix {
  padding: 10px 12px;
  background: var(--light-gray);
  color: var(--muted);
  font-size: 14px;
  border-right: 1px solid var(--soft-gray);
}

.input-with-prefix input {
  border: none !important;
  flex: 1;
  padding: 10px 14px;
  box-shadow: none !important;
}

.input-with-prefix input:focus {
  outline: none;
  box-shadow: none !important;
}

/* ── CONTAINER ──────────────────────────────────────────── */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-role {
  background: var(--green-tint);
  color: var(--green-dark);
}

.badge-stage {
  background: var(--light-gray);
  color: var(--muted);
}

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card {
    padding: 32px 24px;
  }

  .auth-card h1 {
    font-size: 22px;
  }

  .nav-inner {
    padding: 0 20px;
  }
}


/* ============================================================
   ZEDBAR — Zed AI associate sidebar/drawer
   Appears only on dataroom.html (ZetaRoom viewer page)
   ============================================================ */

/* ── ROOM LAYOUT (dataroom page wrapper) ─────────────────── */
.room-layout {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 64px);   /* full height minus nav */
}

.room-content {
  flex: 1 1 0%;
  min-width: 0;                      /* prevent flex blowout */
  transition: margin-right 0.28s ease;
}

/* ── ZEDBAR SIDEBAR (desktop) ────────────────────────────── */
.zedbar-sidebar {
  width: 0;
  flex-shrink: 0;
  overflow: hidden;
  height: calc(100vh - 64px);
  position: sticky;
  top: 64px;                         /* stick below fixed nav */
  border-left: 1px solid transparent;
  background: var(--white);
  transition: width 0.28s ease, border-color 0.28s ease;
  display: flex;
  flex-direction: column;
}

.zedbar-sidebar.zedbar-sidebar--open {
  width: 320px;
  border-left-color: var(--soft-gray);
}

/* ── ZEDBAR INNER SCROLL CONTAINER ──────────────────────── */
.zedbar-inner {
  display: flex;
  flex-direction: column;
  width: 320px;                      /* fixed width — slides with parent */
  height: 100%;
  overflow: hidden;
}

/* ── ZEDBAR HEADER ───────────────────────────────────────── */
.zedbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--soft-gray);
  flex-shrink: 0;
}

.zedbar-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zedbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--green-dark);
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

.zedbar-identity-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.zedbar-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
  line-height: 1.2;
  letter-spacing: -0.1px;
}

.zedbar-role {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}

.zedbar-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.zedbar-close-btn:hover {
  background: var(--light-gray);
  color: var(--charcoal);
}

/* ── ZEDBAR MESSAGES ─────────────────────────────────────── */
.zedbar-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── ZED MESSAGE BUBBLE ──────────────────────────────────── */
.zedbar-message {
  display: flex;
  flex-direction: column;
}

.zedbar-message--zed .zedbar-message-bubble {
  background: var(--off-white);
  color: var(--charcoal);
  border: 1px solid var(--soft-gray);
  border-radius: 4px 12px 12px 12px;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.6;
  max-width: 100%;
  box-shadow: var(--shadow-card);
}

/* ── SCANNING STATE ──────────────────────────────────────── */
.zedbar-scanning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.zedbar-scanning-label {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  white-space: nowrap;
}

/* ── TYPING INDICATOR (three-dot pulse) ──────────────────── */
.zedbar-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.zedbar-typing-indicator span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green-light);
  opacity: 0.3;
  animation: zedbar-dot-pulse 1.4s ease-in-out infinite both;
}

.zedbar-typing-indicator span:nth-child(1) { animation-delay: 0s; }
.zedbar-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.zedbar-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes zedbar-dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40%            { opacity: 1;   transform: scale(1.15); }
}

/* ── MOBILE DRAWER ───────────────────────────────────────── */
@media (max-width: 768px) {

  /* Room layout stacks vertically on mobile */
  .room-layout {
    flex-direction: column;
    min-height: auto;
  }

  .room-content {
    width: 100%;
  }

  /* Zedbar becomes a bottom drawer */
  .zedbar-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;        /* override desktop width */
    height: auto;
    max-height: 70vh;
    border-left: none;
    border-top: 1px solid var(--soft-gray);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
    transform: translateY(0);
    transition: transform 0.3s ease;
    z-index: 500;
    top: auto;                     /* unset sticky top */
    overflow: visible;
  }

  /* Closed state: slide drawer down off-screen */
  .zedbar-sidebar.zedbar-drawer--closed {
    transform: translateY(100%);
  }

  /* Ensure inner panel fills mobile width */
  .zedbar-inner {
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
  }

  .zedbar-messages {
    max-height: calc(70vh - 70px);  /* drawer height minus header */
  }
}

/* ── MOBILE OPEN BUTTON (FAB) ────────────────────────────── */
.zedbar-mobile-fab {
  display: none;                   /* hidden on desktop */
}

@media (max-width: 768px) {
  .zedbar-mobile-fab {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 490;
    background: var(--green-dark);
    color: var(--white);
    border: none;
    border-radius: 24px;
    padding: 10px 18px 10px 12px;
    box-shadow: 0 4px 16px rgba(47,79,62,0.28);
    cursor: pointer;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    transition: background var(--transition), opacity 0.2s ease, transform 0.2s ease;
  }

  .zedbar-mobile-fab:hover {
    background: var(--green-mid);
  }

  .zedbar-mobile-fab-label {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.2px;
    flex-shrink: 0;
  }

  .zedbar-mobile-fab--hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
  }
}


/* ── DOCS TABLE RESPONSIVE ─────────────────────────────── */
.docs-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* ── MOBILE RESPONSIVE FIXES ────────────────────────────── */
@media (max-width: 480px) {
  /* Collapse nav username on small screens to prevent overflow */
  #nav-name {
    display: none;
  }
}

/* ── ZEDBAR DRAWER OPEN — CONTENT PADDING ───────────────── */
/* When Zedbar drawer is open on mobile, push content up so it
   isn't hidden behind the fixed bottom drawer */
@media (max-width: 768px) {
  body.zedbar-drawer-open .room-content {
    padding-bottom: 280px; /* ~253px drawer + breathing room */
  }

  /* iOS safe-area support for FAB and drawer */
  .zedbar-mobile-fab {
    bottom: max(24px, calc(24px + env(safe-area-inset-bottom, 0px)));
  }

  .zedbar-sidebar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
