/* ============================================
   LGAAS Shared Admin Design System
   Extracted from dashboard.html (gold standard)
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-hover: #818cf8;
  --secondary: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-hover: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: #334155;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

/* --- Reset & Base --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

a { color: inherit; text-decoration: none; }

/* --- Sidebar Navigation --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  background: linear-gradient(180deg, var(--bg-card) 0%, #162032 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}

.sidebar-brand svg {
  flex-shrink: 0;
}

.sidebar-section {
  padding: 1rem 0.75rem 0;
}

.sidebar-section-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-dim);
  padding: 0 0.6rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s;
  font-size: 0.875rem;
  font-weight: 450;
  margin-bottom: 2px;
  position: relative;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-link.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  font-weight: 500;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

/* AriaStar nav link — subtle by default, highlighted when open */
.nav-link.nav-ariastar {
  color: var(--text-muted);
  margin-top: 2px;
}

.nav-link.nav-ariastar:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  color: #c7d2fe;
}

.nav-link.nav-ariastar.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--primary-hover);
  font-weight: 500;
}

.nav-link-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-bottom {
  margin-top: auto;
  padding: 0.85rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.68rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 450;
  transition: all 0.2s;
  margin-top: 0.5rem;
  text-align: center;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* --- Main Content Area --- */
.main {
  margin-left: 220px;
  padding: 1.5rem 2rem;
}

/* --- Mobile Topbar & Responsive --- */
.mobile-topbar {
  display: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-topbar-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mobile-topbar-brand svg {
  flex-shrink: 0;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s;
    z-index: 200;
  }

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

  .sidebar-overlay.visible {
    display: block;
    z-index: 199;
  }

  .mobile-topbar {
    display: flex;
  }

  .nav-hamburger {
    display: block;
  }

  .main {
    margin-left: 0;
    padding: 1rem;
  }

  .page-header {
    margin-bottom: 1rem;
  }

  .page-title {
    font-size: 1.2rem;
  }

  .page-subtitle {
    font-size: 0.8rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .stat-card {
    padding: 0.85rem;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .stat-change {
    font-size: 0.7rem;
  }

  .card-header {
    padding: 0.75rem 1rem;
  }

  .card-title {
    font-size: 0.9rem;
  }

  .card-body {
    padding: 0.85rem;
  }

  .tabs {
    margin-bottom: 1rem;
  }

  .tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .alert-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
  }

  .alert-item-title {
    font-size: 0.8rem;
  }

  .alert-item-detail {
    font-size: 0.7rem;
  }
}

/* Extra small screens (iPhone SE, small phones) */
@media (max-width: 480px) {
  .main {
    padding: 0.75rem;
  }

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

  .stat-card {
    padding: 0.65rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .page-title {
    font-size: 1.1rem;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* --- Card Components --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

.card-action {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
  background: none;
  border: none;
}

.card-action:hover {
  text-decoration: underline;
}

.card-body {
  padding: 1.25rem;
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.2s;
}

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

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-change {
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.stat-change.positive { color: var(--secondary); }
.stat-change.negative { color: var(--danger); }

/* --- Button Styles --- */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-success {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* --- Modal Styles --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

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

/* --- Table Styles --- */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}

tr:hover td {
  background: var(--bg-hover);
}

/* --- Status Badges --- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-draft,
.status-draft {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.badge-pending,
.status-pending {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge-approved,
.status-approved {
  background: rgba(16, 185, 129, 0.2);
  color: var(--secondary);
}

.badge-published,
.status-published {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
}

.badge-rejected,
.status-rejected {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.badge-active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--secondary);
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: var(--info);
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
  max-width: 400px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: var(--secondary);
  color: var(--secondary);
}

.toast.error {
  border-color: var(--danger);
  color: var(--danger);
}

.toast.info {
  border-color: var(--info);
  color: var(--info);
}

/* --- Loading & Empty States --- */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* --- Alert Banners --- */
.alert-banner { margin-bottom: 1.5rem; }
.alert-banner:empty { display: none; }

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

.alert-item:hover { border-color: var(--primary); }
.alert-item.critical { border-left: 3px solid var(--danger); }
.alert-item.warning { border-left: 3px solid var(--warning); }
.alert-item.info { border-left: 3px solid var(--primary); }

.alert-item-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.alert-item-content { flex: 1; min-width: 0; }
.alert-item-title { font-size: 0.85rem; font-weight: 500; margin-bottom: 2px; }
.alert-item-detail { font-size: 0.75rem; color: var(--text-muted); }

/* --- Utility Classes --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--secondary); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }
.w-full { width: 100%; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
