/* ═══════════════════════════════════════════
   PDV Society & Bar — Design System
   ═══════════════════════════════════════════ */

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

:root {
  /* ── Colors ── */
  --c-bg: #f6f5f1;
  --c-surface: #ffffff;
  --c-sidebar: #0f0f1a;
  --c-sidebar-2: #16162a;
  --c-sidebar-hover: #1e1e3a;
  --c-sidebar-active: #2a2a50;
  --c-sidebar-text: #7a7a94;
  --c-sidebar-text-active: #ffffff;
  --c-accent: #d4a147;
  --c-accent-soft: #fef5e6;
  --c-accent-light: #fdf2d9;
  --c-primary: #2563eb;
  --c-primary-soft: #eef2ff;
  --c-success: #059669;
  --c-success-soft: #ecfdf5;
  --c-warning: #d97706;
  --c-warning-soft: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-soft: #fef2f2;
  --c-info: #0284c7;
  --c-info-soft: #e0f2fe;
  --c-text: #1a1a2e;
  --c-text-2: #4b5563;
  --c-text-3: #9ca3af;
  --c-border: #e5e7eb;
  --c-border-2: #d1d5db;

  /* ── Typography ── */
  --ff-display: 'Sora', sans-serif;
  --ff-body: 'DM Sans', sans-serif;
  --fs-xs: 0.6875rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.75rem;
  --lh-tight: 1.15;
  --lh-normal: 1.5;

  /* ── Spacing ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* ── Radii ── */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* ── Shadows ── */
  --sh-sm: 0 1px 2px rgba(15, 15, 26, 0.05);
  --sh-md: 0 4px 12px rgba(15, 15, 26, 0.08);
  --sh-lg: 0 12px 40px rgba(15, 15, 26, 0.12);
  --sh-xl: 0 20px 60px rgba(15, 15, 26, 0.18);

  /* ── Sizes ── */
  --sidebar-w: 250px;
  --topbar-h: 60px;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background: var(--c-bg);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-display);
  line-height: var(--lh-tight);
  color: var(--c-text);
  font-weight: 700;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: var(--fs-sm); color: var(--c-text-3); }

hr { border: none; border-top: 1px solid var(--c-border); margin: var(--sp-4) 0; }

/* ── App Shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--sp-6) var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: center;
}

.sidebar-header h2 {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  color: var(--c-accent);
  letter-spacing: 0.02em;
}

.sidebar-header h2 i { margin-right: var(--sp-2); }

.sidebar-header small {
  font-size: var(--fs-xs);
  color: var(--c-sidebar-text);
  display: block;
  margin-top: 2px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: var(--sp-3) 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  color: var(--c-sidebar-text);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-nav a:hover {
  background: var(--c-sidebar-hover);
  color: var(--c-sidebar-text-active);
}

.sidebar-nav a.active {
  background: var(--c-sidebar-active);
  color: var(--c-sidebar-text-active);
  border-left-color: var(--c-accent);
}

.sidebar-nav a i {
  width: 20px;
  text-align: center;
  font-size: var(--fs-lg);
}

.sidebar-nav hr {
  border-color: rgba(255,255,255,0.06);
  margin: var(--sp-2) var(--sp-5);
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: var(--fs-sm);
  color: var(--c-sidebar-text);
}

.sidebar-footer .user-name { color: var(--c-sidebar-text-active); font-weight: 600; }
.sidebar-footer .user-role { font-size: var(--fs-xs); }
.sidebar-footer .logout-link {
  color: var(--c-danger);
  text-decoration: none;
  font-size: var(--fs-sm);
  display: inline-block;
  margin-top: var(--sp-2);
  transition: opacity 0.2s;
}
.sidebar-footer .logout-link:hover { opacity: 0.8; text-decoration: none; }

/* ── Main Content Area ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  padding: 0 var(--sp-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h3 {
  font-family: var(--ff-display);
  font-size: var(--fs-lg);
  color: var(--c-text);
  font-weight: 700;
}

.topbar-info {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--c-text-2);
}

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: var(--sp-6);
  overflow-y: auto;
}

/* ── Cards ── */
.card {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--c-border);
  margin-bottom: var(--sp-5);
  transition: box-shadow 0.2s;
}

.card:hover { box-shadow: var(--sh-md); }

.card-title {
  font-family: var(--ff-display);
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--sp-4);
}

