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

/* =================== CSS VARIABLES =================== */
:root {
  --bg-primary: #060913;
  --bg-secondary: #0c101f;
  --bg-card: rgba(18, 24, 46, 0.65);
  --bg-card-hover: rgba(26, 34, 64, 0.8);
  --accent-primary: #6c5ce7;
  --accent-secondary: #9c88ff;
  --accent-success: #10ac84;
  --accent-danger: #ee5253;
  --accent-warning: #ffa801;
  --accent-info: #00d2d3;
  --text-primary: #f5f6fa;
  --text-secondary: #a4b0be;
  --text-muted: #57606f;
  --border: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(108, 92, 231, 0.25);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 35px rgba(108, 92, 231, 0.08);
  --accent-glow: rgba(108, 92, 231, 0.25);
  --radius: 18px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --glass: rgba(12, 16, 31, 0.85);
  --glass-border: rgba(255, 255, 255, 0.07);
}

/* =================== THEMES & TRANSITIONS =================== */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.card, .sidebar, .topbar, .modal, .btn, .stat-card, .nav-item, .form-control {
  transition: background 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

/* Base Themes Override */
body.theme-dark {
  --bg-primary: #000000;
  --bg-secondary: #080808;
  --bg-card: rgba(12, 12, 12, 0.85);
  --bg-card-hover: rgba(22, 22, 22, 0.95);
  --border: rgba(255, 255, 255, 0.03);
  --glass: rgba(8, 8, 8, 0.95);
  --glass-border: rgba(255, 255, 255, 0.04);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7);
}

body.theme-light {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(248, 250, 252, 0.9);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: var(--accent-primary);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 35px rgba(0, 0, 0, 0.01);
  --glass: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.06);
}

