/* ==========================================================================
   CSS SYSTEM DESIGN - SISTEM INFORMASI KELULUSAN SISWA
   ========================================================================== */

:root {
  /* HSL Color System */
  --hue: 220;
  --primary-color: hsl(var(--hue), 85%, 55%);
  --primary-dark: hsl(var(--hue), 90%, 40%);
  --primary-light: hsl(var(--hue), 80%, 90%);
  --accent-color: hsl(38, 95%, 55%); /* Gold accent */
  --accent-light: hsl(38, 95%, 90%);
  
  --bg-app: linear-gradient(135deg, #7dd3fc 0%, #1d4ed8 50%, #172554 100%);
  --bg-card: hsla(0, 0%, 100%, 0.75);
  --border-card: hsla(0, 0%, 100%, 0.5);
  --text-main: hsl(var(--hue), 40%, 15%);
  --text-muted: hsl(var(--hue), 20%, 45%);
  --border-input: hsl(var(--hue), 30%, 85%);
  --bg-input: hsl(0, 0%, 100%);
  
  --color-success: hsl(142, 70%, 45%);
  --color-success-bg: hsl(142, 70%, 95%);
  --color-danger: hsl(350, 80%, 55%);
  --color-danger-bg: hsl(350, 80%, 96%);
  
  /* Shadow & Blur System */
  --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.08), 
                 0 4px 12px 0 rgba(0, 0, 0, 0.02);
  --glass-blur: blur(16px);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Variables */
.dark-theme {
  --bg-app: linear-gradient(135deg, #0284c7 0%, #1e3a8a 50%, #030712 100%);
  --bg-card: hsla(var(--hue), 30%, 16%, 0.7);
  --border-card: hsla(var(--hue), 30%, 25%, 0.4);
  --text-main: hsl(var(--hue), 20%, 94%);
  --text-muted: hsl(var(--hue), 15%, 70%);
  --border-input: hsl(var(--hue), 25%, 28%);
  --bg-input: hsl(var(--hue), 30%, 12%);
  --primary-light: hsl(var(--hue), 50%, 22%);
  --accent-light: hsl(38, 50%, 20%);
  
  --color-success-bg: hsl(142, 60%, 15%);
  --color-danger-bg: hsl(350, 60%, 15%);
  
  --card-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4),
                 0 4px 12px 0 rgba(0, 0, 0, 0.2);
}

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

body, input, button, select, textarea {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background var(--transition-normal), color var(--transition-normal);
  line-height: 1.6;
  overflow-x: hidden;
}

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

/* Floating Buttons */
.floating-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--glass-blur);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.floating-btn:hover {
  transform: scale(1.1);
  background: var(--primary-light);
}

.floating-btn svg {
  width: 20px;
  height: 20px;
}

/* Toggle Sun/Moon display */
.sun-icon { display: block; }
.moon-icon { display: none; }

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

/* Base Card & Glassmorphism styling */
.card {
  width: 100%;
  max-width: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-lg);
  padding: 40px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: background var(--transition-normal), border var(--transition-normal), transform var(--transition-normal);
  animation: cardFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* View Control */
.view {
  display: none;
  width: 100%;
  justify-content: center;
}

.view.active {
  display: flex;
}

.hidden {
  display: none !important;
}

/* Brand & Typography */
.brand-logo {
  text-align: center;
  margin-bottom: 20px;
}

.logo-image {
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.1));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

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

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

/* ==========================================================================
   VIEW 1: COUNTDOWN CARD DESIGN
   ========================================================================== */

.countdown-card {
  max-width: 650px;
  text-align: center;
}

.countdown-timer-wrapper {
  background: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  margin: 24px 0;
  border: 1px solid var(--border-card);
}

.countdown-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--primary-dark);
  margin-bottom: 20px;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.timer-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-number {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -1px;
}

.timer-unit {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.5px;
}

