/* ============================================================
   NurulQuran — Admin Dashboard Styles
   Matches the main site's design system and dark theme.
   ============================================================ */

:root {
  --admin-bg: #050811;
  --admin-panel: rgba(15, 22, 40, 0.85);
  --admin-border: rgba(100, 255, 218, 0.15);
  --admin-text: #e2e8f0;
  --admin-muted: #94a3b8;
  --sidebar-width: 260px;
}

body {
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Base Form Elements */
input, textarea, select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.2);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--admin-text);
}

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

.hidden {
  display: none !important;
}

/* Glass Card Reusable */
.glass-card {
  background: var(--admin-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
}

/* ==== Login Screen ==== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.login-logo {
  max-width: 140px;
  height: auto;
  margin-bottom: 1.5rem;
  object-fit: contain;
}

.login-card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.login-card p {
  color: var(--admin-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.login-card .btn {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.8rem;
}

.error-msg {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.75rem;
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.9rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ==== Dashboard Layout ==== */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-radius: 0;
  border-left: none;
  border-top: none;
  border-bottom: none;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--admin-border);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #fff, var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-header img {
  border-radius: 50%;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--admin-muted);
  text-align: left;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: inherit;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.nav-btn.active {
  background: rgba(76, 110, 245, 0.15);
  color: var(--accent-teal);
  border-left: 3px solid var(--accent-teal);
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--admin-border);
  text-align: center;
}

.back-link {
  display: block;
  margin-top: 1rem;
  color: var(--admin-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.back-link:hover {
  color: #fff;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

/* Utility Bar */
.utility-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  border-radius: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.saved {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.status-badge.unsaved {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.utility-actions {
  display: flex;
  gap: 1rem;
}

/* Tabs */
.tab-content {
  flex: 1;
}

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

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

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

.pane-header h2 {
  margin: 0;
  font-size: 1.75rem;
}

.admin-section {
  margin-bottom: 2.5rem;
}

.section-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header-inline h3 {
  margin: 0;
  color: var(--accent-gold);
  font-size: 1.25rem;
}

.admin-section h3 {
  color: var(--accent-gold);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header-row h3 {
  margin-bottom: 0;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Item Lists & Cards */
.item-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.item-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 1.5rem;
  position: relative;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  border-color: rgba(100, 255, 218, 0.3);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.item-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
}

.item-subtitle {
  font-size: 0.85rem;
  color: var(--accent-teal);
  margin-top: 0.25rem;
  display: block;
}

.item-meta {
  font-size: 0.85rem;
  color: var(--admin-muted);
  margin-bottom: 1rem;
  flex: 1;
}

.item-desc {
  font-size: 0.9rem;
  color: var(--admin-text);
  margin-bottom: 1.5rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 1rem;
}

.action-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  color: var(--admin-text);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
  flex: 1;
}

.action-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.action-btn.delete {
  color: #ef4444;
}
.action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.modal-container {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.close-modal {
  background: transparent;
  border: none;
  color: var(--admin-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.3s;
}

.close-modal:hover {
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

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

/* Settings Form */
.settings-form {
  padding: 2rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--admin-panel);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  color: #fff;
  font-weight: 500;
  animation: slideInRight 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

.toast.hiding {
  animation: slideOutRight 0.3s ease forwards;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* Responsive */
@media (max-width: 768px) {
  .dashboard-container {
    flex-direction: column;
  }
  
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--admin-border);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .utility-bar {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    text-align: center;
  }
  
  .utility-actions {
    justify-content: center;
  }
}

/* ==== Admin Light Mode Theme Overrides ==== */
body.light-mode {
  --admin-bg: #f8fafc;
  --admin-panel: rgba(255, 255, 255, 0.9);
  --admin-border: rgba(76, 110, 245, 0.15);
  --admin-text: #0f172a;
  --admin-muted: #64748b;
}

body.light-mode input,
body.light-mode textarea,
body.light-mode select {
  background: #ffffff;
  color: #0f172a;
  border-color: #cbd5e1;
}

body.light-mode input:focus,
body.light-mode textarea:focus,
body.light-mode select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.15);
}

body.light-mode .item-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

body.light-mode .item-card:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

body.light-mode .item-title {
  color: #0f172a;
}

body.light-mode .item-desc {
  color: #334155;
}

body.light-mode .action-btn {
  background: #f1f5f9;
  color: #334155;
}

body.light-mode .action-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

body.light-mode .sidebar-header h3 {
  background: linear-gradient(135deg, #0f172a, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light-mode .nav-btn:hover {
  background: rgba(0, 0, 0, 0.03);
  color: #0f172a;
}

body.light-mode .nav-btn.active {
  background: rgba(76, 110, 245, 0.08);
}

body.light-mode .back-link:hover {
  color: #0f172a;
}

body.light-mode .close-modal:hover {
  color: #0f172a;
}

