/* ============================================================
   SUPRABHAT TECHNOLOGIES — ADMIN 2.0 DESIGN SYSTEM
   Modern, Creative, Responsive Admin Portal
   Light & Dark Theme with Instant Switching
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Space+Grotesk:wght@500;600;700;800&display=swap');

:root, [data-theme="light"] {
  --bg-darkest:          #f1f5f9;
  --bg-main:             #f8fafc;
  --bg-surface:          #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-card:             #ffffff;
  --bg-card-hover:       #f8fafc;
  --bg-glass:            rgba(255, 255, 255, 0.9);
  --bg-input:            #ffffff;

  --cyan:                #0284c7;
  --cyan-bright:         #0ea5e9;
  --blue:                #2563eb;
  --indigo:              #4f46e5;
  --neon-green:          #059669;
  --warn:                #d97706;
  --alert:               #dc2626;

  --text-bright:         #0f172a;
  --text-main:           #334155;
  --text-muted:          #64748b;
  --text-dim:            #94a3b8;

  --border-subtle:       rgba(226, 232, 240, 0.95);
  --border-medium:       rgba(14, 165, 233, 0.28);
  --border-active:       rgba(14, 165, 233, 0.65);

  --shadow-card:         0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-hover:        0 12px 28px -4px rgba(14, 165, 233, 0.14);
  --shadow-dropdown:     0 20px 35px -5px rgba(15, 23, 42, 0.15);

  --font-display:        'Space Grotesk', -apple-system, sans-serif;
  --font-body:           'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono:           'JetBrains Mono', monospace;
  --radius-sm:           8px;
  --radius-md:           12px;
  --radius-lg:           18px;
}

[data-theme="dark"] {
  --bg-darkest:          #030712;
  --bg-main:             #060c1c;
  --bg-surface:          #0a142c;
  --bg-surface-elevated: #0f1c3d;
  --bg-card:             rgba(10, 20, 44, 0.85);
  --bg-card-hover:       rgba(15, 28, 61, 0.95);
  --bg-glass:            rgba(8, 16, 36, 0.82);
  --bg-input:            #071026;

  --cyan:                #00d4ff;
  --cyan-bright:         #38bdf8;
  --blue:                #3b82f6;
  --indigo:              #6366f1;
  --neon-green:          #10b981;
  --warn:                #f59e0b;
  --alert:               #ef4444;

  --text-bright:         #ffffff;
  --text-main:           #f1f5f9;
  --text-muted:          #94a3b8;
  --text-dim:            #64748b;

  --border-subtle:       rgba(255, 255, 255, 0.09);
  --border-medium:       rgba(0, 212, 255, 0.25);
  --border-active:       rgba(0, 212, 255, 0.7);

  --shadow-card:         0 12px 36px -6px rgba(0, 0, 0, 0.6);
  --shadow-hover:        0 18px 45px -8px rgba(0, 212, 255, 0.2);
  --shadow-dropdown:     0 25px 50px -12px rgba(0, 0, 0, 0.75);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-bright);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ============================================================
   Admin Header Bar
   ============================================================ */
.admin-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.admin-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
}

.admin-logo-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.admin-logo-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--cyan);
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--cyan);
  background: rgba(14, 165, 233, 0.08);
}

.user-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-bright);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-menu-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-bright);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 18px;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   Admin Layout & Sidebar
   ============================================================ */
.admin-container {
  display: flex;
  min-height: calc(100vh - 64px);
}

.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 24px 0;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-menu {
  list-style: none;
  padding: 0 12px;
}

.sidebar-menu li {
  margin-bottom: 4px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.sidebar-menu a .menu-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-menu a:hover {
  color: var(--text-bright);
  background: rgba(14, 165, 233, 0.08);
}

.sidebar-menu a.active {
  color: var(--cyan);
  background: rgba(14, 165, 233, 0.12);
  font-weight: 700;
  border-left: 3px solid var(--cyan);
}

.menu-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--cyan);
  color: #ffffff;
}

.menu-badge.alert {
  background: var(--alert);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-dim);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  backdrop-filter: blur(2px);
}

/* ============================================================
   Main Content Area
   ============================================================ */
.admin-main {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
}

.page-header-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   Stats Grid Widgets
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-medium);
}

.stat-card-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-bright);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: rgba(14, 165, 233, 0.1);
  color: var(--cyan);
}

/* ============================================================
   Cards, Tables & Forms
   ============================================================ */
.admin-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-card-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

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

.admin-table th {
  background: var(--bg-darkest);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

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

.admin-table tr:hover {
  background: rgba(14, 165, 233, 0.04);
}

/* Badges */
.badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  display: inline-block;
  text-transform: uppercase;
}

.badge-new { background: rgba(14, 165, 233, 0.15); color: var(--cyan); border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-read { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); border: 1px solid rgba(100, 116, 139, 0.3); }
.badge-replied { background: rgba(5, 150, 105, 0.15); color: var(--neon-green); border: 1px solid rgba(5, 150, 105, 0.3); }
.badge-archived { background: rgba(148, 163, 184, 0.15); color: var(--text-dim); }

.badge-published, .badge-active { background: rgba(5, 150, 105, 0.15); color: var(--neon-green); border: 1px solid rgba(5, 150, 105, 0.3); }
.badge-draft, .badge-inactive { background: rgba(217, 119, 6, 0.15); color: var(--warn); border: 1px solid rgba(217, 119, 6, 0.3); }
.badge-admin { background: rgba(79, 70, 229, 0.15); color: var(--indigo); border: 1px solid rgba(79, 70, 229, 0.3); }
.badge-super_admin { background: rgba(14, 165, 233, 0.15); color: var(--cyan); border: 1px solid rgba(14, 165, 233, 0.3); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-bright) !important;
}
.btn-secondary:hover {
  background: rgba(14, 165, 233, 0.08);
  border-color: var(--cyan);
  color: var(--cyan) !important;
}

.btn-danger {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--alert) !important;
}
.btn-danger:hover {
  background: var(--alert);
  color: #ffffff !important;
}

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

.btn-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--alert);
}

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--text-bright);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Flash Messages */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 500;
}
.alert-success { background: rgba(5, 150, 105, 0.1); border: 1px solid rgba(5, 150, 105, 0.3); color: var(--neon-green); }
.alert-danger { background: rgba(220, 38, 38, 0.1); border: 1px solid rgba(220, 38, 38, 0.3); color: var(--alert); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  padding: 8px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-main);
  background: var(--bg-surface);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.pagination a:hover {
  background: rgba(14, 165, 233, 0.08);
  border-color: var(--cyan);
  color: var(--cyan);
}

.pagination .current {
  background: var(--cyan);
  color: #ffffff;
  border-color: var(--cyan);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow-dropdown);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: var(--alert);
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-darkest);
}

/* Login Page Styling */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
  padding: 20px;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 12px;
}

.login-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   Mobile Responsive Admin
   ============================================================ */
@media (max-width: 900px) {
  .admin-header {
    padding: 0 16px;
  }

  .admin-menu-toggle {
    display: flex;
  }

  .user-badge {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 270px;
    z-index: 999;
    transform: translateX(-100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay.mobile-open {
    display: block;
  }

  .admin-main {
    padding: 20px 16px;
  }

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

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }
}