.info-footer {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.info-footer strong {
  color: var(--text-main);
}

/* ==========================================================================
   VIEW 2: AUTH CARD DESIGN
   ========================================================================== */

.auth-card {
  max-width: 500px;
}

.form-group {
  margin-bottom: 24px;
}

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

.input-wrapper input {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 600;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  letter-spacing: 1px;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--primary-light);
}

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

.date-dropdown-grid {
  display: grid;
  grid-template-columns: 2.2fr 3fr 2.5fr;
  gap: 10px;
}

.date-dropdown-grid select {
  padding: 14px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.date-dropdown-grid select:focus {
  border-color: var(--primary-color);
}

/* Button & UI Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  gap: 10px;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--border-card);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: #fff;
  transform: translateY(-2px);
}

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

.btn-outline-danger:hover {
  background: var(--color-danger);
  color: #fff;
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

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

/* Alerts & Status Notification */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
  animation: shake 0.4s ease;
}

.alert-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid hsla(350, 80%, 55%, 0.2);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.login-support-notice {
  text-align: center;
  margin-top: 30px;
  border-top: 1px dashed var(--border-input);
  padding-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 700;
  margin-top: 6px;
  gap: 5px;
}

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

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

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

/* ==========================================================================
   VIEW 3: SKL RESULTS VIEW (Web layout with beautiful gradients)
   ========================================================================== */

.result-card {
  max-width: 800px;
  padding: 40px;
}

.status-banner {
  display: flex;
  align-items: center;
  padding: 24px;
  border-radius: var(--radius-md);
  margin-bottom: 35px;
  gap: 20px;
}

.status-banner.lulus {
  background: var(--color-success-bg);
  border: 1px solid hsla(142, 70%, 45%, 0.15);
}

.status-banner.tidak-lulus {
  background: var(--color-danger-bg);
  border: 1px solid hsla(350, 80%, 55%, 0.15);
}

.status-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lulus .status-icon-wrap {
  background: var(--color-success);
  color: #fff;
}

.tidak-lulus .status-icon-wrap {
  background: var(--color-danger);
  color: #fff;
}

.status-icon-wrap svg {
  width: 28px;
  height: 28px;
}

.status-text-wrap h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.lulus .status-text-wrap h2 { color: var(--color-success); }
.tidak-lulus .status-text-wrap h2 { color: var(--color-danger); }

.status-text-wrap p {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  margin-top: 4px;
}

/* printable area default visual container styling */
#printable-area {
  background: #ffffff;
  color: #111827; /* Force dark text in print-view */
  border-radius: 12px;
  padding: 40px;
  border: 1px solid #e5e7eb;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Kop Surat (Letterhead) */
.official-letterhead {
  margin-bottom: 25px;
}

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

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

.letterhead-text {
  flex: 1;
  text-align: center;
}

.kop-yys {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-transform: uppercase;
}

.kop-school {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1d4ed8; /* Premium Royal Blue */
  margin: 2px 0;
  letter-spacing: 0.5px;
  line-height: 1.2;
  text-transform: uppercase;
}

.kop-meta {
  font-size: 0.75rem;
  font-weight: 700;
  color: #111827;
  margin-top: 1px;
  line-height: 1.2;
}

.kop-address {
  font-size: 0.7rem;
  font-weight: 600;
  color: #111827;
  margin-top: 1px;
  line-height: 1.2;
  text-transform: uppercase;
}

.kop-telp {
  font-size: 0.7rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.2;
}

.kop-web {
  font-size: 0.65rem;
  color: #374151;
  margin-top: 2px;
  line-height: 1.2;
}

.letterhead-divider {
  height: 3px;
  background: #000;
  margin-top: 15px;
  position: relative;
}

.letterhead-divider::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: #000;
}

/* Judul Dokumen SKL */
.skl-title {
  text-align: center;
  margin-bottom: 25px;
}

.skl-title h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-decoration: underline;
}

.skl-title p {
  font-size: 0.8rem;
  color: #4b5563;
  margin-top: 2px;
}

.skl-intro, .skl-middle-text, .skl-middle-text-2 {
  font-size: 0.85rem;
  margin-bottom: 12px;
  text-align: justify;
}

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

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

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

