/* ============================================================
   SCHOOL ADMIN DASHBOARD CSS
   ============================================================ */

/* --- School Admin Dashboard Base Styles --- */

/* Desktop: lock the page height so only the workspace scrolls (Stitch pattern) */
@media (min-width: 993px) {
  body.school-admin-body {
    overflow: hidden;
    height: 100vh;
  }
}

.dashboard-layout {
  display: flex;
  height: 100vh;           /* exact viewport height — no browser scrollbar */
  background-color: var(--light-bg);
  color: var(--text-main);
  overflow: hidden;
}

.dashboard-sidebar {
  width: 260px;
  min-width: 260px;
  background-color: var(--white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
}

.sidebar-profile-box {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.sidebar-profile-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 800;
}

.sidebar-profile-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--white);
}

.sidebar-profile-role {
  font-size: 0.7rem;
  color: #64748B;
}

.sidebar-menu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-menu-btn {
  width: 100%;
  background: transparent;
  border: none;
  text-align: left;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: #94A3B8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: var(--transition-fast);
}

.sidebar-menu-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

.sidebar-menu-btn.active {
  background-color: var(--primary);
  color: var(--white);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 20px;
}

.dashboard-logo-section {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-logo-section .logo {
  font-size: 1.3rem;
}

.dashboard-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  flex: 1;
}

.dashboard-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  user-select: none;
}

.dashboard-nav-link .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.dashboard-nav-link .icon svg {
  width: 18px;
  height: 18px;
}

.dashboard-nav-link:hover {
  background-color: var(--light-bg);
  color: var(--primary);
}

.dashboard-nav-link.active {
  background: linear-gradient(135deg, rgba(0, 102, 200, 0.08), rgba(0, 163, 255, 0.06));
  color: var(--primary);
  font-weight: 700;
}

.dashboard-sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}


/* --- Main Content Layout --- */
.dashboard-main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  height: 100vh;           /* fills viewport exactly */
  overflow: hidden;        /* clips — only workspace scrolls */
}

/* --- Top Bar Layout (Stitch design) --- */
.dashboard-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 72px;
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.dashboard-top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-top-bar h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark-bg);
  margin: 0;
  letter-spacing: -0.01em;
}

.dashboard-top-bar p {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin: 0;
}

/* Home icon button in top bar */
.dash-home-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: var(--transition-fast);
  text-decoration: none;
  flex-shrink: 0;
}
.dash-home-icon-btn:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

/* Notification / Help icon buttons */
.dash-topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  background: none;
}
.dash-topbar-icon-btn:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

/* Divider between icons and avatar */
.dash-topbar-divider {
  width: 1px;
  height: 28px;
  background-color: var(--border-color);
  margin: 0 4px;
}

/* Username / board text */
.dash-username {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--dark-bg);
  line-height: 1.2;
}
.dash-userboard {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.dashboard-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-user-info > div > div:first-child {
  color: var(--dark-bg);
}

.dashboard-user-info > div > div:last-child {
  color: var(--text-muted);
}

.dashboard-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--white);
}

/* --- Workspace & Panels --- */
/* --- Workspace & Panels --- */
.dashboard-workspace {
  padding: 28px 32px;
  flex: 1;
  overflow-y: auto;   /* THE only scrollbar — workspace content scrolls */
  min-height: 0;      /* required for flex child to shrink below content height */
}

.dashboard-tab-panel {
  display: none;
}

.dashboard-tab-panel.active {
  display: block;
  animation: fadeInTab 0.25s ease;
}

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


/* --- Dashboard Statistics --- */
.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 40px;
}

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.dash-stat-card {
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-fast);
}

.dash-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.dash-stat-info h4 {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dash-stat-info .stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark-bg);
}

.dash-stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.dash-stat-icon.blue {
  background-color: rgba(59, 130, 246, 0.1);
}

.dash-stat-icon.teal {
  background-color: rgba(0, 210, 196, 0.1);
}

.dash-stat-icon.orange {
  background-color: rgba(245, 158, 11, 0.1);
}

.dash-card-box {
  background-color: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 30px;
  margin-bottom: 30px;
}

.dash-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


/* --- Dashboard Tables & Badges --- */
.dash-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dash-card-header h3 {
  font-size: 1.15rem;
  color: var(--dark-bg);
}