.card-accent {
  border-left: 4px solid var(--c-accent);
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
}

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

table th {
  padding: var(--sp-3) var(--sp-3);
  text-align: left;
  font-family: var(--ff-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--c-bg);
  border-bottom: 2px solid var(--c-border);
}

table td {
  padding: var(--sp-3) var(--sp-3);
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-2);
}

table tr:last-child td { border-bottom: none; }
table tr:hover td { background: rgba(0,0,0,0.015); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border: none;
  border-radius: var(--r-md);
  font-family: var(--ff-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #047857; }

.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--c-warning); color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-info { background: var(--c-info); color: #fff; }
.btn-info:hover { background: #0369a1; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--c-border-2);
  color: var(--c-text-2);
}
.btn-outline:hover {
  border-color: var(--c-text-2);
  color: var(--c-text);
  background: var(--c-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--c-text-2);
  border: none;
}
.btn-ghost:hover { background: var(--c-bg); color: var(--c-text); }

.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-6); font-size: var(--fs-base); }
.btn-block { width: 100%; }
.btn-icon { padding: var(--sp-2); min-width: 36px; min-height: 36px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.badge-success { background: var(--c-success-soft); color: var(--c-success); }
.badge-warning { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-danger { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-info { background: var(--c-info-soft); color: var(--c-info); }
.badge-secondary { background: var(--c-bg); color: var(--c-text-2); }
.badge-accent { background: var(--c-accent-soft); color: #92400e; }

/* ── Forms ── */
.form-group { margin-bottom: var(--sp-4); }

.form-group label {
  display: block;
  font-family: var(--ff-display);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: var(--sp-1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  padding: var(--sp-3) var(--sp-3);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-md);
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  color: var(--c-text);
  outline: none;
  transition: all 0.2s;
  background: var(--c-surface);
}

.form-control:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.form-control::placeholder { color: var(--c-text-3); }

select.form-control { cursor: pointer; 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='%239ca3af' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

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

/* ── Grid Utilities ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-5); }

/* ── Flex Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap-2 { gap: var(--sp-2); }
.flex-gap-3 { gap: var(--sp-3); }
.flex-gap-4 { gap: var(--sp-4); }
.flex-gap-5 { gap: var(--sp-5); }
.flex-1 { flex: 1; }

/* ── Spacing Utilities ── */
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }

.p-4 { padding: var(--sp-4); }
.p-5 { padding: var(--sp-5); }

/* ── Text Utilities ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-muted { color: var(--c-text-3); }
.text-accent { color: var(--c-accent); }
.text-success { color: var(--c-success); }
.text-danger { color: var(--c-danger); }
.text-bold { font-weight: 700; }
.tt-upper { text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Alerts ── */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.4;
  margin-bottom: var(--sp-4);
}

.alert-success { background: var(--c-success-soft); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--c-danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--c-info-soft); color: #075985; border: 1px solid #bae6fd; }
.alert-warning { background: var(--c-warning-soft); color: #92400e; border: 1px solid #fde68a; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 26, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  justify-content: center;
  align-items: center;
  padding: var(--sp-5);
}

.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--sh-xl);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-box h2 {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-5);
  color: var(--c-text);
}

/* ── Page Title ── */
.page-title {
  font-family: var(--ff-display);
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: var(--sp-6);
  letter-spacing: -0.01em;
}

/* ── Search Box ── */
.search-box {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  align-items: end;
}

.search-box input { flex: 1; }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-5);
  color: var(--c-text-3);
}

.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--sp-3);
  opacity: 0.5;
}

.empty-state p { font-size: var(--fs-base); }

/* ── Stat Card ── */
.stat-card {
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  box-shadow: var(--sh-sm);
  transition: all 0.2s;
}

.stat-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }

.stat-card .stat-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--c-text-3);
  margin-bottom: var(--sp-1);
}

.stat-card .stat-value {
  font-family: var(--ff-display);
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 2px;
}

.stat-card .stat-sub {
  font-size: var(--fs-xs);
  color: var(--c-text-3);
}

/* ── Transitions ── */
.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2 span, .sidebar-header small,
  .sidebar-nav a span, .sidebar-footer .user-info { display: none; }
  .sidebar-nav a { justify-content: center; padding: var(--sp-3); }
  .sidebar-nav a i { width: auto; font-size: var(--fs-xl); }
  .main-content { margin-left: 60px; }
  .grid-4 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
}