/* Status Decision Box */
.status-decision-box {
  width: max-content;
  margin: 15px auto;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 8px;
  text-align: center;
}

.status-decision-box.lulus-box {
  color: #000000; /* Black as in mockup */
  border: none;
}

.status-decision-box.tidak-lulus-box {
  color: #dc2626; /* Red */
  border: none;
}

/* Table Nilai */
.scores-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0 25px 0;
  font-size: 0.85rem;
}

.scores-table th, .scores-table td {
  border: 1px solid #000;
  padding: 8px 12px;
  text-align: left;
}

.scores-table th {
  background: #f3f4f6;
  font-weight: 700;
  text-align: center;
}

.scores-table td.num-cell {
  text-align: center;
}

.scores-table td.score-cell {
  text-align: center;
  font-weight: 700;
}

.scores-table td.sub-subject {
  padding-left: 24px;
}

.scores-table tr.average-row td {
  font-weight: bold;
  background-color: #f3f4f6;
}

.skl-under-table-text {
  font-size: 0.85rem;
  margin-bottom: 25px;
  text-align: justify;
  line-height: 1.5;
}

/* Tanda Tangan Section */
.signature-section {
  display: flex;
  justify-content: flex-end;
  margin-top: 25px;
  page-break-inside: avoid;
}

.signature-box {
  width: 250px;
  text-align: left;
  font-size: 0.85rem;
  position: relative;
}

.signature-box p {
  margin-bottom: 3px;
}

.signature-placeholder {
  height: 95px;
  margin: 5px 0;
  position: relative;
}

.signature-img {
  height: 95px;
  width: auto;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

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

/* Catatan kaki */
.skl-note {
  font-size: 0.72rem;
  color: #4b5563;
  margin-top: 25px;
  border-top: 1px solid #d1d5db;
  padding-top: 10px;
  text-align: justify;
  line-height: 1.4;
}

/* Actions Panel */
.actions-panel {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

/* ==========================================================================
   APP FOOTER
   ========================================================================== */

.app-footer {
  padding: 32px 20px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
  width: 100%;
}

.app-footer p {
  margin: 0;
}

.app-footer .lbl-school-name {
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}


/* ==========================================================================
   PRINT MEDIA STYLES (Strict Overrides for A4 Printing)
   ========================================================================== */

@media print {
  /* Hide all web components */
  body {
    background: #ffffff !important;
    color: #000000 !important;
    min-height: auto;
    font-size: 11pt;
  }

  .floating-btn,
  .no-print,
  .status-banner,
  .actions-panel,
  .app-footer {
    display: none !important;
  }

  .app-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }

  .card {
    max-width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    backdrop-filter: none !important;
    margin: 0 !important;
  }

  #printable-area {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  .scores-table th {
    background-color: #f3f4f6 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Specific margin for printing */
  @page {
    size: A4 portrait;
    margin: 1.5cm 1.5cm 1.5cm 1.5cm;
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN (Adaptive Grid & Font Scales)
   ========================================================================== */

@media (max-width: 600px) {
  .card {
    padding: 24px 16px;
    border-radius: var(--radius-md);
  }

  .floating-btn {
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
  }

  .school-name {
    font-size: 1.2rem;
  }

  .timer-number {
    font-size: 1.9rem;
  }

  .timer-grid {
    gap: 8px;
  }

  .date-dropdown-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .actions-panel {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

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

  .letterhead-text h1 {
    font-size: 0.95rem;
  }

  .letterhead-text h2 {
    font-size: 0.75rem;
  }

  .letterhead-text h3 {
    font-size: 0.65rem;
  }

  .student-info-table td {
    padding: 4px 2px;
  }
}

/* ==========================================================================
   ADMIN LAYOUT & INTERFACE STYLING
   ========================================================================== */

.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 30px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100vh - 120px);
  position: sticky;
  top: 40px;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--glass-blur);
}

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

.admin-badge {
  display: inline-block;
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

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

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.nav-item.active {
  background: var(--primary-color);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

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

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-card);
}

.admin-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
}

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

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

