/* ==========================================================================
   Kuuthi Admin Control Dashboard – Modern UI Design System
   ========================================================================== */

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

:root {
  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-light: #fff7ed;
  --primary-border: #fed7aa;
  
  --brand-blue: #2563eb;
  --brand-blue-light: #eff6ff;
  --brand-blue-border: #bfdbfe;

  --success: #10b981;
  --success-light: #f0fdf4;
  --success-border: #bbf7d0;

  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;

  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --sidebar-w: 260px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
.admin-sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
  text-decoration: none;
}

.sidebar-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 7px;
  border-radius: 6px;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  padding: 12px 10px 4px 10px;
}

.sidebar-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  text-decoration: none;
}

.sidebar-item-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.sidebar-item-btn.is-active {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(234, 88, 12, 0.25) 100%);
  color: #fb923c;
  border-color: rgba(249, 115, 22, 0.4);
}

.sidebar-item-icon {
  font-size: 1.15rem;
  width: 22px;
  display: inline-flex;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-item-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-role-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: capitalize;
}

.admin-role-tag.role-super_admin {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
}

.admin-role-tag.role-moderator_astrologer {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.logout-icon-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-icon-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.admin-main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top App Bar */
.admin-topbar {
  height: 68px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.mobile-toggle-btn {
  display: none;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.topbar-page-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

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

.topbar-pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary-hover);
  border: 1px solid var(--primary-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.topbar-pill-link:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Tab Panels Container */
.admin-page-content {
  padding: 28px;
  flex: 1;
}

.tab-panel {
  display: none;
  animation: tabFadeIn 0.25s ease;
}

.tab-panel.is-active {
  display: block;
}

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

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

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.stat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.stat-icon-wrap.orange { background: #fff7ed; color: #ea580c; border: 1px solid #fed7aa; }
.stat-icon-wrap.blue { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.stat-icon-wrap.green { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.stat-icon-wrap.purple { background: #faf5ff; color: #9333ea; border: 1px solid #e9d5ff; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

/* ==========================================================================
   Cards, Tables, and Content Panels
   ========================================================================== */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  margin-bottom: 28px;
  overflow: hidden;
}

.content-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.content-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-card-body {
  padding: 24px;
}

/* Filter & Search Bar */
.filter-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-light);
}

.admin-search-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 38px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.admin-search-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.admin-select {
  height: 42px;
  padding: 0 32px 0 12px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
  background: #f8fafc;
  cursor: pointer;
}

/* Action Buttons */
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Modern Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

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

.admin-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border-color);
}

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

.admin-table tbody tr:hover {
  background: #f8faff;
}

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

/* Badges & Status */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.status-active { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.status-expired { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.status-pending { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.status-pass { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }

/* ==========================================================================
   Notification Creator & Live HTML Preview Form
   ========================================================================== */
.notif-creator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-field-group {
  margin-bottom: 16px;
}

.form-field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.admin-input, .admin-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.admin-input:focus, .admin-textarea:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
}

.admin-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Live HTML Preview Card */
.html-preview-box {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 14px;
  padding: 18px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
}

.preview-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 10px;
}

/* Modal Popup Styles */
.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

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

.admin-modal-card {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.admin-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

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

.admin-modal-footer {
  padding: 14px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

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

  .admin-main-wrapper {
    margin-left: 0;
  }

  .mobile-toggle-btn {
    display: flex;
  }

  .notif-creator-grid {
    grid-template-columns: 1fr;
  }
}

/* Large Edit Modal & Complex Data Forms */
.admin-modal-card-lg {
  max-width: 860px;
}

.modal-tabs-header {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
  padding-bottom: 10px;
}

.modal-tab-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-tab-btn.is-active {
  background: #f1f5f9;
  color: #0f172a;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 680px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

.form-section-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 18px 0 10px 0;
  padding-bottom: 4px;
  border-bottom: 1.5px solid #f1f5f9;
}

.raw-json-editor {
  width: 100%;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  background: #0f172a;
  color: #38bdf8;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #1e293b;
  resize: vertical;
  min-height: 300px;
  outline: none;
}

.raw-json-editor:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

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

.btn-icon-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

/* Badge for Records Registered within 5 Days */
.badge-new {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
  animation: pulseNew 2s infinite ease-in-out;
}

@keyframes pulseNew {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.04); }
}

/* Records Explorer Filter Toolbar */
.records-filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.date-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-filter-input {
  padding: 7px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: #ffffff;
  color: #1e293b;
  outline: none;
}

.date-filter-input:focus {
  border-color: var(--brand-blue);
}

.quick-filter-pill {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-filter-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.quick-filter-pill.is-active {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Mini Statistics Grid for Records Explorer */
.mini-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.mini-stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.mini-stat-icon.total { background: #eff6ff; color: #2563eb; }
.mini-stat-icon.paid { background: #f0fdf4; color: #16a34a; }
.mini-stat-icon.unpaid { background: #fef2f2; color: #dc2626; }
.mini-stat-icon.new { background: #fff7ed; color: #ea580c; }

.mini-stat-info {
  display: flex;
  flex-direction: column;
}

.mini-stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mini-stat-value {
  font-size: 1.25rem;
  font-weight: 900;
  color: #0f172a;
}


