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

:root {
  --admin-navy: #00264D;
  --admin-navy-dark: #001A36;
  --admin-navy-light: #0D3B66;
  --admin-accent: #FD5E0D;
  --admin-accent-hover: #E04E05;
  --admin-accent-light: #FFF0E8;
  --admin-bg: #F4F6F9;
  --admin-card-bg: #FFFFFF;
  --admin-border: #E2E8F0;
  --admin-text-main: #0F172A;
  --admin-text-muted: #64748B;
  --admin-success: #10B981;
  --admin-warning: #F59E0B;
  --admin-danger: #EF4444;
  --admin-sidebar-width: 260px;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--admin-text-main);
  background-color: var(--admin-bg);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Montserrat', 'Plus Jakarta Sans', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ==============================================================================
   1. PASSCODE GATE SCREEN
   ============================================================================== */
.auth-gate {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #00264D 0%, #001226 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
}

.auth-box {
  background: #FFFFFF;
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 36px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.4);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-logo {
  height: 38px;
  margin: 0 auto 20px;
}

/* ==============================================================================
   2. APP LAYOUT & SIDEBAR
   ============================================================================== */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--admin-sidebar-width);
  background-color: var(--admin-navy-dark);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.25s ease;
}

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

.sidebar-header img {
  height: 30px;
}

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

.nav-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #94A3B8;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #CBD5E1;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
  margin-bottom: 3px;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--admin-accent);
  color: #FFFFFF;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(253, 94, 13, 0.35);
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==============================================================================
   3. MAIN CONTENT AREA
   ============================================================================== */
.main-wrapper {
  margin-left: var(--admin-sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-navbar {
  height: 64px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.top-navbar-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--admin-navy);
}

.top-navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-body {
  padding: 32px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}

/* ==============================================================================
   4. BUTTONS & UI COMPONENTS
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.btn-accent {
  background: var(--admin-accent);
  color: #FFFFFF;
}
.btn-accent:hover {
  background: var(--admin-accent-hover);
  transform: translateY(-1px);
}

.btn-navy {
  background: var(--admin-navy);
  color: #FFFFFF;
}
.btn-navy:hover {
  background: var(--admin-navy-light);
}

.btn-secondary {
  background: #FFFFFF;
  color: #334155;
  border-color: #CBD5E1;
}
.btn-secondary:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
}

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FECACA;
}
.btn-danger:hover {
  background: #FCA5A5;
  color: #991B1B;
}

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

.btn-ai {
  background: linear-gradient(135deg, #00264D 0%, #004D99 100%);
  color: #FFFFFF;
  border: 1px solid rgba(253, 94, 13, 0.4);
  box-shadow: 0 2px 8px rgba(0, 38, 77, 0.2);
}
.btn-ai:hover {
  border-color: var(--admin-accent);
  transform: translateY(-1px);
}

/* ==============================================================================
   5. DASHBOARD STATS CARDS
   ============================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

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

.stat-val {
  font-size: 26px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: var(--admin-navy);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ==============================================================================
   6. POST EDITOR & SEO SUITE
   ============================================================================== */
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.editor-main {
  background: #FFFFFF;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.post-title-input {
  width: 100%;
  font-size: 26px;
  font-weight: 800;
  font-family: 'Montserrat', sans-serif;
  color: var(--admin-navy);
  border: none;
  border-bottom: 2px solid #E2E8F0;
  padding: 10px 0;
  margin-bottom: 20px;
  outline: none;
}
.post-title-input:focus {
  border-color: var(--admin-accent);
}

.permalink-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--admin-text-muted);
  background: #F8FAFC;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  margin-bottom: 20px;
  font-family: 'JetBrains Mono', monospace;
}

.permalink-bar input {
  border: none;
  background: transparent;
  outline: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--admin-navy);
  font-weight: 600;
  flex: 1;
}

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 8px 8px 0 0;
}

.tool-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  transition: all 0.1s ease;
}
.tool-btn:hover {
  background: #E2E8F0;
  color: var(--admin-navy);
}

.content-textarea {
  width: 100%;
  min-height: 480px;
  padding: 20px;
  border: 1px solid #E2E8F0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  font-size: 15px;
  line-height: 1.7;
  color: #1E293B;
  outline: none;
  resize: vertical;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.content-textarea:focus {
  border-color: var(--admin-accent);
}

/* Editor Sidebar (Publish & SEO widgets) */
.editor-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-box {
  background: #FFFFFF;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.panel-header {
  padding: 14px 18px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--admin-border);
  font-size: 13px;
  font-weight: 800;
  color: var(--admin-navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-body {
  padding: 18px;
}

/* SEO Score Gauge */
.seo-score-widget {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #E2E8F0;
  margin-bottom: 16px;
}

.score-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  color: #FFFFFF;
}

.seo-check-item {
  display: flex;
  align-items: start;
  gap: 10px;
  font-size: 12px;
  padding: 6px 0;
  color: #334155;
}

.check-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #FFFFFF;
  shrink: 0;
  margin-top: 2px;
}
.check-icon.pass { background: var(--admin-success); }
.check-icon.fail { background: var(--admin-danger); }

/* SERP Preview Simulator */
.serp-preview {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
}
.serp-url {
  font-size: 11px;
  color: #202124;
  margin-bottom: 3px;
  font-family: 'JetBrains Mono', monospace;
}
.serp-title {
  font-size: 16px;
  color: #1a0dab;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
  text-decoration: underline;
}
.serp-desc {
  font-size: 12px;
  color: #4d5156;
  line-height: 1.5;
}

/* ==============================================================================
   7. POSTS TABLE
   ============================================================================== */
.table-container {
  background: #FFFFFF;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

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

.admin-table th {
  background: #F8FAFC;
  padding: 14px 18px;
  font-weight: 800;
  color: var(--admin-navy);
  border-bottom: 1px solid var(--admin-border);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #F1F5F9;
  color: #334155;
  vertical-align: middle;
}

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

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill.published { background: #ECFDF5; color: #059669; }
.status-pill.draft { background: #F1F5F9; color: #64748B; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--admin-navy);
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  border-left: 4px solid var(--admin-accent);
  animation: slide-in 0.2s ease;
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
