/* ================================================
   Springfield Academy — Admin Panel Stylesheet
   ================================================ */

.admin-body { background: #f1f5f9; font-family: 'Inter', sans-serif; }

/* ── Login ── */
.login-modal {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0f2447 0%, #1a3461 50%, #1e3a8a 100%);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-modal::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-box {
  background: var(--white); padding: 48px 40px; border-radius: 20px;
  width: 100%; max-width: 420px; box-shadow: 0 32px 64px rgba(0,0,0,0.3);
  position: relative; z-index: 1;
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 52px; height: 52px; background: linear-gradient(135deg, var(--blue), var(--navy));
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
}
.login-logo-icon i { font-size: 1.5rem; color: white; }
.login-logo-text strong { font-family: 'Playfair Display', serif; font-size: 1.25rem; color: var(--navy); display: block; }
.login-logo-text span { font-size: 0.75rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.06em; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.login-header p { color: var(--gray-500); font-size: 0.9rem; }
.login-error { color: var(--danger); font-size: 0.875rem; margin-bottom: 14px; text-align: center; background: #fef2f2; padding: 10px; border-radius: var(--radius-sm); }
.login-hint { text-align: center; color: var(--gray-400); font-size: 0.8rem; margin-top: 16px; padding: 10px; background: var(--gray-50); border-radius: var(--radius-sm); }

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

/* ── Sidebar ── */
.admin-sidebar {
  width: 268px; background: var(--navy); color: var(--white);
  display: flex; flex-direction: column; position: fixed; height: 100vh;
  z-index: 100; overflow-y: auto;
}
.sidebar-header {
  padding: 24px 20px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header-icon { width: 36px; height: 36px; background: rgba(255,255,255,0.1); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.sidebar-header-icon i { color: #fcd34d; font-size: 1.125rem; }
.sidebar-header-text strong { display: block; font-size: 0.9375rem; font-weight: 700; }
.sidebar-header-text span { font-size: 0.7rem; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.06em; }
.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-section-label { padding: 8px 20px; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.3); margin-top: 8px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 20px;
  color: rgba(255,255,255,0.6); transition: var(--transition); position: relative;
  font-size: 0.9rem; font-weight: 500; margin: 2px 8px; border-radius: 8px;
}
.sidebar-nav a:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.sidebar-nav a.active { color: var(--white); background: rgba(37,99,235,0.5); }
.sidebar-nav a.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #60a5fa; border-radius: 0 2px 2px 0; }
.sidebar-nav i { width: 18px; text-align: center; font-size: 0.9375rem; }
.badge { margin-left: auto; background: var(--danger); color: var(--white); padding: 2px 7px; border-radius: 8px; font-size: 0.7rem; font-weight: 700; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 8px; }

/* ── Admin Main ── */
.admin-main { flex: 1; margin-left: 268px; }
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 32px; background: var(--white); border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm);
}
.admin-header h1 { font-size: 1.375rem; font-weight: 700; color: var(--navy); }
.admin-breadcrumb { font-size: 0.8125rem; color: var(--gray-400); margin-top: 2px; }
.admin-user { display: flex; align-items: center; gap: 12px; }
.admin-user-avatar {
  width: 38px; height: 38px; background: linear-gradient(135deg, var(--blue), var(--navy));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.admin-user-avatar i { color: var(--white); font-size: 1rem; }
.admin-user-info { display: flex; flex-direction: column; }
.admin-user-info strong { font-size: 0.875rem; color: var(--navy); font-weight: 600; }
.admin-user-info span { font-size: 0.75rem; color: var(--gray-400); }

/* ── Admin Content ── */
.admin-content { padding: 32px; }
.admin-section { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--white); padding: 24px; border-radius: var(--radius-lg);
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-200); transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon { width: 52px; height: 52px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.375rem; flex-shrink: 0; }
.stat-card:nth-child(1) .stat-icon { background: var(--blue-pale); color: var(--blue); }
.stat-card:nth-child(2) .stat-icon { background: #dcfce7; color: #16a34a; }
.stat-card:nth-child(3) .stat-icon { background: var(--gold-light); color: #d97706; }
.stat-card:nth-child(4) .stat-icon { background: #fce7f3; color: #db2777; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.875rem; font-weight: 800; color: var(--navy); font-family: 'Playfair Display', serif; line-height: 1; }
.stat-label { font-size: 0.8125rem; color: var(--gray-500); margin-top: 4px; font-weight: 500; }
.stat-change { font-size: 0.75rem; color: var(--success); margin-top: 2px; }

/* ── Dashboard Grid ── */
.dashboard-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }
.dashboard-card { background: var(--white); padding: 24px; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--gray-200); }
.dashboard-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.dashboard-card-header h3 { font-size: 1rem; font-weight: 700; color: var(--navy); }
.recent-list { display: flex; flex-direction: column; gap: 12px; }
.recent-item {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  background: var(--gray-50); border-radius: var(--radius-md); transition: var(--transition);
}
.recent-item:hover { background: var(--blue-pale); }
.recent-item-icon { width: 38px; height: 38px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; background: var(--blue); color: var(--white); font-size: 0.9375rem; flex-shrink: 0; }
.recent-item-content { flex: 1; min-width: 0; }
.recent-item-content h4 { font-size: 0.875rem; color: var(--navy); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.recent-item-content p { font-size: 0.75rem; color: var(--gray-400); }
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 12px; background: var(--gray-50); border: 2px solid transparent;
  border-radius: var(--radius-md); cursor: pointer; transition: var(--transition); font-family: inherit;
}
.action-btn:hover { border-color: var(--blue); background: var(--blue-pale); transform: translateY(-2px); }
.action-btn i { font-size: 1.375rem; color: var(--blue); }
.action-btn span { font-size: 0.8125rem; font-weight: 600; color: var(--gray-700); }

/* ── Section Toolbar ── */
.section-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 14px; flex-wrap: wrap; }
.section-toolbar input {
  padding: 10px 16px; border: 2px solid var(--gray-200); border-radius: var(--radius);
  font-size: 0.9rem; font-family: inherit; width: 280px; transition: var(--transition); background: var(--white);
}
.section-toolbar input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* ── Data Table ── */
.data-table-container { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--gray-200); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--gray-100); }
.data-table th { background: var(--gray-50); font-weight: 700; color: var(--gray-600); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table td { color: var(--gray-600); font-size: 0.9rem; }
.table-actions { display: flex; gap: 6px; }
.table-actions button { width: 32px; height: 32px; border: none; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); font-size: 0.875rem; }
.table-actions .btn-edit { background: var(--blue-pale); color: var(--blue); }
.table-actions .btn-edit:hover { background: var(--blue); color: var(--white); }
.table-actions .btn-delete { background: #fef2f2; color: var(--danger); }
.table-actions .btn-delete:hover { background: var(--danger); color: var(--white); }

/* ── Cards Grid ── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.admin-card { background: var(--white); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); transition: var(--transition); }
.admin-card:hover { box-shadow: var(--shadow-md); border-color: var(--blue); }
.admin-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.admin-card-title { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.admin-card-subtitle { font-size: 0.8125rem; color: var(--gray-500); }
.admin-card-actions { display: flex; gap: 6px; }
.admin-card-actions button { width: 30px; height: 30px; border: none; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); font-size: 0.8125rem; }
.admin-card-actions .btn-edit { background: var(--blue-pale); color: var(--blue); }
.admin-card-actions .btn-edit:hover { background: var(--blue); color: var(--white); }
.admin-card-actions .btn-delete { background: #fef2f2; color: var(--danger); }
.admin-card-actions .btn-delete:hover { background: var(--danger); color: var(--white); }

/* ── Badges ── */
.priority-badge { padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.priority-badge.high   { background: #fef2f2; color: var(--danger); }
.priority-badge.medium { background: var(--gold-light); color: #d97706; }
.priority-badge.low    { background: #f0fdf4; color: #16a34a; }
.category-badge { padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.category-badge.general     { background: var(--gray-100); color: var(--gray-600); }
.category-badge.academic    { background: var(--blue-pale); color: var(--blue); }
.category-badge.examination { background: #f5f3ff; color: #7c3aed; }
.category-badge.event       { background: #f0fdf4; color: #16a34a; }
.category-badge.holiday     { background: var(--gold-light); color: #d97706; }
.category-badge.urgent      { background: #fef2f2; color: var(--danger); }
.grade-badge { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; font-size: 0.875rem; font-weight: 800; }
.grade-badge.a-plus { background: #f0fdf4; color: #15803d; }
.grade-badge.a      { background: #dcfce7; color: #16a34a; }
.grade-badge.b-plus { background: var(--blue-pale); color: var(--blue); }
.grade-badge.b      { background: #dbeafe; color: #3b82f6; }
.grade-badge.c      { background: var(--gold-light); color: #d97706; }
.grade-badge.d      { background: #ffedd5; color: #ea580c; }
.grade-badge.f      { background: #fef2f2; color: var(--danger); }

/* ── Messages ── */
.messages-container { display: flex; flex-direction: column; gap: 16px; }
.message-card { background: var(--white); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); border-left: 4px solid var(--blue); }
.message-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.message-sender { font-weight: 700; color: var(--navy); }
.message-email { color: var(--gray-400); font-size: 0.875rem; }
.message-date { font-size: 0.8125rem; color: var(--gray-400); }
.message-subject { font-size: 0.9375rem; color: var(--blue); font-weight: 600; margin-bottom: 10px; }
.message-content { color: var(--gray-600); line-height: 1.65; font-size: 0.9375rem; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 24px; }
.settings-card { background: var(--white); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); }
.settings-card h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 24px; color: var(--navy); padding-bottom: 16px; border-bottom: 2px solid var(--gray-100); }

/* ── Modal ── */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 2000; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal.active { display: flex; animation: fadeIn 0.2s ease; }
.modal-content { background: var(--white); border-radius: var(--radius-xl); width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); }
.modal-content.modal-small { max-width: 420px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 28px; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-size: 1.1875rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.375rem; color: var(--gray-400); cursor: pointer; transition: var(--transition); width: 32px; height: 32px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }
.modal form { padding: 24px 28px; }
.modal-body { padding: 24px 28px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.delete-confirm-body { padding: 24px 28px; }
.delete-confirm-body p { color: var(--gray-600); margin-bottom: 24px; }

/* ── Responsive Admin ── */
@media (max-width: 1100px) {
  .admin-sidebar { width: 68px; }
  .sidebar-header-text, .sidebar-nav span, .badge, .sidebar-footer span { display: none; }
  .sidebar-header { justify-content: center; padding: 20px 12px; }
  .sidebar-nav a { justify-content: center; padding: 12px; margin: 2px 4px; }
  .sidebar-section-label { display: none; }
  .sidebar-footer { align-items: center; }
  .admin-main { margin-left: 68px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-sidebar { width: 100%; height: auto; position: relative; }
  .admin-dashboard { flex-direction: column; }
  .admin-main { margin-left: 0; }
  .sidebar-nav ul { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 8px; }
  .sidebar-footer { flex-direction: row; justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .section-toolbar { flex-direction: column; align-items: stretch; }
  .section-toolbar input { width: 100%; }
  .data-table-container { overflow-x: auto; }
  .data-table { min-width: 600px; }
  .settings-grid { grid-template-columns: 1fr; }
  .admin-content { padding: 20px 16px; }
}
/* ── Admin Pagination ── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 0 4px;
  border-top: 1px solid var(--gray-200);
  margin-top: 4px;
}
.pag-info { font-size: 0.82rem; color: var(--gray-500); }
.pag-controls { display: flex; align-items: center; gap: 4px; }
.pag-btn {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  font-size: 0.82rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.pag-btn:hover:not(:disabled) { background: var(--blue-pale); border-color: var(--blue); color: var(--blue); }
.pag-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.pag-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pag-ellipsis { color: var(--gray-400); padding: 0 2px; font-size: 0.82rem; }

/* ── Photo Upload ── */
.photo-upload-group {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.photo-upload-group input[type="file"] { display: none; }
.photo-upload-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--blue-pale);
  color: var(--blue);
  border: 1px dashed var(--blue);
  border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.photo-upload-label:hover { background: var(--blue); color: #fff; }
.photo-upload-name { font-size: 0.8rem; color: var(--gray-500); }

/* ── Login error (visible by default, empty = no height) ── */
.login-error:empty { display: none; }

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
  .login-box { padding: 36px 24px; }
}
