/* ===================================================
   LUMINA — Shared Stylesheet
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #faf8f4;
  --ivory: #f4f0e8;
  --sand: #e8e0d0;
  --sand-light: #f0ece2;
  --warm-gray: #b0a898;
  --taupe: #8a7f72;
  --brown: #5c5248;
  --espresso: #2e2820;
  --gold: #c9a96e;
  --gold-light: #e8d5a8;
  --gold-dark: #a07840;
  --gold-muted: #d4bc8a;
  --accent: #7c9a8a;
  --accent-light: #a8c4b4;
  --danger: #c0614a;
  --danger-light: #f5e6e2;
  --success: #5a8a6a;
  --success-light: #e2f0e8;
  --info: #4a7a9a;
  --info-light: #e2eef5;

  --glass-bg: rgba(255,255,255,0.6);
  --glass-bg-strong: rgba(255,255,255,0.82);
  --glass-border: rgba(201,169,110,0.18);
  --glass-border-strong: rgba(201,169,110,0.30);

  --shadow-soft: 0 4px 24px rgba(46,40,32,0.07);
  --shadow-medium: 0 12px 48px rgba(46,40,32,0.11);
  --shadow-strong: 0 24px 72px rgba(46,40,32,0.16);
  --shadow-gold: 0 6px 28px rgba(201,169,110,0.22);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --sidebar-w: 72px;
  --header-h: 64px;

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--espresso);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 5%, rgba(201,169,110,0.09) 0%, transparent 60%),
    radial-gradient(ellipse 50% 70% at 85% 95%, rgba(124,154,138,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 70% 30%, rgba(232,224,208,0.4) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* =========== LAYOUT =========== */

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* =========== SIDEBAR =========== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--glass-border);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  z-index: 200;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar:hover {
  width: 220px;
}

.sidebar-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 1rem;
  box-shadow: var(--shadow-gold);
  flex-shrink: 0;
  margin-bottom: 8px;
}

.sidebar-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--espresso);
  white-space: nowrap;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  transition: all 0.3s ease 0.05s;
  margin-left: 10px;
}

.sidebar:hover .sidebar-brand {
  max-width: 140px;
  opacity: 1;
}

.sidebar-top {
  display: flex;
  align-items: center;
  padding: 0 16px;
  width: 100%;
  margin-bottom: 32px;
}

.sidebar-divider {
  width: 32px;
  height: 1px;
  background: var(--glass-border);
  margin: 12px auto;
  transition: width 0.3s ease;
}

.sidebar:hover .sidebar-divider { width: 80%; }

.nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--taupe);
  text-decoration: none;
  transition: all var(--transition);
  border-radius: 0;
  overflow: hidden;
  white-space: nowrap;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold);
  transform: scaleY(0);
  transition: transform 0.25s ease;
  border-radius: 0 2px 2px 0;
}

.nav-item:hover, .nav-item.active {
  color: var(--espresso);
  background: rgba(201,169,110,0.08);
}

.nav-item.active::before,
.nav-item:hover::before {
  transform: scaleY(1);
}

.nav-item.active {
  color: var(--gold-dark);
  background: linear-gradient(to right, rgba(201,169,110,0.12), transparent);
}

.nav-icon {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  transition: transform var(--transition-bounce);
}

.nav-item:hover .nav-icon { transform: scale(1.15); }

.nav-label {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease 0.05s;
}

.sidebar:hover .nav-label {
  max-width: 120px;
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: white;
  font-size: 0.6rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 10px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.3s ease 0.05s;
}

.sidebar:hover .nav-badge {
  max-width: 50px;
  opacity: 1;
}

/* Sidebar back button */
.sidebar-back {
  margin-top: auto;
}

/* =========== MAIN CONTENT =========== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.35s ease;
}

/* =========== TOP HEADER BAR =========== */
.top-bar {
  position: sticky;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(250,248,244,0.82);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  z-index: 100;
  box-shadow: var(--shadow-soft);
}

.top-bar-left {
  display: flex;
  flex-direction: column;
}

.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--espresso);
  line-height: 1;
}

.page-breadcrumb {
  font-size: 0.72rem;
  color: var(--warm-gray);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 7px 16px;
  font-size: 0.73rem;
  color: var(--taupe);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--warm-gray);
  transition: background 0.3s;
}

.status-dot.active { background: var(--success); box-shadow: 0 0 0 3px rgba(90,138,106,0.2); }

/* =========== PAGE PANELS =========== */
.page-panel {
  display: none;
  padding: 36px;
  flex: 1;
  animation: panelIn 0.4s ease;
}

.page-panel.active { display: block; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========== CARDS =========== */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-soft);
  transition: all var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-medium);
  border-color: var(--glass-border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--sand);
}

.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--espresso);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--gold-light), var(--sand));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  color: var(--gold-dark);
}

