/* ── Fonts ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

/* ── Design Tokens ─────────────────────────── */
:root {
  --brown-900: #1C0D05;
  --brown-800: #2A1208;
  --brown-700: #3B1F0E;
  --brown-600: #5C3317;
  --brown-400: #8B5E3C;
  --amber:     #C97B2A;
  --amber-light: #E8A84A;
  --cream:     #F7F2EA;
  --cream-dark:#EDE5D8;
  --text-primary: #1C0D05;
  --text-secondary: #6B6258;
  --text-muted: #9E8E80;
  --white: #FFFFFF;
  --success: #2D7A4F;
  --danger:  #C0392B;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --transition: 0.18s ease;
}

/* ── Typography Scale ───────────────────────── */
:root {
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   26px;
  --text-2xl:  34px;
}

h1, h2 { font-family: 'Playfair Display', serif; }
h1 { font-size: var(--text-2xl); line-height: 1.2; }
h2 { font-size: var(--text-xl);  line-height: 1.3; }
h3 { font-size: var(--text-md);  font-family: 'Inter', sans-serif; font-weight: 600; }
p, button, input, select, textarea { font-family: 'Inter', sans-serif; font-size: var(--text-base); }

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  color: var(--text-primary);
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────── */
.sidebar {
  background: var(--brown-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
  position: fixed;
  top: 0; left: 0;
  width: 240px;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
}
.sidebar-logo img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--amber-light);
  line-height: 1.3;
}

.sidebar nav { flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 4px;
  cursor: pointer;
}
.nav-item:hover  { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: var(--amber); color: white; }
.nav-item .nav-icon { font-size: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

/* ── Main content area ──────────────────────── */
.main-area {
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  grid-column: 2;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--cream-dark);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-left { flex-shrink: 0; }

.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--cream);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(201,123,42,0.12);
}
.search-bar svg { flex-shrink: 0; color: var(--text-muted); }
.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Inter', sans-serif;
  font-size: var(--text-sm);
  color: var(--text-primary);
  width: 180px;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* Icon button (notification bell) */
.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  background: var(--cream);
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 17px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--cream-dark); border-color: var(--amber); }

.badge {
  position: absolute;
  top: -6px; right: -6px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid white;
}

/* User avatar */
.topbar-avatar {
  width: 38px; height: 38px;
  background: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.topbar-avatar:hover { border-color: var(--amber-light); }
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* user-chip — works both as wrapper and as direct avatar element */
.user-chip {
  width: 38px; height: 38px;
  background: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition);
  overflow: hidden;
}
.user-chip:hover { border-color: var(--amber-light); }
.user-chip img   { width: 100%; height: 100%; object-fit: cover; }

/* avatar-sm — standalone variant */
.avatar-sm {
  width: 38px; height: 38px;
  background: var(--amber);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.avatar-sm:hover { border-color: var(--amber-light); }

/* Notification badge on icon-btn */
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid white;
}

@media (max-width: 768px) {
  .topbar { padding: 10px 16px; }
  .search-bar { display: none; }
}

.page-content {
  padding: 32px;
  max-width: 1100px;
  width: 100%;
  flex: 1;
}

/* ── Card component system ──────────────────── */

/* Base card */
.card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--cream-dark);
  padding: 24px;
  margin-bottom: 20px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Service card variant */
.service-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
}

.service-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: var(--cream);
  flex-shrink: 0;
}

/* Stat/metric card */
.stat-card {
  background: linear-gradient(135deg, var(--brown-700), var(--brown-900));
  color: white;
  border-radius: var(--radius-md);
  padding: 24px;
  border: none;
  margin-bottom: 20px;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-value { font-size: var(--text-2xl); font-weight: 700; }
.stat-card .stat-label { font-size: var(--text-sm); opacity: 0.7; margin-top: 4px; }

/* ── Form system ────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  padding: 12px 16px;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: 'Inter', sans-serif;
  background: white;
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.form-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(201, 123, 42, 0.15);
}
.form-input::placeholder { color: var(--text-muted); }

/* Priority toggle */
.toggle-group {
  display: flex;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}
.toggle-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}
.toggle-btn.active {
  background: white;
  box-shadow: var(--shadow-sm);
  color: var(--amber);
  font-weight: 600;
}

/* ── Stats row ──────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 900px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* ── Button system ──────────────────────────── */

/* Base */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* Variants */
.btn-primary {
  background: var(--amber);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--amber-light); transform: translateY(-1px); }

.btn-secondary {
  background: transparent;
  color: var(--brown-700);
  border: 1.5px solid var(--brown-600);
}
.btn-secondary:hover:not(:disabled) { background: var(--cream-dark); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #a93226; transform: translateY(-1px); }

/* Sizes */
.btn-sm { padding: 7px 14px;  font-size: var(--text-xs); }
.btn-lg { padding: 14px 28px; font-size: var(--text-md); }
.btn-full { width: 100%; justify-content: center; }

/* ── Micro-animations ───────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card, .stat-card, .service-card {
  animation: fadeUp 0.3s ease both;
}
.card:nth-child(1), .stat-card:nth-child(1), .service-card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2), .stat-card:nth-child(2), .service-card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3), .stat-card:nth-child(3), .service-card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4), .stat-card:nth-child(4), .service-card:nth-child(4) { animation-delay: 0.20s; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--cream) 25%, var(--cream-dark) 50%, var(--cream) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  display: inline-block;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Mobile: bottom nav ─────────────────────── */
.bottom-nav { display: none; }

@media (max-width: 768px) {
  body {
    grid-template-columns: 1fr;
    padding-bottom: 74px;
  }
  .sidebar   { display: none; }
  .main-area { margin-left: 0; grid-column: 1; }
  .topbar    { padding: 12px 16px; }
  .page-content { padding: 16px; max-width: 100%; }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--brown-900);
    padding: 8px 0 20px;
    z-index: 100;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .bottom-nav a .nav-icon { font-size: 20px; }
  .bottom-nav a.active { color: var(--amber-light); }
}

@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
}
