/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  /* Common Core Tokens */
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Brand Colors */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  
  /* Status Colors */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.2);
  --info: #0284c7;
  --info-bg: rgba(2, 132, 199, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.2);
  
  /* Light Theme Overrides (Default) */
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --bg-app: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-solid: #ffffff;
  --border-color: rgba(226, 232, 240, 0.8);
  --shadow-color: rgba(15, 23, 42, 0.06);
  --shadow-hover: rgba(15, 23, 42, 0.1);
  --input-bg: rgba(255, 255, 255, 0.9);
  --input-border: #cbd5e1;
}

/* Dark Theme Overrides */
.dark-theme {
  --bg-gradient: linear-gradient(135deg, #090d16 0%, #0f172a 100%);
  --bg-app: #0b0f19;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-solid: #1e293b;
  --border-color: rgba(51, 65, 85, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.2);
  --shadow-hover: rgba(0, 0, 0, 0.3);
  --input-bg: rgba(15, 23, 42, 0.8);
  --input-border: #334155;
  --primary-glow: rgba(79, 70, 229, 0.3);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-family);
  color: var(--text-main);
  background-color: var(--bg-app);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.app-wrapper {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view {
  width: 100%;
  display: none;
  animation: fadeIn var(--transition-normal) forwards;
}

.view.active {
  display: block;
}

.hidden {
  display: none !important;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
}

/* ==========================================================================
   COMPONENTS: FLOATING ACTIONS & THEME TOGGLE
   ========================================================================== */
.floating-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--shadow-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.floating-btn:hover {
  transform: scale(1.05);
  background: var(--bg-card-solid);
}

.floating-btn svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-normal);
}

.light-theme .sun-icon {
  display: block;
}
.light-theme .moon-icon {
  display: none;
}
.dark-theme .sun-icon {
  display: none;
}
.dark-theme .moon-icon {
  display: block;
}

/* ==========================================================================
   COMPONENTS: CARDS & GLASSMORPHISM
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px var(--shadow-color);
  padding: 40px;
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.glassmorphism {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.card:hover {
  box-shadow: 0 15px 35px var(--shadow-hover);
}

/* ==========================================================================
   COMPONENTS: FORMS & INPUTS
   ========================================================================== */
