/* ==========================================================================
   Campus Portal - Host Management CMS Stylesheet
   Dedicated Live Editing Studio
   ========================================================================== */

:root {
  --admin-primary: #064e3b;
  --admin-dark: #0f172a;
  --admin-sidebar: #1e293b;
  --admin-gold: #d4af37;
  --admin-bg: #f8fafc;
  --admin-card: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text: #334155;
  --admin-title: #0f172a;
  --admin-danger: #ef4444;
  --admin-success: #10b981;
}

body.admin-body {
  background-color: var(--admin-bg);
  color: var(--admin-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Authentication Gate Overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  background: var(--admin-card);
  width: 100%;
  max-width: 420px;
  border-radius: 14px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-align: center;
  border-top: 5px solid var(--admin-gold);
}

.auth-icon {
  width: 56px;
  height: 56px;
  background: #fef3c7;
  color: #b45309;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem auto;
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--admin-title);
  margin-bottom: 0.5rem;
}

.auth-hint {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 1.75rem;
}

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

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

.admin-badge {
  background: #fef9c3;
  color: #854d0e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Main Layout */
.admin-layout {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar);
  color: #cbd5e1;
  padding: 1.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.nav-category-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
  font-weight: 700;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: #cbd5e1;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.admin-nav-item.active {
  background: var(--admin-primary);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(6, 78, 59, 0.4);
}

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

.nav-counter {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
}

/* Content Area */
.admin-content {
  flex: 1;
  padding: 2rem;
  max-width: 1100px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-pane.active {
  display: block;
}

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

.pane-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--admin-title);
  margin-bottom: 0.25rem;
}

.pane-desc {
  color: #64748b;
  font-size: 0.95rem;
}

/* Card Sections */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.admin-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-title);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Grid Forms */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.4rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.925rem;
  color: #1e293b;
  transition: all 0.15s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(6, 78, 59, 0.12);
}

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

/* Items List Tables / Cards */
.item-table {
  width: 100%;
  border-collapse: collapse;
}

.item-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid var(--admin-border);
}

.item-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.9rem;
}

.table-row:hover {
  background: #f8fafc;
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-icon-danger:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* Dashboard Summary Cards */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.metric-card-label {
  font-size: 0.825rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.metric-card-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--admin-title);
}

/* Modal for Add / Edit in Admin */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-modal-backdrop.open {
  display: flex;
}

.admin-modal-card {
  background: var(--admin-card);
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--admin-border);
}

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

.admin-modal-body {
  padding: 1.5rem;
}

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

@media (max-width: 900px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
  }
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}
