/* ============================================
   Admin Panel CSS — SEO Contract Generator
   ============================================ */

:root {
  --sidebar-w: 240px;
  --topbar-h: 60px;
}

/* ---- Admin Layout ---- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--ink);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform 180ms ease;
}
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: white;
  flex-shrink: 0;
}
.sidebar-brand-text { font-size: 14px; font-weight: 600; color: white; line-height: 1.3; }
.sidebar-brand-sub { font-size: 10px; color: rgba(255,255,255,0.4); }

.sidebar-nav { padding: 1rem 0; flex: 1; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  padding: 0.75rem 1.25rem 0.25rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 1.25rem;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 450;
  transition: all 150ms;
  border-radius: 0;
  position: relative;
}
.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active {
  color: white;
  background: rgba(67,97,238,0.25);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge-count {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}
.sidebar-username { font-size: 13px; color: white; font-weight: 500; }
.sidebar-role { font-size: 10px; color: rgba(255,255,255,0.4); }
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: rgba(220,38,38,0.15);
  color: #fca5a5;
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 150ms;
  font-family: var(--font);
}
.btn-logout:hover { background: rgba(220,38,38,0.25); color: #fecaca; }

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

/* Topbar */
.admin-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--ink-3);
  padding: 4px;
}

/* Content Area */
.admin-content {
  padding: 1.75rem;
  flex: 1;
}

/* ---- Stats Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--accent-light); }
.stat-icon.green { background: var(--success-bg); }
.stat-icon.amber { background: #fffbeb; }
.stat-icon.purple { background: #f3f0ff; }
.stat-number { font-size: 1.75rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--ink-3); margin-top: 4px; }
.stat-change { font-size: 0.75rem; margin-top: 4px; }
.stat-change.up { color: var(--success); }

/* ---- Tables ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  font-size: 0.88rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.td-primary { font-weight: 500; color: var(--ink); }
.td-mono { font-family: var(--font-mono); font-size: 0.82rem; }
.td-actions { display: flex; gap: 6px; align-items: center; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.badge-warning { background: var(--warning-bg); color: #92400e; border: 1px solid #fde68a; }
.badge-danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.badge-info { background: var(--accent-light); color: #1e40af; border: 1px solid var(--accent-light-2); }
.badge-gray { background: var(--surface-3); color: var(--ink-3); border: 1px solid var(--border); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,17,23,0.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 200ms;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 200ms;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-3);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--ink-3);
  transition: all 150ms;
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ---- Search & Filter Bar ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; }
.search-box {
  position: relative;
}
.search-box input {
  padding: 9px 13px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.87rem;
  color: var(--ink);
  background: var(--surface);
  width: 260px;
  outline: none;
  transition: border-color var(--transition);
}
.search-box input:focus { border-color: var(--accent); }
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-4);
  font-size: 14px;
  pointer-events: none;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--ink-3);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.empty-state-text { font-size: 0.85rem; }

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1117 0%, #1a1f35 100%);
  padding: 1.5rem;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo-icon {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
}
.login-title { font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.login-subtitle { font-size: 0.85rem; color: var(--ink-3); margin-top: 4px; }

/* Responsive Admin */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .mobile-menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 1rem; }
}
