/* ============================================================
   LexPath — App Layout & Page Styles
   Mobile-first, single-page app shell
   ============================================================ */

/* ── Auth View (Login) ────────────────────────────────────── */
#auth-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: linear-gradient(160deg, #EAF4F4 0%, #F7F9FC 60%);
  animation: fadeIn 0.4s ease;
}

.auth-logo-mark {
  width: 64px;
  height: 64px;
  background: var(--teal);
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto var(--space-5);
  box-shadow: var(--shadow-teal);
}

.auth-brand-name {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--navy);
  text-align: center;
  margin-bottom: var(--space-2);
}

.auth-brand-tagline {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-8);
  max-width: 280px;
}

.auth-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 400px;
}

.auth-card h2 {
  font-size: var(--text-xl);
  color: var(--navy);
  margin-bottom: var(--space-2);
}

.auth-card p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

.auth-success {
  text-align: center;
  padding: var(--space-6);
  animation: fadeIn 0.3s ease;
}
.auth-success-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-4);
}
.auth-success h3 {
  font-size: var(--text-xl);
  color: var(--color-success);
  margin-bottom: var(--space-2);
}
.auth-success p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: 0;
}

.auth-legal {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-6);
  line-height: var(--leading-relaxed);
  max-width: 380px;
}

/* ── App Shell ───────────────────────────────────────────── */
#app-view {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  animation: fadeIn 0.3s ease;
}

/* ── Top Header ──────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  box-shadow: var(--shadow-xs);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--navy);
}

.header-logo-mark {
  width: 34px;
  height: 34px;
  background: var(--teal);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #FFFFFF;
}

.header-logo span { color: var(--teal); }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: background var(--transition-fast);
  cursor: pointer;
}
.header-icon-btn:hover { background: var(--bg-raised); }

/* Notification badge */
.notif-badge {
  position: relative;
}
.notif-badge::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

/* ── Page Content Area ───────────────────────────────────── */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: var(--bottom-nav-height);
}

.page-view {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  animation: fadeIn 0.25s ease;
}

.page-view.full-width { max-width: none; }

.page-header {
  margin-bottom: var(--space-6);
}
.page-header h1 {
  font-size: var(--text-2xl);
  color: var(--navy);
  margin-bottom: var(--space-1);
}
.page-header p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

.section-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-3);
}

/* ── Bottom Navigation ────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: var(--bottom-nav-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: stretch;
  box-shadow: 0 -4px 12px rgba(26, 43, 74, 0.06);
  /* Safe area for notched phones */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  padding: 0;
}
.bottom-nav-item.active { color: var(--teal); }
.bottom-nav-item:hover  { color: var(--teal); }

.bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* New case FAB-style center button */
.bottom-nav-fab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-fab-btn {
  width: 52px;
  height: 52px;
  background: var(--teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 1.5rem;
  box-shadow: var(--shadow-teal);
  transition: transform var(--transition-fast), background var(--transition-fast);
  margin-top: -16px;   /* lifts button above nav bar */
  border: none;
  cursor: pointer;
}
.bottom-nav-fab-btn:hover  { background: var(--teal-dark); transform: scale(1.05); }
.bottom-nav-fab-btn:active { transform: scale(0.96); }

/* ── Dashboard Case Cards ─────────────────────────────────── */
.case-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}
.case-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.case-card:active { transform: scale(0.99); }

.case-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.case-card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--navy);
  line-height: var(--leading-tight);
  flex: 1;
}
.case-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.case-card-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.case-card-sol {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-raised);
  border-radius: var(--border-radius);
  margin-top: var(--space-3);
}
.case-card-sol-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex: 1;
}
.case-card-progress {
  margin-top: var(--space-3);
}
.case-card-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}

/* ── Intake Flow ──────────────────────────────────────────── */
.intake-question-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}
.intake-question {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--navy);
  margin-bottom: var(--space-2);
  line-height: var(--leading-tight);
}
.intake-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
  line-height: var(--leading-relaxed);
}
.intake-nav {
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  margin-top: var(--space-6);
}

/* ── SOL Deadline Card ────────────────────────────────────── */
.sol-card {
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-3);
}
.sol-card.green   { background: var(--urgency-green-bg);  border: 1.5px solid #A3C9B8; }
.sol-card.yellow  { background: var(--urgency-yellow-bg); border: 1.5px solid #F0C870; }
.sol-card.orange  { background: var(--urgency-orange-bg); border: 1.5px solid #F4A36A; }
.sol-card.red     { background: var(--urgency-red-bg);    border: 1.5px solid #E8958C; }
.sol-card.expired { background: var(--urgency-expired-bg);border: 1.5px solid var(--border-mid); }

.sol-rule-name    { font-weight: var(--font-semibold); font-size: var(--text-sm); margin-bottom: var(--space-1); }
.sol-days-big     { font-family: var(--font-heading); font-size: var(--text-3xl); font-weight: var(--font-bold); line-height: 1; margin-bottom: var(--space-1); }
.sol-days-label   { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: var(--space-3); }
.sol-deadline     { font-size: var(--text-sm); font-weight: var(--font-medium); }

/* ── Desktop Layout (sidebar) ─────────────────────────────── */
@media (min-width: 768px) {
  #app-view {
    flex-direction: row;
  }

  .app-sidebar {
    width: var(--sidebar-width);
    height: 100dvh;
    position: sticky;
    top: 0;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    padding: var(--space-6) 0;
    flex-shrink: 0;
    overflow-y: auto;
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-5) var(--space-6);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: var(--space-4);
  }
  .sidebar-logo-mark {
    width: 36px;
    height: 36px;
    background: var(--teal);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #FFFFFF;
    flex-shrink: 0;
  }
  .sidebar-logo-name {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: #FFFFFF;
  }

  .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    color: rgba(255,255,255,0.65);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
  }
  .sidebar-nav-item:hover  { color: #FFFFFF; background: rgba(255,255,255,0.06); }
  .sidebar-nav-item.active { color: #FFFFFF; border-left-color: var(--teal); background: rgba(13,115,119,0.18); }
  .sidebar-nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }

  .sidebar-new-case {
    margin: var(--space-4) var(--space-5);
    background: var(--teal);
    color: #FFFFFF;
    border-radius: var(--border-radius);
    padding: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: background var(--transition-fast);
  }
  .sidebar-new-case:hover { background: var(--teal-dark); }

  .sidebar-footer {
    margin-top: auto;
    padding: var(--space-4) var(--space-5) 0;
    border-top: 1px solid rgba(255,255,255,0.1);
  }

  .app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .app-header { display: none; }   /* sidebar replaces top nav on desktop */
  .bottom-nav { display: none; }   /* sidebar replaces bottom nav on desktop */

  .app-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: var(--space-8);
  }
}

/* Mobile: hide sidebar */
@media (max-width: 767px) {
  .app-sidebar { display: none; }
  .app-main { display: contents; }
}

/* ── Loading Screen ──────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  z-index: 9999;
}
#loading-screen .spinner { width: 40px; height: 40px; }
#loading-screen p {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Utility ─────────────────────────────────────────────── */
.hidden { display: none !important; }
.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;
}
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.gap-3 { gap: var(--space-3); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