.dash-table-grid {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.dash-table-grid th {
  padding: 12px 16px;
  border-bottom: 2px solid var(--light-bg);
  font-weight: 700;
  color: var(--text-muted);
}

.dash-table-grid td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.dash-table-grid tr:last-child td {
  border-bottom: none;
}

.dash-status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.dash-status-pill.approved { background-color: #E6F4EA; color: #137333; }
.dash-status-pill.pending { background-color: #FEF7E0; color: #B06000; }

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-pending {
  background-color: rgba(245, 158, 11, 0.1);
  color: #D97706;
}

.status-approved {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.status-rejected {
  background-color: rgba(239, 68, 68, 0.1);
  color: #DC2626;
}


/* --- Dashboard Actions --- */
.btn-action-group {
  display: flex;
  gap: 8px;
}

.btn-action {
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-approve {
  background-color: var(--primary-light);
  color: var(--primary);
}

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

.btn-reject {
  background-color: #F3F4F6;
  color: var(--text-muted);
}

.btn-reject:hover {
  background-color: #E5E7EB;
  color: var(--text-main);
}

.btn-delete-action {
  background-color: #FEE2E2;
  color: #DC2626;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-delete-action:hover {
  background-color: #DC2626;
  color: var(--white);
}

.btn-edit-action {
  background-color: #F1F5F9;
  color: #475569;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-edit-action:hover {
  background-color: #E2E8F0;
  color: var(--dark-bg);
}


/* --- Forms inside Dashboard --- */
.dash-form-card {
  background-color: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 32px;
}

.dash-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.dash-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-form-group.full-width {
  grid-column: 1 / -1;
}

.dash-form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-bg);
}

.dash-form-group input,
.dash-form-group select,
.dash-form-group textarea {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
  background-color: var(--white);
}

.dash-form-group input:focus,
.dash-form-group select:focus,
.dash-form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--border-focus);
}

.dash-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dash-form-full {
  grid-column: span 2;
}


/* --- Dashboard Event Grid --- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.dash-item-card {
  background-color: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dash-item-img {
  height: 140px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.dash-item-img-placeholder {
  height: 140px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 2.5rem;
}

.dash-item-body {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.dash-item-tag {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background-color: var(--primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.dash-item-body h4 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  line-height: 1.3;
}

.dash-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-item-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.dash-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}


/* --- Dashboard Mobile / Responsive Overrides --- */
@media (max-width: 1024px) {
  .dashboard-sidebar {
    width: 220px;
    min-width: 220px;
  }
  .dashboard-main-content {
    margin-left: 220px;
  }
  .dash-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  }
}

@media (max-width: 992px) {
  .dashboard-layout {
    flex-direction: column;
  }
  .dashboard-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 20px;
    position: static;
    height: auto;
  }
  .sidebar-logo {
    margin-bottom: 16px;
  }
  .sidebar-profile-box {
    display: none;
  }
  .sidebar-menu-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
  }
  .sidebar-menu-btn {
    white-space: nowrap;
    width: auto;
  }
  .sidebar-footer {
    display: none;
  }
  .dash-stats-row {
    grid-template-columns: 1fr;
  }
  body {
    overflow-x: hidden !important;
  }
}

@media (max-width: 768px) {
  .dashboard-sidebar {
    display: none;
  }
  .dashboard-main-content {
    margin-left: 0;
  }
  .dashboard-workspace {
    padding: 16px;
  }
  .dashboard-top-bar {
    padding: 12px 16px;
  }
}

@media (max-width: 576px) {
  .dash-form-row {
    grid-template-columns: 1fr;
  }
  .dashboard-top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* --- Missing Selectors Migrated from style.css --- */

.dash-stat-icon.green {
  background-color: #E6F4EA;
  color: #137333;
}

.dash-table-wrapper {
  overflow-x: auto;
  margin-top: 10px;
}

/* --- Auth Loading Overlay --- */
.auth-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.4s ease;
}

.auth-loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

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

.auth-loading-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* --- About Meta List (used in Overview) --- */
.about-meta-list {
  list-style: none;
}

.about-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  padding: 8px 0;
}

.about-meta-item span:last-child {
  font-weight: 600;
  color: var(--text-main);
}

/* --- Success Screen --- */
.success-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.success-screen.active {
  display: flex;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.1);
  color: #10B981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 16px;
}

/* --- Spinner --- */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* --- Animations --- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* --- Responsive Toast Mobile Overrides --- */
@media (max-width: 576px) {
  .toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }
  .toast-alert {
    min-width: auto;
    max-width: 100%;
  }
}

/* --- Stitch-style Stat Icon Boxes (replace emoji icons) --- */
.dash-stat-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-stat-icon-box.blue {
  background-color: rgba(0, 102, 200, 0.10);
  color: var(--primary);
}
.dash-stat-icon-box.teal {
  background-color: rgba(0, 210, 196, 0.12);
  color: #00A89C;
}
.dash-stat-icon-box.orange {
  background-color: rgba(245, 158, 11, 0.12);
  color: #D97706;
}

/* --- Stat Card Label (Stitch uppercase label-caps style) --- */
.dash-stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 8px 0;
}

/* Pending count in table header */
.dash-card-header span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Desktop: Stitch inner-scroll pattern already handled above.
   mobile-dashboard-content must fill remaining height so workspace can scroll. */
@media (min-width: 993px) {
  body.school-admin-body .mobile-dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  /* Hide mobile drawer components on desktop to prevent layout shifting */
  .mobile-sidebar-drawer,
  .mobile-sidebar-overlay-bg {
    display: none;
  }
}