/* =========== BUTTONS =========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition-bounce);
  white-space: nowrap;
}

.btn i { transition: transform 0.25s ease; }
.btn:hover i { transform: scale(1.2); }

.btn-primary {
  background: linear-gradient(135deg, var(--espresso), var(--brown));
  color: var(--gold-light);
  box-shadow: 0 4px 16px rgba(46,40,32,0.18);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(46,40,32,0.24), var(--shadow-gold);
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: white;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: white;
  box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 28px rgba(201,169,110,0.4);
}

.btn-outline {
  background: transparent;
  color: var(--brown);
  border: 1px solid var(--glass-border-strong);
}

.btn-outline:hover {
  background: var(--glass-bg);
  border-color: var(--gold);
  color: var(--gold-dark);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(192,97,74,0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
  transform: translateY(-2px);
}

.btn-sm { padding: 7px 16px; font-size: 0.72rem; }
.btn-lg { padding: 14px 32px; font-size: 0.82rem; }

/* =========== FORMS =========== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--taupe);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  padding: 11px 16px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--sand);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--espresso);
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.15);
  background: white;
}

.form-control:hover:not(:focus) {
  border-color: var(--gold-muted);
}

select.form-control { cursor: pointer; }

/* =========== TABLE =========== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--sand);
  background: rgba(255,255,255,0.7);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead {
  background: linear-gradient(to right, rgba(201,169,110,0.12), rgba(232,224,208,0.4));
  position: sticky;
  top: 0;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brown);
  white-space: nowrap;
  border-bottom: 1px solid var(--sand);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

thead th:hover { color: var(--gold-dark); }

tbody tr {
  border-bottom: 1px solid rgba(232,224,208,0.5);
  transition: background var(--transition);
}

tbody tr:hover { background: rgba(201,169,110,0.05); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 11px 16px;
  color: var(--espresso);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.null-cell { color: var(--warm-gray); font-style: italic; font-size: 0.78rem; }
td.changed-cell { background: rgba(90,138,106,0.08); color: var(--success); }
td.removed-cell { background: rgba(192,97,74,0.06); color: var(--danger); text-decoration: line-through; }

/* =========== STAT PILLS =========== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-pill {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-soft);
  transition: all var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.stat-pill::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--gold), var(--gold-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.stat-pill:hover { transform: translateY(-4px); box-shadow: var(--shadow-medium); }
.stat-pill:hover::before { transform: scaleX(1); }

.stat-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warm-gray);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 500;
  color: var(--espresso);
  line-height: 1;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--taupe);
  margin-top: 4px;
}

/* =========== TAGS / BADGES =========== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.tag-info { background: var(--info-light); color: var(--info); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: rgba(201,169,110,0.15); color: var(--gold-dark); }
.tag-danger { background: var(--danger-light); color: var(--danger); }

/* =========== PROGRESS BARS =========== */
.progress-bar-outer {
  height: 6px;
  background: var(--sand);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(to right, var(--gold), var(--gold-dark));
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========== SECTION HEADINGS =========== */
.section-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--espresso);
  margin-bottom: 6px;
}

.section-sub {
  font-size: 0.82rem;
  color: var(--taupe);
  margin-bottom: 28px;
}

/* =========== EMPTY STATE =========== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
  gap: 16px;
}

.empty-state-icon {
  width: 72px; height: 72px;
  background: var(--ivory);
  border: 1px solid var(--sand);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: var(--warm-gray);
}

.empty-state h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--taupe);
}

.empty-state p {
  font-size: 0.82rem;
  color: var(--warm-gray);
  max-width: 320px;
}

/* =========== ALERTS =========== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  margin-bottom: 16px;
}

.alert i { margin-top: 2px; flex-shrink: 0; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid rgba(74,122,154,0.2); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(90,138,106,0.2); }
.alert-warning { background: rgba(201,169,110,0.1); color: var(--gold-dark); border: 1px solid rgba(201,169,110,0.25); }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(192,97,74,0.2); }

/* =========== LOADING =========== */
.loading-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--sand);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =========== TOGGLE =========== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--sand);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.3s ease;
}

.toggle-switch input:checked + .toggle-track { background: var(--gold); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }

/* =========== CHART CONTAINER =========== */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
}

/* =========== TOOLTIP =========== */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--espresso);
  color: var(--cream);
  font-size: 0.7rem;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

[data-tooltip]:hover::after { opacity: 1; }

/* =========== SCROLLBAR =========== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--ivory); }
::-webkit-scrollbar-thumb { background: var(--sand); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--warm-gray); }

/* =========== RESPONSIVE =========== */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); width: 220px; }
  .main-content { margin-left: 0; }
  .top-bar { padding: 0 20px; }
  .page-panel { padding: 20px; }
  .mobile-menu-btn { display: flex !important; }
}

@media (min-width: 901px) {
  .mobile-menu-btn { display: none !important; }
}

.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--sand);
  background: var(--glass-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--brown);
  font-size: 0.85rem;
  transition: all var(--transition);
}

.mobile-menu-btn:hover {
  background: var(--gold-light);
  border-color: var(--gold);
  color: var(--gold-dark);
}

/* =========== GRID HELPERS =========== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