/* Statistics row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--card-shadow);
  backdrop-filter: var(--glass-blur);
  transition: transform var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
}

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

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

.card-admin {
  max-width: 100%;
  padding: 30px;
}

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

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

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

.form-grid .form-group {
  margin-bottom: 12px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group select,
.form-group input[type="datetime-local"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.logo-previews-wrapper,
.signature-previews-wrapper {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.logo-preview-box,
.signature-preview-box {
  padding: 12px;
  border: 1.5px dashed var(--border-input);
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  min-width: 200px;
  flex: 1;
}

.logo-preview-box span,
.signature-preview-box span {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.logo-preview-box div,
.signature-preview-box div {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 6px;
  border: 1px solid var(--border-input);
}

/* File Upload drop zone */
.excel-drop-zone {
  border: 2px dashed var(--border-input);
  background: var(--bg-input);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

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

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

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

/* Table styling for Database Tab */
.admin-section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.table-filter-bar {
  margin-top: 15px;
  margin-bottom: 5px;
  width: 100%;
}

.table-filter-bar input {
  width: 100% !important;
  max-width: 500px !important;
  display: block;
}

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

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

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

.admin-table th {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 800;
}

.admin-table tbody tr {
  background-color: var(--bg-card);
  transition: background-color var(--transition-fast);
}

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

.btn-delete-row {
  background: none;
  border: none;
  color: var(--color-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(--color-danger-bg);
}

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

/* Charts / SVG visualization placeholder */
.chart-card-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--card-shadow);
  margin-top: 15px;
}

/* Chart Layout Grid */
.chart-main-container {
  display: flex;
  gap: 12px;
  width: 100%;
  position: relative;
  align-items: stretch;
  margin-top: 20px;
}

.chart-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 220px;
  padding-bottom: 25px; /* offset for bottom labels in chart-area */
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  box-sizing: border-box;
  line-height: 1;
  font-weight: 600;
}

.chart-area-wrap {
  position: relative;
  flex: 1;
  height: 220px;
}

.chart-gridlines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 25px; /* offset for bottom labels */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  z-index: 1;
}

.chart-gridline {
  height: 1px;
  background-color: var(--border-card);
  width: 100%;
  opacity: 0.35;
}

.chart-svg-container {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start; /* Start from far left */
  height: 220px;
  border-left: 2px solid var(--border-input);
  border-bottom: 2px solid var(--border-input);
  padding: 10px 10px 0 10px;
  position: relative;
  background: transparent !important;
  z-index: 2;
  gap: 16px; /* Gap between bar groups starting from left */
}

.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px; /* Fixed width for bar groups */
  min-width: 48px;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.chart-bars-wrap {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
}

.chart-bar {
  width: 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 0.5s ease-out;
  min-height: 2px;
  position: relative;
}

.chart-bar.akses {
  background: hsla(var(--hue), 85%, 55%, 0.2);
  border: 2px solid var(--primary-color);
  border-bottom: none;
}

.chart-bar.cetak {
  background: hsla(38, 95%, 55%, 0.2);
  border: 2px solid var(--accent-color);
  border-bottom: none;
}

.chart-bar:hover::after {
  content: attr(data-value);
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-main);
  color: var(--bg-input);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
}

.chart-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 10px;
  position: absolute;
  bottom: -22px;
  white-space: nowrap;
}

.chart-legend-box {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 35px;
}

.legend-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.akses { background: var(--primary-color); }
.legend-color.cetak { background: var(--accent-color); }

/* Password visibility toggle positioning */
.password-input-container {
  position: relative;
}

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

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

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

.btn-toggle-password-change svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   ADMIN LAYOUT RESPONSIVENESS
   ========================================================================== */

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  
  .admin-sidebar {
    height: auto;
    position: static;
  }
  
  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0;
  }
  
  .nav-item {
    flex: 1 1 calc(50% - 10px);
    justify-content: center;
    padding: 10px;
  }
  
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .nav-item {
    flex: 1 1 100%;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

