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

:root {
  --bg-primary: #0a0f1e;
  --bg-secondary: #0f1629;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(99,102,241,0.5);
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --accent-gradient: linear-gradient(135deg,#6366f1,#8b5cf6);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --sidebar-w: 260px;
  --navbar-h: 64px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
  --blur: blur(20px);
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(99,102,241,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139,92,246,0.06) 0%, transparent 60%);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== LAYOUT ===== */
#sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: rgba(15,22,41,0.95);
  backdrop-filter: var(--blur);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

#main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--transition);
  display: flex; flex-direction: column;
}

body.sidebar-collapsed #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
body.sidebar-collapsed #main-wrapper { margin-left: 0; }

/* ===== NAVBAR ===== */
#navbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--navbar-h);
  background: rgba(10,15,30,0.8);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 1.5rem;
  gap: 1rem;
}

#navbar .nav-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); padding: 8px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
  font-size: 1.2rem; line-height: 1;
}
#navbar .nav-toggle:hover { background: var(--bg-card-hover); color: var(--text-primary); }

#navbar .nav-title { font-weight: 600; color: var(--text-primary); font-size: 1rem; flex: 1; }

.profile-menu { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50px; padding: 6px 14px 6px 6px;
  cursor: pointer; transition: all var(--transition);
}
.profile-btn:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.profile-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: #fff; flex-shrink: 0;
}
.profile-name { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); }
.profile-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem;
  min-width: 160px; box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; gap: 2px;
  backdrop-filter: var(--blur);
}
.profile-dropdown.open { display: flex; }
.profile-dropdown a {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem; border-radius: 8px;
  color: var(--text-secondary); font-size: 0.875rem;
  transition: all var(--transition);
}
.profile-dropdown a:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.profile-dropdown .dropdown-divider { height: 1px; background: var(--border); margin: 0.3rem 0; }
.profile-dropdown .logout-link { color: var(--danger) !important; }
.profile-dropdown .logout-link:hover { background: rgba(239,68,68,0.1) !important; }

/* ===== SIDEBAR ===== */
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.75rem;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px; background: var(--accent-gradient);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0; box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}
.sidebar-brand .brand-text { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); line-height: 1.2; }
.sidebar-brand .brand-sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

.sidebar-nav { padding: 0.75rem 0.75rem; flex: 1; }
.nav-section-title {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.4rem; margin-top: 0.5rem;
}
.nav-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem; border-radius: 8px;
  color: var(--text-secondary); font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition); margin-bottom: 2px;
  position: relative;
}
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active {
  background: rgba(99,102,241,0.15); color: var(--accent);
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 3px; background: var(--accent-gradient); border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.nav-submenu { padding-left: 0.5rem; overflow: hidden; }
.nav-submenu .nav-item,
.nav-submenu .sub-item {
  font-size: 0.825rem; padding: 0.45rem 0.75rem 0.45rem 1.1rem;
  opacity: 0.9; margin-bottom: 1px;
}
.nav-submenu .nav-item:hover,
.nav-submenu .sub-item:hover { opacity: 1; }

.nav-item.nav-dropdown-toggle.active {
  background: transparent;
  color: var(--text-primary);
}
.nav-item.nav-dropdown-toggle.active::before {
  display: none;
}

.nav-dropdown { margin-bottom: 2px; }
.nav-dropdown-toggle { width: 100%; justify-content: flex-start; }
.nav-arrow {
  margin-left: auto; font-size: 0.65rem;
  color: var(--text-muted); transition: transform 0.25s ease;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem; color: var(--text-muted);
}

/* ===== MAIN CONTENT ===== */
#content { flex: 1; padding: 1.75rem; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.page-header h2 { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); }
.page-header p { color: var(--text-secondary); font-size: 0.875rem; margin-top: 0.2rem; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--blur);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 1.5rem; }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1.25rem; margin-bottom: 1.75rem; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  display: flex; align-items: center; gap: 1.1rem;
  transition: all var(--transition); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; inset: 0;
  background: var(--accent-gradient); opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 0.04; }
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.purple { background: rgba(99,102,241,0.15); }
.stat-icon.green  { background: rgba(16,185,129,0.15); }
.stat-icon.orange { background: rgba(245,158,11,0.15); }
.stat-icon.red    { background: rgba(239,68,68,0.15); }
.stat-icon.blue   { background: rgba(59,130,246,0.15); }
.stat-info .stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-info .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-info .stat-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.1rem; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th {
  background: rgba(255,255,255,0.03);
  padding: 0.85rem 1rem; text-align: left;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody td { padding: 0.85rem 1rem; color: var(--text-secondary); vertical-align: middle; }
tbody td strong { color: var(--text-primary); }

/* ===== FORMS ===== */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label { font-size: 0.825rem; font-weight: 500; color: var(--text-secondary); }
.form-control {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.65rem 0.9rem;
  color: var(--text-primary); font-size: 0.9rem; font-family: inherit;
  width: 100%; transition: all var(--transition); outline: none;
}
.form-control:focus { border-color: var(--accent); background: rgba(99,102,241,0.06); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--accent-gradient); color: #fff; box-shadow: 0 4px 16px rgba(99,102,241,0.35); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(99,102,241,0.5); transform: translateY(-1px); color:#fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #0da871; transform: translateY(-1px); color:#fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); color:#fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #d97706; color:#000; transform: translateY(-1px); }
.btn-outline {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,0.07); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; border-radius: 8px; }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== BADGES ===== */
.badge {
  display: inline-block; padding: 0.25em 0.7em;
  border-radius: 50px; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.25);  }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.25); }
