:root {
  --admin-font: 'Inter', system-ui, -apple-system, sans-serif;
  --bg: #f4f5f8;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary: #1e3a8a;
  --primary-hover: #172554;
  --accent: #c25e2e;
  --accent-light: rgba(194, 94, 46, 0.08);
  --success: #10b981;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: var(--admin-font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

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

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

.admin-brand img {
  height: 36px;
  width: auto;
}

.admin-brand span {
  color: var(--accent);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

.btn-accent { background: var(--accent); color: #ffffff; }
.btn-accent:hover { background: #a84b20; }

.btn-secondary { background: #ffffff; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #dc2626; }

.btn-danger-outline { background: #ffffff; border-color: var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-light); }

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }

/* Container */
.admin-container {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
}

/* Stats Row */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-color: var(--accent); }

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

/* Sections Tree */
.section-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.section-panel-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-panel-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.section-panel-icon svg { width: 26px; height: 26px; }

.section-panel-info h3 {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge {
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 500;
}

.badge-accent { background: var(--accent-light); color: var(--accent); }

.section-panel-info p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.subsections-list {
  padding: 0.5rem 1.25rem 1rem 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #ffffff;
}

.subsection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.subsection-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.subsection-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.subsection-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.subsection-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Upload Area */
.upload-box {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 2rem;
}

.upload-box:hover, .upload-box.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-icon {
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.upload-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.upload-hint {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.upload-progress {
  margin-top: 1rem;
  height: 6px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  display: none;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* Media Gallery in Admin */
.admin-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.admin-photo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow);
}

.admin-photo-card.is-cover {
  border: 2px solid var(--accent);
}

.admin-photo-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.cover-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.admin-photo-details {
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.admin-photo-input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
}
.admin-photo-input:focus { border-color: var(--accent); }

.admin-photo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  background: #ffffff;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

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

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

.admin-modal.active { display: flex; }

.admin-modal-card {
  background: var(--card);
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

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

.admin-modal-body {
  padding: 1.25rem;
  max-height: 75vh;
  overflow-y: auto;
}

.admin-modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
}

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

.toast {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  background: #1e293b;
  color: #ffffff;
  font-size: 0.88rem;
  box-shadow: var(--shadow-md);
  animation: slideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Login Page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo {
  height: 50px;
  width: auto;
  margin-bottom: 1.25rem;
}

.login-card h1 {
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
}

.login-card p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}