.form-group {
  margin-bottom: 24px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.input-wrapper {
  position: relative;
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  color: var(--text-main);
  background-color: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.helper-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Date Dropdown Layout */
.date-dropdown-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 12px;
}

/* ==========================================================================
   COMPONENTS: BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  gap: 8px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  box-shadow: 0 4px 10px var(--shadow-color);
}

.btn-secondary:hover {
  background-color: var(--border-color);
  transform: translateY(-1px);
}

.btn-outline-danger {
  background-color: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
}

.btn-outline-danger:hover {
  background-color: var(--danger-bg);
  transform: translateY(-1px);
}

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

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s ease-in-out infinite;
}

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

/* ==========================================================================
   ALERTS
   ========================================================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 20px;
  text-align: left;
}

.alert-danger {
  background-color: var(--danger-bg);
  color: #b91c1c;
  border: 1px solid var(--danger-border);
}

.dark-theme .alert-danger {
  color: #fca5a5;
}

.alert-success {
  background-color: var(--success-bg);
  color: #047857;
  border: 1px solid var(--success-border);
}

.dark-theme .alert-success {
  color: #a7f3d0;
}

.alert-info {
  background-color: var(--info-bg);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.2);
}

.dark-theme .alert-info {
  color: #bae6fd;
}

/* ==========================================================================
   STUDENT LOGIN PAGE
   ========================================================================== */
.auth-card {
  max-width: 460px;
  width: 100%;
  text-align: center;
  margin: 0 auto;
  border: 1.5px solid var(--border-color);
}

.brand-logo {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-lg);
  background: var(--primary-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.brand-logo svg {
  width: 36px;
  height: 36px;
}

.brand-logo-img {
  background: #ffffff !important;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 24px var(--shadow-color);
}

.logo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.letterhead-logo-img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.admin-logo {
  background: var(--primary-gradient);
}

.school-name {
  font-size: 1.35rem;
  letter-spacing: 0.5px;
  color: var(--text-main);
  margin-bottom: 6px;
  font-weight: 800;
}

.app-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-weight: 500;
}

.login-support-notice {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-support-notice p {
  margin: 0;
}

.support-link {
  color: #25d366; /* WhatsApp Green */
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  transition: opacity var(--transition-fast);
}

.support-link:hover {
  opacity: 0.85;
  text-decoration: underline;
}

.wa-icon {
  flex-shrink: 0;
}

/* ==========================================================================
   STUDENT RESULTS VIEW (Official Announcement Template)
   ========================================================================== */
.result-card {
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
  background-color: var(--bg-card-solid);
}

.official-letterhead {
  text-align: center;
  margin-bottom: 24px;
}

.letterhead-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 12px;
}

.letterhead-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.letterhead-text h1 {
  font-size: 1.4rem;
  color: #1e3a8a;
  margin-top: 2px;
  letter-spacing: 0.5px;
}

.letterhead-text h2 {
  font-size: 0.9rem;
  color: #334155;
  font-weight: 600;
}

.letterhead-text h3 {
  font-size: 1rem;
  color: #1e293b;
  font-weight: 700;
}

.letterhead-text p {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 4px;
}

.letterhead-divider {
  height: 4px;
  border-top: 3px solid #000;
  border-bottom: 1px solid #000;
  margin-top: 10px;
}

.announcement-title {
  text-align: center;
  margin: 20px 0;
}

.announcement-title h2 {
  font-size: 1.25rem;
  letter-spacing: 1px;
  color: var(--text-main);
  text-decoration: underline;
  margin-bottom: 4px;
}

.announcement-title h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.announcement-title p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.announcement-intro,
.announcement-middle {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 16px;
  color: var(--text-main);
}

/* Biodata Table */
.student-info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.95rem;
}

.student-info-table td {
  padding: 8px 4px;
  vertical-align: top;
}

.uppercase-text {
  text-transform: uppercase;
}

/* Table Nilai (Mainly for Print) */
.scores-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
  display: none; /* Hidden on web view by default, visible on print */
}

.scores-table th, 
.scores-table td {
  border: 1.5px solid #475569;
  padding: 12px;
}

.scores-table th {
  background-color: #f1f5f9;
  color: #0f172a;
  font-weight: 700;
}

/* Web-Friendly Scores Grid */
.scores-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

.score-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
}

.subject-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.mat-card .subject-icon {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

.indo-card .subject-icon {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
}

.subject-icon svg {
  width: 24px;
  height: 24px;
}

.score-details h4 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.score-value {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-main);
}

/* Score Badges */
.score-badge {
  display: inline-flex;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

/* Legend & Color Badges */
.announcement-legend {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.legend-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.legend-items {
  display: flex;
  gap: 12px;
}

.legend-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Criteria Badge Colors */
.badge-less,
.score-badge.kurang,
.score-badge.Kurang {
  background-color: var(--danger-bg);
  color: #dc2626;
  border: 1px dashed rgba(220, 38, 38, 0.3);
}

.badge-enough,
.score-badge.memadai,
.score-badge.Memadai {
  background-color: var(--info-bg);
  color: #0284c7;
  border: 1px dashed rgba(2, 132, 199, 0.3);
}

.badge-good,
.score-badge.baik,
.score-badge.Baik {
  background-color: var(--success-bg);
  color: #059669;
  border: 1px dashed rgba(5, 150, 105, 0.3);
}

/* Official Signature Block */
.signature-section {
  display: flex;
  justify-content: flex-end;
  margin-top: 40px;
}

.signature-box {
  width: 250px;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.5;
}

.signature-space {
  flex: 1;
}

.signature-placeholder {
  height: 90px;
  margin: 6px 0;
  position: relative;
}

.stamp-sim {
  position: absolute;
  top: 15px;
  left: 20px;
  width: 70px;
  height: 70px;
  border: 2px dashed rgba(220, 38, 38, 0.65);
  border-radius: 50%;
  color: rgba(220, 38, 38, 0.65);
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-15deg);
  pointer-events: none;
}

.signature-img {
  max-width: 260px;
  max-height: 110px;
  position: absolute;
  top: -10px;
  left: -20px;
  object-fit: contain;
  pointer-events: none;
}

.underline-text {
  text-decoration: underline;
}

/* Action Buttons panel */
.actions-panel {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   ADMIN LAYOUT & INTERFACE
   ========================================================================== */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 30px;
  min-height: 70vh;
  width: 100%;
}

.admin-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: max-content;
}

