@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --burgundy: #8B2942;
  --burgundy-dark: #6d1f33;
  --gold: #C9A96E;
  --gold-light: #d4ba8a;
  --cream: #FDF8F0;
  --dark: #1A0A10;
  --white: #ffffff;
  --gray-50: #fafaf9;
  --gray-100: #f5f2ed;
  --gray-200: #e8e2d9;
  --gray-300: #d4ccc0;
  --gray-400: #a89e90;
  --gray-500: #7c7268;
  --gray-600: #5a5148;
  --gray-700: #3d362f;
  --danger: #dc3545;
  --success: #28a745;
  --warning: #ffc107;
  --info: #17a2b8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--dark);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
}

a {
  color: var(--burgundy);
  text-decoration: none;
}
a:hover {
  color: var(--burgundy-dark);
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--dark);
  color: var(--white);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h1 {
  font-size: 1.5rem;
  color: var(--white);
  font-weight: 800;
}

.sidebar-brand span {
  color: var(--gold);
  font-size: 0.75rem;
  display: block;
  margin-top: 2px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--gray-300);
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(139, 41, 66, 0.2);
  color: var(--white);
  border-left-color: var(--gold);
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer a {
  color: var(--gray-400);
  font-size: 0.85rem;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h2 {
  font-size: 1.25rem;
  color: var(--dark);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.content {
  padding: 32px;
}

.card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 1.1rem;
  color: var(--dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  padding: 20px;
  text-align: center;
}

.stat-card .stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--burgundy);
}

.stat-card .stat-label {
  color: var(--gray-500);
  font-size: 0.85rem;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--burgundy);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--burgundy-dark);
  color: var(--white);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--dark);
}
.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-gold {
  background: var(--gold);
  color: var(--dark);
}
.btn-gold:hover {
  background: var(--gold-light);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover {
  background: #c82333;
  color: var(--white);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gray-700);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--dark);
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(139, 41, 66, 0.1);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237c7268' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}

th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

td {
  font-size: 0.9rem;
}

tr:hover td {
  background: var(--cream);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-danger {
  background: #f8d7da;
  color: #721c24;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-info {
  background: #d1ecf1;
  color: #0c5460;
}

.badge-secondary {
  background: var(--gray-200);
  color: var(--gray-600);
}

.badge-gold {
  background: var(--gold);
  color: white;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .form-group {
  min-width: 200px;
}

.flash-messages {
  margin-bottom: 20px;
}

.flash {
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.flash-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.flash-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.flash-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

.join-link-box {
  background: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  word-break: break-all;
  font-family: monospace;
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.95rem;
}

.auth-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark) 0%, var(--burgundy-dark) 100%);
}

.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card .brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card .brand .brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: rgba(139, 41, 66, 0.08);
  border-radius: 50%;
  margin: 0 auto 8px;
}

.auth-card .brand h1 {
  font-size: 2rem;
  color: var(--burgundy);
}

.auth-card .brand p {
  color: var(--gold);
  font-size: 0.85rem;
  margin-top: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.auth-card h2 {
  font-size: 1.3rem;
  margin-bottom: 24px;
  color: var(--dark);
}

.auth-card .form-group {
  margin-bottom: 16px;
}

.auth-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  justify-content: center;
  text-align: center;
}

.auth-links {
  text-align: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.auth-links a {
  color: var(--burgundy);
  font-weight: 600;
}

.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}

.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  font-size: 0.85rem;
}

.pagination a:hover {
  background: var(--gray-100);
}

.pagination .active {
  background: var(--burgundy);
  color: var(--white);
  border-color: var(--burgundy);
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-item label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  display: block;
  margin-bottom: 2px;
}

.detail-item p {
  font-size: 0.95rem;
  color: var(--dark);
  font-weight: 500;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--dark);
  font-size: 1.5rem;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .mobile-toggle {
    display: block;
  }
  .topbar {
    padding: 12px 16px;
  }
  .content {
    padding: 16px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Dark Mode ───────────────────────────────────────────────────── */
[data-theme="dark"] {
  --cream: #1a1218;
  --white: #241820;
  --gray-50: #1e1520;
  --gray-100: #2a1e26;
  --gray-200: #3a2c38;
  --gray-300: #4e3d4a;
  --gray-400: #7a6876;
  --gray-500: #a090a0;
  --gray-600: #c8b8c8;
  --gray-700: #e0d0e0;
  --dark: #f0e8f0;
}
[data-theme="dark"] body {
  background: #1a1218;
  color: #f0e8f0;
}
[data-theme="dark"] .sidebar {
  background: #110c10;
}
[data-theme="dark"] .topbar {
  background: #241820;
  border-color: #3a2c38;
}
[data-theme="dark"] .card {
  background: #241820;
  border-color: #3a2c38;
}
[data-theme="dark"] .card-header {
  border-color: #3a2c38;
}
[data-theme="dark"] table thead {
  background: #2a1e26;
}
[data-theme="dark"] table tbody tr:hover {
  background: #2f2030;
}
[data-theme="dark"] table td, [data-theme="dark"] table th {
  border-color: #3a2c38;
  color: #e0d0e0;
}
[data-theme="dark"] .form-control {
  background: #2a1e26;
  border-color: #4e3d4a;
  color: #e0d0e0;
}
[data-theme="dark"] .form-control:focus {
  border-color: var(--burgundy);
  background: #2a1e26;
}
[data-theme="dark"] .btn-secondary {
  background: #3a2c38;
  color: #e0d0e0;
  border-color: #4e3d4a;
}
[data-theme="dark"] .btn-outline {
  background: transparent;
  border-color: #4e3d4a;
  color: #e0d0e0;
}
[data-theme="dark"] .badge-secondary {
  background: #3a2c38;
  color: #c8b8c8;
}
[data-theme="dark"] .milestone-form,
[data-theme="dark"] .calendar-wrap {
  background: #241820;
  border-color: #3a2c38;
}

/* ── Dark Mode Toggle Button ─────────────────────────────────────── */
.dark-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.dark-toggle:hover { opacity: 1; }

/* ── Keyboard Shortcut Overlay ───────────────────────────────────── */
.shortcut-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  align-items: center;
  justify-content: center;
}
.shortcut-overlay.open { display: flex; }
.shortcut-modal {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 92%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.shortcut-modal h2 {
  margin: 0 0 20px;
  color: var(--burgundy);
  font-size: 1.2rem;
}
.shortcut-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 20px;
  align-items: center;
}
.shortcut-key {
  font-family: monospace;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}
.shortcut-desc {
  font-size: 0.88rem;
  color: var(--gray-600);
}

/* ── Readability Badge ───────────────────────────────────────────── */
.readability-bar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--gray-200);
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--gray-500);
}
.readability-stat { display: flex; align-items: center; gap: 6px; }
.readability-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.78rem;
}

/* ── Bulk Action Row ─────────────────────────────────────────────── */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--gray-50);
  border-radius: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bulk-action-bar select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--gray-300);
  font-size: 0.88rem;
  background: var(--white);
}

