/**
 * NAIRA MATH - Admin Dashboard Stylesheet
 * Modern Emerald & Slate UI with Glassmorphism and Micro-interactions
 */

:root {
  --admin-primary: #008751;
  --admin-primary-dark: #006b40;
  --admin-primary-light: #e6f4ea;
  --admin-sidebar-bg: #0f172a;
  --admin-sidebar-text: #94a3b8;
  --admin-sidebar-hover: #1e293b;
  --admin-bg: #f8fafc;
  --admin-card-bg: #ffffff;
  --admin-text-main: #1e293b;
  --admin-text-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-info: #0284c7;
  --admin-radius: 12px;
  --admin-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --admin-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --admin-font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--admin-font);
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--admin-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--admin-primary-dark);
}

/* =========================================================
   LOGIN SCREEN
   ========================================================= */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 10% 20%, rgba(0, 135, 81, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 90% 80%, rgba(15, 23, 42, 0.05) 0%, transparent 40%),
              #f8fafc;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  box-shadow: var(--admin-shadow-lg);
  padding: 40px;
  animation: fadeIn 0.4s ease-out;
}

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

.login-logo .brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.login-logo .brand-badge span {
  color: var(--admin-primary);
}

.login-logo p {
  color: var(--admin-text-muted);
  font-size: 14px;
  margin-top: 6px;
}

/* =========================================================
   LAYOUT WRAPPER (SIDEBAR + MAIN)
   ========================================================= */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.admin-sidebar {
  width: 260px;
  background-color: var(--admin-sidebar-bg);
  color: var(--admin-sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 50;
  transition: transform 0.3s ease;
}

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

.sidebar-brand {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand .highlight {
  color: #10b981;
}

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

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 10px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--admin-sidebar-text);
  border-radius: 8px;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
}

.nav-item:hover {
  background-color: var(--admin-sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background-color: var(--admin-primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 135, 81, 0.3);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #ffffff;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--admin-primary), #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  font-size: 14px;
}

/* MAIN CONTENT */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* TOPBAR */
.admin-topbar {
  height: 68px;
  background: var(--admin-card-bg);
  border-bottom: 1px solid var(--admin-border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--admin-text-main);
}

.page-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--admin-text-main);
}

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

/* PAGE WRAPPER */
.admin-content {
  padding: 32px;
  flex: 1;
}

/* =========================================================
   COMPONENTS: STAT CARDS
   ========================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 22px;
  box-shadow: var(--admin-shadow);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--admin-shadow-lg);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.green {
  background-color: var(--admin-primary-light);
  color: var(--admin-primary);
}

.stat-icon.blue {
  background-color: #e0f2fe;
  color: #0284c7;
}

.stat-icon.amber {
  background-color: #fef3c7;
  color: #d97706;
}

.stat-icon.purple {
  background-color: #f3e8ff;
  color: #7e22ce;
}

.stat-info h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.stat-info .stat-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--admin-text-main);
  line-height: 1.1;
}

.stat-info .stat-desc {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 6px;
}

/* =========================================================
   COMPONENTS: CARDS & TABLES
   ========================================================= */
.card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--admin-text-main);
}

.card-body {
  padding: 24px;
}

.table-responsive {
  overflow-x: auto;
}

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

.admin-table th {
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--admin-text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--admin-border);
}

.admin-table td {
  padding: 16px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

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

.admin-table tr:hover td {
  background-color: #fbfcfe;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-success {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-primary {
  background-color: #e6f4ea;
  color: #008751;
}

.badge-info {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-secondary {
  background-color: #f1f5f9;
  color: #475569;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}

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

.btn-primary {
  background-color: var(--admin-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--admin-primary-dark);
  color: #ffffff;
}

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

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

.btn-danger {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-danger:hover {
  background-color: #fecaca;
  color: #991b1b;
}

.btn-outline {
  background-color: transparent;
  color: var(--admin-text-main);
  border-color: var(--admin-border);
}

.btn-outline:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

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

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

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

.form-control {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  background-color: #ffffff;
  color: var(--admin-text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(0, 135, 81, 0.15);
}

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

.form-help {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* ALERTS */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background-color: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}

/* QUICK TOOLBAR FOR POST EDITOR */
.editor-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  background: #f1f5f9;
  border: 1px solid var(--admin-border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.editor-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

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

.post-editor-area {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
  min-height: 380px;
}

/* RESPONSIVENESS */
@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed;
    left: -260px;
  }
  .admin-sidebar.open {
    transform: translateX(260px);
  }
  .mobile-toggle {
    display: inline-block;
  }
  .admin-content {
    padding: 20px;
  }
  .admin-topbar {
    padding: 0 20px;
  }
}