.admin-sidebar-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.admin-badge {
  display: inline-block;
  background-color: var(--primary-glow);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.admin-sidebar-header h3 {
  font-size: 1.15rem;
  color: var(--text-main);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 30px;
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.green {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Statistics cards row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.stat-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.card-admin h3 {
  font-size: 1.2rem;
  margin-bottom: 4px;
  color: var(--text-main);
}

.tab-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Grid form for Admin school config */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

/* Excel drop zone */
.excel-drop-zone {
  border: 2px dashed var(--input-border);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.excel-drop-zone:hover,
.excel-drop-zone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-glow);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.excel-drop-zone p {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.highlight-link {
  color: var(--primary);
  text-decoration: underline;
}

.excel-drop-zone small {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Excel Guide Info */
.excel-guide {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.excel-guide h4 {
  font-size: 0.95rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.excel-guide p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.excel-guide ul,
.excel-guide ol {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 20px;
  margin-bottom: 16px;
}

.excel-guide li {
  margin-bottom: 6px;
}

/* Progress bar */
.progress-container {
  margin: 20px 0;
}

.progress-bar {
  height: 8px;
  background-color: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  transition: width 0.1s linear;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Admin Students Table & Layouts */
.admin-section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.title-actions {
  display: flex;
  gap: 12px;
}

.table-filter-bar {
  margin-bottom: 16px;
}

.table-filter-bar input {
  max-width: 320px;
}

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  background-color: var(--bg-card);
  font-weight: 700;
  color: var(--text-main);
}

.admin-table tbody tr:hover {
  background-color: var(--border-color);
}

.btn-delete-row {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.btn-delete-row:hover {
  background-color: var(--danger-bg);
}

.btn-delete-row svg {
  width: 16px;
  height: 16px;
}

/* Export JS area */
.code-export-box textarea {
  width: 100%;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  background-color: var(--input-bg);
  color: var(--text-main);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 16px;
  resize: vertical;
}

/* ==========================================================================
   FOOTER SECTION
   ========================================================================== */
.app-footer {
  width: 100%;
  margin-top: auto;
  padding: 24px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-app);
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.footer-links button:hover {
  text-decoration: underline;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================================================== */
@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  
  .admin-sidebar {
    height: auto;
  }
  
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .nav-item {
    flex: 1 1 auto;
    text-align: center;
    padding: 8px 12px;
  }
}

@media (max-width: 768px) {
  .app-wrapper {
    padding: 20px 10px;
  }
  
  .card {
    padding: 20px;
  }
  
  .scores-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-row {
    grid-template-columns: 1fr;
  }
  
  .letterhead-content {
    flex-direction: column;
    text-align: center;
  }
  
  .letterhead-logo {
    margin-bottom: -10px;
  }
  
  .official-letterhead h1 {
    font-size: 1.2rem;
  }
  
  .official-letterhead h3 {
    font-size: 0.9rem;
  }
  
  .footer-container {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  
  .signature-section {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .date-dropdown-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .actions-panel {
    flex-direction: column;
    gap: 12px;
  }
  
  .actions-panel button {
    width: 100%;
  }
  
  .legend-items {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  
  .announcement-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

/* ==========================================================================
   PRINT LAYOUT STYLES (window.print())
   ========================================================================== */
@media print {
  @page {
    size: A4;
    margin: 12mm 15mm 12mm 15mm;
  }

  body {
    background: none !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 13px !important;
  }
  
  .app-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  
  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: none !important;
  }
  
  .no-print {
    display: none !important;
  }

  /* Force school logo to the left of the letterhead text */
  .letterhead-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 15px !important;
    margin-bottom: 6px !important;
    text-align: left !important;
  }

  .letterhead-logo {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 0 !important;
  }

  .letterhead-logo-img {
    width: 60px !important;
    height: 60px !important;
  }

  .official-letterhead {
    margin-bottom: 12px !important;
    text-align: left !important;
  }

  .letterhead-text h1 {
    font-size: 1.25rem !important;
  }

  .letterhead-text h2 {
    font-size: 0.8rem !important;
  }

  .letterhead-text h3 {
    font-size: 0.85rem !important;
  }

  .letterhead-text p {
    font-size: 0.7rem !important;
  }

  .letterhead-divider {
    margin-top: 5px !important;
    border-top: 2px solid #000000 !important;
    border-bottom: 1px solid #000000 !important;
    height: 3px !important;
  }

  .announcement-title {
    margin: 12px 0 !important;
    text-align: center !important;
  }

  .announcement-title h2 {
    font-size: 1.15rem !important;
  }

  .announcement-title h3 {
    font-size: 0.9rem !important;
  }

  .announcement-title p {
    font-size: 0.8rem !important;
  }

  .announcement-intro,
  .announcement-middle {
    font-size: 0.85rem !important;
    margin-bottom: 10px !important;
    line-height: 1.5 !important;
  }

  .student-info-table {
    margin: 10px 0 !important;
    font-size: 0.85rem !important;
  }

  .student-info-table td {
    padding: 4px 4px !important;
  }
  
  .scores-table {
    display: table !important;
    width: 100% !important;
    margin-top: 10px !important;
    font-size: 0.85rem !important;
  }
  
  .scores-table th {
    background-color: #e2e8f0 !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .scores-table th, 
  .scores-table td {
    border: 1px solid #000000 !important;
    padding: 8px !important;
  }
  
  .signature-section {
    page-break-inside: avoid;
    margin-top: 25px !important;
  }

  .signature-box {
    width: 220px !important;
    font-size: 0.85rem !important;
  }

  .signature-placeholder {
    height: 75px !important;
    margin: 4px 0 !important;
  }

  .signature-img {
    max-width: 220px !important;
    max-height: 85px !important;
    top: -5px !important;
    left: -15px !important;
  }
  
  .stamp-sim {
    border: 2px dashed rgba(220, 38, 38, 0.8) !important;
    color: rgba(220, 38, 38, 0.8) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Reset layout constraints for print */
  #printable-area {
    width: 100% !important;
  }

  .announcement-note {
    border-top: 1px dashed #000000 !important;
    color: #000000 !important;
    margin-top: 20px !important;
    font-size: 0.75rem !important;
    padding-top: 8px !important;
  }
}

.announcement-note {
  margin-top: 35px;
  padding-top: 15px;
  border-top: 1px dashed var(--border-color);
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
  text-align: left;
}

/* ==========================================================================
   PASSWORD TOGGLE BUTTON STYLES
   ========================================================================== */
.password-input-container {
  position: relative;
}

.password-input-container input {
  padding-right: 48px;
}

.btn-toggle-password,
.btn-toggle-password-change {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-toggle-password:hover,
.btn-toggle-password-change:hover {
  color: var(--text-main);
  background-color: var(--border-color);
}

.btn-toggle-password svg,
.btn-toggle-password-change svg {
  width: 20px;
  height: 20px;
  display: block;
}
