/* ==========================================================================
   E-Rapor Digital [LPTD al-Fajr Malang] - Custom Styles & A4 Print Layout
   Skema Warna: Hijau Emerald - Putih Modern & Profesional
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Amiri:wght@400;700&display=swap');

:root {
  --emerald-950: #003335;
  --emerald-900: #004d4f;
  --emerald-800: #006365;
  --emerald-700: #007c7e;
  --emerald-600: #009698;
  --emerald-500: #00a5a8;
  --emerald-100: #d4f3f3;
  --emerald-50:  #eefafa;
}

* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  color: #0f172a;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #009698;
}

/* Islamic Subtle Geometric Pattern Header */
.islamic-pattern-bg {
  background-color: #006365;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(0, 165, 168, 0.28) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(0, 150, 152, 0.35) 0%, transparent 50%),
    linear-gradient(135deg, #003335 0%, #006365 48%, #009698 100%);
}

/* Sidebar Navigation */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #d4f3f3;
  transition: all 0.18s ease;
  cursor: pointer;
  user-select: none;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar-link.active {
  background-color: #ffffff;
  color: #006365;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Card & Table Enhancements */
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 150, 152, 0.14), 0 8px 10px -6px rgba(0, 150, 152, 0.1);
}

.table-input {
  width: 72px;
  text-align: center;
  padding: 0.375rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}
.table-input:focus {
  outline: none;
  border-color: #009698;
  box-shadow: 0 0 0 3px rgba(0, 150, 152, 0.22);
}
.table-input:disabled {
  background-color: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

/* Toast Notification Animation */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.toast-enter {
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================================================
   TATA LETAK RESMI RAPOR UKURAN A4 (SIAP PRINT / PDF)
   ========================================================================== */
.a4-sheet {
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 16mm;
  margin: 0 auto 1.5rem auto;
  background: #ffffff;
  color: #000000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  font-family: 'Times New Roman', Times, serif;
  font-size: 11pt;
  line-height: 1.35;
  position: relative;
}

.a4-sheet table {
  border-collapse: collapse;
  width: 100%;
}

.a4-sheet .rapor-bordered th,
.a4-sheet .rapor-bordered td {
  border: 1px solid #1e293b;
  padding: 5px 7px;
  vertical-align: top;
  font-size: 10pt;
}

.a4-sheet .rapor-bordered th {
  background-color: #eefafa !important;
  color: #004d4f !important;
  font-weight: bold;
  text-align: center;
  vertical-align: middle;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
  .table-input {
    width: 58px;
    padding: 0.3rem 0.35rem;
    font-size: 0.8125rem;
  }

  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
}

/* Print Media Rules */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm 14mm 12mm;

    @bottom-left {
      content: "SD LPTD al-Fajr Malang — Kurikulum Merdeka";
      font-family: 'Times New Roman', Times, serif;
      font-size: 8.5pt;
      color: #64748b;
    }

    @bottom-right {
      content: "Halaman " counter(page) " dari " counter(pages);
      font-family: 'Times New Roman', Times, serif;
      font-size: 9pt;
      font-weight: 600;
      color: #334155;
    }
  }

  body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .no-print {
    display: none !important;
  }

  #print-area {
    display: block !important;
    position: static !important;
    width: 100% !important;
  }

  .a4-sheet {
    width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    page-break-after: always;
    break-after: page;
  }

  .a4-sheet:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .signature-block,
  .no-break {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .a4-sheet table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