.badge-info    { background: rgba(59,130,246,0.15); color: var(--info);    border: 1px solid rgba(59,130,246,0.25);  }
.badge-muted   { background: rgba(255,255,255,0.07);color: var(--text-muted); border: 1px solid var(--border); }

/* ===== ALERTS ===== */
.alert {
  padding: 0.85rem 1.1rem; border-radius: var(--radius);
  font-size: 0.875rem; margin-bottom: 1rem; border: 1px solid;
  display: flex; align-items: flex-start; gap: 0.6rem;
}
.alert-success { background: rgba(16,185,129,0.1);  color: #10b981; border-color: rgba(16,185,129,0.25); }
.alert-danger  { background: rgba(239,68,68,0.1);   color: #ef4444; border-color: rgba(239,68,68,0.25);  }
.alert-warning { background: rgba(245,158,11,0.1);  color: #f59e0b; border-color: rgba(245,158,11,0.25); }
.alert-info    { background: rgba(59,130,246,0.1);  color: #3b82f6; border-color: rgba(59,130,246,0.25); }

/* ===== WALLET BALANCE DISPLAY ===== */
.wallet-display {
  background: var(--accent-gradient); border-radius: var(--radius-lg);
  padding: 1.5rem; color: #fff; position: relative; overflow: hidden;
}
.wallet-display::after {
  content: '₹'; position: absolute; right: -10px; top: -20px;
  font-size: 8rem; font-weight: 800; opacity: 0.08; line-height: 1;
}
.wallet-display .wd-label { font-size: 0.8rem; font-weight: 500; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.1em; }
.wallet-display .wd-amount { font-size: 2.5rem; font-weight: 800; line-height: 1.1; margin: 0.25rem 0; }
.wallet-display .wd-sub { font-size: 0.78rem; opacity: 0.7; }

/* ===== QR CARD ===== */
.qr-box {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 2rem; text-align: center; background: var(--bg-card);
}
.qr-box img { max-width: 180px; border-radius: 12px; margin-bottom: 1rem; }
.qr-box p { color: var(--text-secondary); font-size: 0.875rem; }

/* ===== SECTION DOCS ===== */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1.25rem; }
.doc-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  transition: all var(--transition); cursor: pointer;
}
.doc-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.doc-card .doc-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.doc-card h4 { color: var(--text-primary); font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }
.doc-card p  { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 1rem; }
.doc-card .doc-price { font-size: 1.1rem; font-weight: 700; color: var(--accent); margin-bottom: 1rem; }
.doc-card .doc-actions { display: flex; gap: 0.5rem; }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 0.5rem; }

/* ===== OVERLAY for mobile ===== */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 99;
  backdrop-filter: blur(4px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }
  #main-wrapper { margin-left: 0 !important; }
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  body.sidebar-open #sidebar { transform: translateX(0); }
  body.sidebar-open #sidebar-overlay { display: block; }
  #content { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.3s ease both; }
.fade-in-delay-1 { animation-delay: 0.05s; }
.fade-in-delay-2 { animation-delay: 0.10s; }
.fade-in-delay-3 { animation-delay: 0.15s; }
.fade-in-delay-4 { animation-delay: 0.20s; }

/* ===== MODAL ===== */
dialog {
  margin: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 400px;
  backdrop-filter: var(--blur);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
dialog .dialog-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem;
}
dialog .dialog-header h3 { margin: 0; font-size: 1.1rem; }
dialog .dialog-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem;
}
dialog .dialog-close:hover { color: var(--text-primary); }

/* ===== FORM VALIDATION ===== */
.form-group.has-error .form-control,
.form-group.has-error select.form-control,
.form-group.has-error textarea.form-control {
  border-color: var(--danger);
  background: rgba(239,68,68,0.05);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}
.field-error {
  display: none;
  color: var(--danger);
  font-size: 0.76rem;
  margin-top: 0.2rem;
}
.form-group.has-error .field-error { display: block; }

/* ===== FORM ACTIONS ===== */
.form-actions {
  display: flex; gap: 1rem; flex-wrap: wrap;
  justify-content: flex-end; margin-top: 1.5rem;
  padding-top: 1rem; border-top: 1px solid var(--border);
}

/* ===== EXTRA UTILITIES ===== */
.text-danger { color: var(--danger); }
.bg-sidebar  { background: var(--bg-secondary); }
