@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --primary-hsl: 136, 53%, 25%;
  --primary: hsl(var(--primary-hsl));
  --primary-rgb: 30, 97, 43;
  --primary-dark: hsl(136, 53%, 17%);
  --primary-light: hsl(136, 40%, 94%);
  --secondary: #2e7d32;
  --accent-gold: #c5a02b;
  --accent-gold-light: #f9f5e8;
  --success: #2e7d32;
  --danger: #d32f2f;
  --warning: #f57c00;
  --info: #0288d1;
  
  /* Neutral Palette */
  --bg-gradient: linear-gradient(135deg, #f1f8e9 0%, #e8f5e9 100%);
  --bg-dark: #0f2d15;
  --text-main: #1b2e20;
  --text-muted: #4a604f;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(30, 97, 43, 0.08);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 25px -5px rgba(30, 97, 43, 0.08), 0 8px 16px -6px rgba(30, 97, 43, 0.04);
  --shadow-lg: 0 20px 40px -15px rgba(15, 45, 21, 0.15);
  
  /* Radii & Transitions */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  line-height: 1.25;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: rgba(30, 97, 43, 0.2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 97, 43, 0.4);
}

/* Typography Utility Classes */
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent-gold); }

/* Animation Keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes glowPulse {
  0% { box-shadow: 0 0 0 0 rgba(30, 97, 43, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(30, 97, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(30, 97, 43, 0); }
}

.animate-fade-in {
  animation: fadeInUp 0.6s var(--transition-smooth) forwards;
}

.animate-scale-in {
  animation: scaleIn 0.5s var(--transition-bounce) forwards;
}

/* Page Layout Wrappers */
.app-header {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.app-brand img {
  width: 45px;
  height: 45px;
}
.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  flex-direction: column;
}
.brand-sub {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2.5rem 1.5rem;
  position: relative;
}

/* Glassmorphism & Cards */
.card-container {
  width: 100%;
  max-width: 520px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}
.card-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--primary), var(--accent-gold), var(--primary));
}

.card-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2rem;
}

/* Custom Interactive Inputs */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.input-icon-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.form-control {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
  font-family: inherit;
  padding: 0.75rem 1rem;
  padding-left: 2.75rem;
  border: 2px solid rgba(30, 97, 43, 0.15);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-smooth);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(30, 97, 43, 0.12);
  background: #ffffff;
}

/* Custom Validations style.css */
.form-control:invalid:user-invalid {
  border-color: var(--danger);
  background-color: #fff8f8;
}

.form-control:invalid:user-invalid + .validation-message {
  display: block;
}

.validation-message {
  display: none;
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.25rem;
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  width: 100%;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(30, 97, 43, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(30, 97, 43, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: #ffffff;
  color: var(--primary-dark);
  border: 2px solid var(--primary-light);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--primary-light);
}

.btn-gold {
  background: var(--accent-gold);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(197, 160, 43, 0.25);
}
.btn-gold:hover {
  background: #b08d22;
  transform: translateY(-1px);
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Main Portal Footer */
.app-footer {
  background: var(--bg-dark);
  color: #ffffff;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border-top: 4px solid var(--accent-gold);
  margin-top: auto;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.footer-logo {
  width: 60px;
  height: 60px;
  margin-bottom: 1rem;
}

.footer-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
}

.footer-address {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 1.5rem;
}

.footer-blessing {
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.6;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.25rem;
  max-width: 600px;
  margin: 0 auto;
  color: #e8f5e9;
}

/* Views Management */
.page-view {
  display: none;
  width: 100%;
}
.page-view.active {
  display: block;
}

/* View dengan konten di tengah (kartu login, hasil nilai, dll.) */
/* Selector lebih spesifik (3 class) agar menang atas .page-view.active */
.page-view.page-view--centered.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  padding: 2.5rem 1.5rem;
}

/* Student Result Page Styles */
.result-card {
  max-width: 650px;
  width: 100%;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border);
  overflow: hidden;
  position: relative;
}

.result-header {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 4px solid var(--accent-gold);
}

.result-header img {
  width: 70px;
  height: 70px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.result-header-text h3 {
  font-size: 1.5rem;
  color: #ffffff;
}

.result-header-text p {
  font-size: 0.85rem;
  opacity: 0.8;
  letter-spacing: 0.5px;
}

.result-body {
  padding: 2rem;
}

.student-info-table {
  width: 100%;
  margin-bottom: 1.5rem;
  border-collapse: collapse;
}

.student-info-table td {
  padding: 0.5rem 0;
  vertical-align: top;
}

.student-info-table td:first-child {
  font-weight: 600;
  color: var(--text-muted);
  width: 140px;
}

.student-info-table td:nth-child(2) {
  width: 15px;
  color: var(--text-muted);
}

.student-info-table td:last-child {
  font-weight: 700;
  color: var(--text-main);
}

/* Grade Display Grid */
.grades-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 520px) {
  .grades-grid {
    grid-template-columns: 1fr;
  }
}

