/* ===============================
   VARIABLES & RESET
=============================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #10b981;
  --danger: #ef4444;
  --background: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-width: 260px;
  --border-radius-xl: 20px;
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px -10px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 0 1px rgba(79, 70, 229, 0.08);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text-main);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===============================
   APP SHELL (sidebar + main)
=============================== */

body.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #e2e8f0;
  padding: 24px 0 32px;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.2);
  z-index: 1000;
}

.sidebar-logo {
  text-align: center;
  margin-bottom: 28px;
  padding: 0 20px;
}

.sidebar-logo img {
  width: 72px;
  height: auto;
  display: block;
  margin: 0 auto 12px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.sidebar h4 {
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 1rem;
  color: #f8fafc;
}

.sidebar a {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  color: #94a3b8;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar a:hover {
  background: var(--sidebar-hover);
  color: #fff;
  padding-left: 32px;
}

.sidebar a.active {
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.35) 0%, transparent 100%);
  color: #fff;
  border-left-color: #818cf8;
  font-weight: 600;
}

.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  padding: 32px 40px 48px;
  display: flex;
  flex-direction: column;
}

.page-inner {
  flex: 1;
  width: 100%;
  max-width: 1400px;
}

/* ===============================
   PAGE TYPOGRAPHY
=============================== */

.page-title,
.main-content > h2:first-child,
.page-inner > h2:first-child,
section > h2:first-child {
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: -0.5px;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}

.main-content h4 {
  font-weight: 700;
  color: var(--text-main);
}

/* ===============================
   CARDS
=============================== */

.card {
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card::before {
  display: none;
}

/* ===============================
   TABLES
=============================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--border-radius-lg);
  background: var(--surface);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.data-table,
.main-content .table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: collapse;
  border-spacing: 0;
}

.data-table thead,
.main-content .table thead {
  background: #f8fafc;
}

.data-table th,
.main-content .table thead th {
  padding: 14px 16px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.data-table td,
.main-content .table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  background: var(--surface);
  color: var(--text-main);
}

.data-table tbody tr:last-child td,
.main-content .table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td,
.main-content .table tbody tr:hover td {
  background: #f8fafc;
}

.main-content .table.table-bordered {
  border: none;
}

.main-content .table.table-bordered th,
.main-content .table.table-bordered td {
  border: none;
  border-bottom: 1px solid #f1f5f9;
}

.main-content .table img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
}

/* ===============================
   BUTTONS & INPUTS
=============================== */

.btn {
  border-radius: var(--border-radius-md);
  padding: 10px 20px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #3730a3 100%);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4);
  background: linear-gradient(135deg, var(--primary-hover) 0%, #312e81 100%);
  color: #fff;
}

.form-control,
.form-select {
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-md);
  padding: 12px 16px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text-main);
  transition: var(--transition-smooth);
}

.form-control:focus,
.form-select:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
  outline: none;
}

.form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ===============================
   FOOTER
=============================== */

.app-footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.app-footer--dark {
  margin-top: 48px;
  padding: 20px;
  background: #0f172a;
  color: #94a3b8;
  border-radius: var(--border-radius-lg);
}

/* ===============================
   UTILITIES
=============================== */

.panel {
  background: var(--surface);
  border: 1px solid #e2e8f0;
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 1.5rem 0;
}

/* ===============================
   RESPONSIVE
=============================== */

@media (max-width: 992px) {
  :root {
    --sidebar-width: 220px;
  }

  .main-content {
    padding: 24px 20px 32px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    min-height: unset;
    padding: 16px 0 12px;
  }

  .sidebar-logo {
    margin-bottom: 12px;
  }

  .sidebar-logo img {
    width: 56px;
  }

  .sidebar a {
    padding: 12px 20px;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 20px 16px 32px;
  }

  .page-title,
  .main-content > h2:first-child {
    font-size: 1.4rem;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: 16px 12px 24px;
  }

  .btn {
    width: 100%;
  }

  .btn-inline-group .btn {
    width: auto;
  }

  .table-responsive .table {
    min-width: 640px;
  }
}