body.theme-forest {
  --bg-primary: #05140f;
  --bg-secondary: #0c2018;
  --bg-card: rgba(15, 38, 29, 0.65);
  --bg-card-hover: rgba(22, 54, 42, 0.8);
  --text-primary: #e6f4ea;
  --text-secondary: #9cccac;
  --text-muted: #4d7a5e;
  --border: rgba(255, 255, 255, 0.04);
  --glass: rgba(12, 32, 24, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
}

body.theme-nord {
  --bg-primary: #2e3440;
  --bg-secondary: #3b4252;
  --bg-card: rgba(59, 66, 82, 0.7);
  --bg-card-hover: rgba(76, 86, 106, 0.85);
  --text-primary: #eceff4;
  --text-secondary: #d8dee9;
  --text-muted: #6e84a3;
  --border: rgba(255, 255, 255, 0.05);
  --glass: rgba(46, 52, 64, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

body.theme-sepia {
  --bg-primary: #f4ecd8;
  --bg-secondary: #ebdcb9;
  --bg-card: rgba(235, 220, 185, 0.75);
  --bg-card-hover: rgba(224, 206, 164, 0.9);
  --text-primary: #433422;
  --text-secondary: #5c4b37;
  --text-muted: #8c765c;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: var(--accent-primary);
  --shadow: 0 10px 30px rgba(67, 52, 34, 0.05);
  --shadow-glow: 0 0 35px rgba(67, 52, 34, 0.01);
  --glass: rgba(235, 220, 185, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
}

/* Color Accents Override */
body.accent-blue {
  --accent-primary: #3b82f6;
  --accent-secondary: #60a5fa;
  --border-hover: rgba(59, 130, 246, 0.25);
  --shadow-glow: 0 0 35px rgba(59, 130, 246, 0.08);
  --accent-glow: rgba(59, 130, 246, 0.25);
}

body.accent-red {
  --accent-primary: #ef4444;
  --accent-secondary: #f87171;
  --border-hover: rgba(239, 68, 68, 0.25);
  --shadow-glow: 0 0 35px rgba(239, 68, 68, 0.08);
  --accent-glow: rgba(239, 68, 68, 0.25);
}

body.accent-green {
  --accent-primary: #10b981;
  --accent-secondary: #34d399;
  --border-hover: rgba(16, 185, 129, 0.25);
  --shadow-glow: 0 0 35px rgba(16, 185, 129, 0.08);
  --accent-glow: rgba(16, 185, 129, 0.25);
}

body.accent-orange {
  --accent-primary: #f97316;
  --accent-secondary: #fdba74;
  --border-hover: rgba(249, 115, 22, 0.25);
  --shadow-glow: 0 0 35px rgba(249, 115, 22, 0.08);
  --accent-glow: rgba(249, 115, 22, 0.25);
}

body.accent-yellow {
  --accent-primary: #eab308;
  --accent-secondary: #fef08a;
  --border-hover: rgba(234, 179, 8, 0.25);
  --shadow-glow: 0 0 35px rgba(234, 179, 8, 0.08);
  --accent-glow: rgba(234, 179, 8, 0.25);
}

body.accent-pink {
  --accent-primary: #ec4899;
  --accent-secondary: #fbcfe8;
  --border-hover: rgba(236, 72, 153, 0.25);
  --shadow-glow: 0 0 35px rgba(236, 72, 153, 0.08);
  --accent-glow: rgba(236, 72, 153, 0.25);
}

body.accent-teal {
  --accent-primary: #06b6d4;
  --accent-secondary: #67e8f9;
  --border-hover: rgba(6, 182, 212, 0.25);
  --shadow-glow: 0 0 35px rgba(6, 182, 212, 0.08);
  --accent-glow: rgba(6, 182, 212, 0.25);
}

/* Theme Dropdown Panel */
.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: slideDown 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

.theme-dropdown-header {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.theme-colors-list {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

.theme-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.theme-color-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-color-btn.active {
  border-color: var(--text-primary);
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 0 10px var(--accent-primary);
}

.theme-color-btn.accent-purple { background: #6c5ce7; }
.theme-color-btn.accent-blue { background: #3b82f6; }
.theme-color-btn.accent-red { background: #ef4444; }
.theme-color-btn.accent-green { background: #10b981; }
.theme-color-btn.accent-orange { background: #f97316; }
.theme-color-btn.accent-yellow { background: #eab308; }
.theme-color-btn.accent-pink { background: #ec4899; }
.theme-color-btn.accent-teal { background: #06b6d4; }

.theme-modes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-mode-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

body.theme-light .theme-mode-option,
body.theme-sepia .theme-mode-option {
  background: rgba(0, 0, 0, 0.02);
}

.theme-mode-option:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-primary);
}

body.theme-light .theme-mode-option:hover,
body.theme-sepia .theme-mode-option:hover {
  background: rgba(0, 0, 0, 0.04);
}

.theme-mode-option.active {
  background: rgba(108, 92, 231, 0.1);
  border-color: var(--accent-primary);
  font-weight: 600;
}

body.accent-blue .theme-mode-option.active { background: rgba(59, 130, 246, 0.1); }
body.accent-red .theme-mode-option.active { background: rgba(239, 68, 68, 0.1); }
body.accent-green .theme-mode-option.active { background: rgba(16, 185, 129, 0.1); }
body.accent-orange .theme-mode-option.active { background: rgba(249, 115, 22, 0.1); }
body.accent-yellow .theme-mode-option.active { background: rgba(234, 179, 8, 0.1); }
body.accent-pink .theme-mode-option.active { background: rgba(236, 72, 153, 0.1); }
body.accent-teal .theme-mode-option.active { background: rgba(6, 182, 212, 0.1); }

/* =================== SVG ICONS =================== */
.svg-icon {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
  transition: var(--transition);
}

.nav-icon .svg-icon {
  width: 18px;
  height: 18px;
}

.btn .svg-icon {
  width: 16px;
  height: 16px;
}

.stat-icon .svg-icon {
  width: 24px;
  height: 24px;
}

/* =================== RESET & GLOBAL =================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* =================== SCROLLBAR =================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-secondary);
}

/* =================== FONTS & UTILS =================== */
.font-mono {
  font-family: 'JetBrains Mono', monospace !important;
}

.hidden {
  display: none !important;
}

/* =================== LOGIN PAGE =================== */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, rgba(108, 92, 231, 0.18) 0%, transparent 45%),
              radial-gradient(circle at bottom right, rgba(0, 210, 211, 0.12) 0%, transparent 45%),
              var(--bg-primary);
  position: relative;
}

.login-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: var(--shadow), var(--shadow-glow);
  animation: slideUp 0.5s ease;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  justify-content: center;
}

.login-logo-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.35);
}

.login-logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -2px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 30px;
}

.error-badge {
  color: var(--accent-danger);
  font-size: 13px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(238, 82, 83, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(238, 82, 83, 0.18);
}

/* =================== APP LAYOUT =================== */
#app {
  display: flex;
  min-height: 100vh;
}

/* =================== SIDEBAR =================== */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.25);
  flex-shrink: 0;
}

.logo-text {
  font-size: 17px;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: -2px;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 18px;
}

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 3px;
  border: 1px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.nav-item.active {
  background: rgba(108, 92, 231, 0.12);
  color: var(--accent-secondary);
  border-color: rgba(108, 92, 231, 0.18);
  font-weight: 600;
}

.nav-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

/* =================== MAIN & TOPBAR =================== */
.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 10% 10%, rgba(108, 92, 231, 0.04) 0%, transparent 40%),
              var(--bg-primary);
}

.topbar {
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* =================== PAGE GENERAL =================== */
.page-content {
  padding: 32px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  animation: fadeIn 0.4s ease;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 13px;
}

/* =================== CARDS & WIDGETS =================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =================== TABLES =================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-primary);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

th {
  background: var(--bg-secondary);
  padding: 14px 18px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

.user-row-clickable {
  cursor: pointer;
  transition: var(--transition);
}

.user-row-clickable:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* =================== PAGINATION =================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 10px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.page-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-primary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 12px;
}

/* =================== STAT CARDS =================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 110px;
  transition: var(--transition);
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: radial-gradient(circle, var(--color2) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.stat-card:hover::before {
  transform: scale(1.5);
  opacity: 0.25;
}

.stat-icon {
  font-size: 18px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(238, 82, 83, 0.12);
  border-color: rgba(238, 82, 83, 0.2);
  color: #ff7675;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(238, 82, 83, 0.25);
  border-color: rgba(238, 82, 83, 0.4);
}

.btn-warning {
  background: rgba(255, 168, 1, 0.12);
  border-color: rgba(255, 168, 1, 0.2);
  color: #fed330;
}

.btn-warning:hover:not(:disabled) {
  background: rgba(255, 168, 1, 0.22);
}

.btn-success {
  background: rgba(16, 172, 132, 0.12);
  border-color: rgba(16, 172, 132, 0.2);
  color: #2bcbba;
}

.btn-success:hover:not(:disabled) {
  background: rgba(16, 172, 132, 0.22);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

.full-width {
  width: 100%;
  justify-content: center;
}

/* =================== FORMS =================== */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
  background: var(--bg-secondary);
}

textarea.form-control {
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* =================== BADGES =================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success { background: rgba(16, 172, 132, 0.15); color: #2bcbba; }
.badge-danger { background: rgba(238, 82, 83, 0.15); color: #ff7675; }
.badge-warning { background: rgba(255, 168, 1, 0.15); color: #fed330; }
.badge-info { background: rgba(0, 210, 211, 0.15); color: #00d2d3; }
.badge-purple { background: rgba(108, 92, 231, 0.15); color: #a29bfe; }
.badge-muted { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); }

/* =================== FILTERS =================== */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.filter-chip.active {
  background: rgba(108, 92, 231, 0.12);
  border-color: rgba(108, 92, 231, 0.3);
  color: var(--accent-secondary);
}

/* =================== MODAL OVERLAY & CONTENT =================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.25s ease;
}

.modal {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  width: 90%;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  animation: slideUp 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* =================== TOAST NOTIFICATIONS =================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  min-width: 250px;
  max-width: 350px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: slideInRight 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
}

.toast.success { border-left: 4px solid var(--accent-success); }
.toast.error { border-left: 4px solid var(--accent-danger); }
.toast.warning { border-left: 4px solid var(--accent-warning); }
.toast.info { border-left: 4px solid var(--accent-primary); }

/* =================== STATUS BADGES & ALERTS =================== */
.maintenance-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.maintenance-badge.off {
  background: rgba(16, 172, 132, 0.1);
  border-color: rgba(16, 172, 132, 0.2);
  color: #2bcbba;
}

.maintenance-badge.on {
  background: rgba(238, 82, 83, 0.1);
  border-color: rgba(238, 82, 83, 0.2);
  color: #ff7675;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.info-alert {
  background: rgba(108, 92, 231, 0.07);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* =================== CHAT LAYOUT =================== */
.chat-message {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  max-width: 85%;
  word-break: break-word;
}

.chat-message.user {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.chat-message.manager {
  align-self: flex-end;
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.2);
  color: var(--text-primary);
}

.chat-message.system {
  align-self: center;
  background: rgba(0, 210, 211, 0.05);
  border: 1px solid rgba(0, 210, 211, 0.15);
  color: var(--accent-info);
  text-align: center;
  font-style: italic;
  max-width: 95%;
}

/* =================== TELEGRAM PREVIEW BOX =================== */
.telegram-preview-box {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}

.telegram-preview-box::before {
  content: 'Telegram Bot Preview';
  position: absolute;
  top: -8px;
  left: 14px;
  background: var(--bg-primary);
  padding: 0 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* =================== OTHER CARD VIEWS =================== */
.tarifs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.tarif-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
  transition: var(--transition);
}

.tarif-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow), var(--shadow-glow);
}

.tarif-badge-country {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
}

.tarif-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.tarif-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-secondary);
  margin-bottom: 12px;
}

.tarif-price span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.tarif-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  flex: 1;
}

.tarif-meta {
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-bottom: 16px;
}

.promo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.promo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  transition: var(--transition);
}

.promo-card.inactive {
  opacity: 0.65;
}

.promo-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 8px;
}

.promo-type {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* =================== ANIMATIONS =================== */
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* =================== SPINNER =================== */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent-primary);
  display: inline-block;
  animation: spin 1s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  color: var(--text-secondary);
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* =================== DASHBOARD CARDS GRID =================== */
.dashboard-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* =================== SIDEBAR OVERLAY =================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* =================== RESPONSIVE =================== */

/* Tablet (1024px) */
@media (max-width: 1024px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .dashboard-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile (768px) */
@media (max-width: 768px) {

  /* ---- Sidebar ---- */
  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }

  .sidebar-overlay.active {
    pointer-events: auto;
  }

  .sidebar {
    transform: translateX(-280px);
    z-index: 200;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.6);
  }

  /* ---- Main Layout ---- */
  .main-content {
    margin-left: 0;
  }

  /* ---- Topbar ---- */
  .topbar {
    padding: 0 12px;
    height: 56px;
  }

  .topbar-title {
    font-size: 15px;
  }

  .topbar-actions {
    gap: 8px;
  }

  /* Shrink maintenance badge on mobile */
  .maintenance-badge {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 12px;
  }

  .maintenance-badge span:last-child {
    display: none; /* hide text label, keep dot only */
  }

  /* ---- Page Content ---- */
  .page-content {
    padding: 14px 12px;
  }

  /* ---- Page Header ---- */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .page-header p {
    font-size: 12px;
  }

  .page-header .topbar-actions,
  .page-header > *:last-child:not(div) {
    width: 100%;
  }

  /* ---- Stats Grid ---- */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    height: 100px;
    padding: 16px;
  }

  .stat-value {
    font-size: 20px;
  }

  /* ---- Cards ---- */
  .card {
    padding: 16px;
    margin-bottom: 14px;
    border-radius: 16px;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ---- Tables ---- */
  .hide-mobile {
    display: none !important;
  }

  th, td {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* ---- Filter Bar ---- */
  .filter-bar {
    gap: 6px;
  }

  .filter-chip {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* ---- Buttons ---- */
  .btn {
    font-size: 12px;
    padding: 9px 14px;
  }

  .btn-sm {
    padding: 5px 9px;
    font-size: 10px;
  }

  /* ---- Forms ---- */
  .form-control {
    font-size: 16px; /* Prevent iOS zoom on focus */
    padding: 12px 14px;
  }

  /* ---- Dashboard grid cards ---- */
  .dashboard-cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* ---- Tarif/promo grids ---- */
  .tarifs-grid {
    grid-template-columns: 1fr;
  }

  .promo-grid {
    grid-template-columns: 1fr;
  }

  /* ---- Pagination ---- */
  .pagination {
    flex-wrap: wrap;
    gap: 6px;
  }

  .page-info {
    width: 100%;
    text-align: center;
    margin-left: 0;
    margin-top: 4px;
  }

  /* ---- Modal ---- */
  .modal-overlay {
    align-items: flex-end; /* sheet style - slides from bottom */
  }

  .modal {
    width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 90vh;
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-body {
    padding: 16px 20px;
  }

  .modal-footer {
    padding: 12px 20px;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center;
  }
}

/* Small mobile (480px) */
@media (max-width: 480px) {

  /* ---- Login Card ---- */
  #login-page {
    padding: 16px;
    align-items: flex-start;
    padding-top: 60px;
  }

  .login-card {
    padding: 24px 20px;
    border-radius: 24px;
    max-width: 100%;
  }

  /* ---- Topbar ---- */
  #admin-login-badge {
    display: none; /* hide username text in topbar on tiny screens */
  }

  /* ---- Stats ---- */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    height: 90px;
    padding: 12px;
  }

  .stat-value {
    font-size: 18px;
  }

  .stat-label {
    font-size: 10px;
  }

  /* ---- Toast ---- */
  #toast-container {
    bottom: 12px;
    right: 8px;
    left: 8px;
    align-items: stretch;
  }

  .toast {
    min-width: unset;
    width: 100%;
    max-width: 100%;
    font-size: 12px;
    padding: 12px 14px;
  }

  /* ---- Table compact ---- */
  th, td {
    padding: 8px 10px;
    font-size: 11px;
  }
}