.grade-card {
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  background: var(--primary-light);
  text-align: center;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.grade-card.matematika {
  border-color: rgba(30, 97, 43, 0.15);
  background: linear-gradient(180deg, #ffffff 0%, var(--primary-light) 100%);
}

.grade-card.bahasa {
  border-color: rgba(197, 160, 43, 0.2);
  background: linear-gradient(180deg, #ffffff 0%, var(--accent-gold-light) 100%);
}

.grade-subject {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.grade-score {
  font-family: 'Outfit', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1;
  margin: 0.5rem 0;
}

.grade-card.bahasa .grade-score {
  color: #a07e15;
}

.grade-description {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: 20px;
  background: #ffffff;
  display: inline-block;
  margin-top: 0.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.05);
}

/* Announcement Greeting & Message */
.congrats-message {
  background: var(--accent-gold-light);
  border-left: 4px solid var(--accent-gold);
  padding: 1.25rem 1.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 2rem;
}

.congrats-message h4 {
  color: #a07e15;
  margin-bottom: 0.25rem;
}

.congrats-message p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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



/* Admin Dashboard Layout */
.admin-container {
  width: 100%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .admin-container {
    grid-template-columns: 1fr;
  }
}

.admin-sidebar {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  align-self: start;
}

.admin-menu {
  list-style: none;
}

.admin-menu li {
  margin-bottom: 0.5rem;
}

.admin-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.admin-menu-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.admin-menu-btn.active {
  background: var(--primary);
  color: #ffffff;
}

.admin-main-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.admin-panel-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-md);
  padding: 2rem;
}

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

.admin-panel-header h3 {
  font-size: 1.5rem;
  color: var(--primary);
}

/* Admin Dashboard Statistics Grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: bold;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-dark);
}

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

/* File Importer Dropzone */
.dropzone {
  border: 2px dashed rgba(30, 97, 43, 0.3);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  text-align: center;
  background: #fdfdfd;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
  display: block;
}

.dropzone p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* Data Table Custom Styling */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}

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

.data-table th, .data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.data-table th {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
  background-color: rgba(30, 97, 43, 0.02);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-success { background: #e8f5e9; color: var(--success); }
.badge-danger { background: #ffebee; color: var(--danger); }
.badge-warning { background: #fff3e0; color: var(--warning); }

/* Custom Search & Toolbar styling */
.toolbar-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 600px) {
  .toolbar-flex {
    flex-direction: column;
    align-items: stretch;
  }
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-wrapper input {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 1rem;
  padding-left: 2.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid #ccc;
  outline: none;
}
.search-wrapper input:focus {
  border-color: var(--primary);
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}
.modal-overlay.active .modal-card {
  transform: translateY(0);
}
.modal-header {
  padding: 1.25rem 1.5rem;
  background: #f9f9f9;
  border-bottom: 1px solid #eee;
  font-weight: 700;
}
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  padding: 1rem 1.5rem;
  background: #f9f9f9;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* PDF Print Custom Styling */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .app-header, 
  .app-footer, 
  .result-actions,
  .congrats-message + .result-actions,
  #toggle-config-btn {
    display: none !important;
  }
  
  .main-content {
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  
  .result-card {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  .result-header {
    background: #ffffff !important;
    color: #000000 !important;
    border-bottom: 4px double #1e612b !important;
    padding: 1rem 0 !important;
    text-align: center;
    justify-content: center;
    flex-direction: row !important;
  }
  
  .result-header img {
    filter: none !important;
    width: 60px !important;
    height: 60px !important;
  }
  
  .result-header-text h3 {
    color: #000000 !important;
    font-size: 16pt !important;
  }
  
  .result-header-text p {
    color: #333333 !important;
    font-size: 10pt !important;
  }
  
  .result-body {
    padding: 1.5rem 0 !important;
  }
  
  .student-info-table {
    margin-bottom: 2rem !important;
    border-bottom: 2px solid #ccc !important;
    padding-bottom: 1rem !important;
  }
  
  .grades-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
  }
  
  .grade-card {
    border: 1px solid #1e612b !important;
    background: #ffffff !important;
    padding: 1rem !important;
    box-shadow: none !important;
    transform: none !important;
    page-break-inside: avoid;
  }
  
  .grade-score {
    color: #000000 !important;
    font-size: 32pt !important;
  }
  
  .grade-description {
    border: 1px solid #000000 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    color: #000000 !important;
  }
  
  .congrats-message {
    border: 1px solid #ccc !important;
    background: #fcfcfc !important;
    padding: 1rem !important;
    margin-top: 2rem !important;
  }
  
  .congrats-message h4 {
    color: #000000 !important;
  }
  
  /* Print footer with stamp / headmaster signature */
  .print-signature-section {
    display: flex !important;
    justify-content: flex-end;
    margin-top: 3rem;
    font-size: 11pt;
    page-break-inside: avoid;
  }
  
  .signature-block {
    text-align: center;
    width: 250px;
  }
  
  .signature-space {
    height: 70px;
  }
  
  .signature-name {
    font-weight: 700;
    text-decoration: underline;
  }
}

/* Hidden elements on screen but visible on print */
.print-signature-section {
  display: none;
}
