/**
 * WinSPP - Main Application Stylesheet
 * Sistem Desain Dashboard Bendahara Yayasan Pendidikan Pratiwi
 * Palet: Slate Canvas, Emerald Institutional, High-Contrast Status Badges
 */

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

:root {
  /* Warna Identitas Utama Yayasan Pendidikan Pratiwi */
  --spp-primary: #059669;
  --spp-primary-hover: #047857;
  --spp-primary-subtle: #ECFDF5;
  --spp-primary-rgb: 5, 150, 105;

  /* Latar Belakang & Permukaan */
  --spp-bg-canvas: #F8FAFC;
  --spp-bg-card: #FFFFFF;
  --spp-border: #E2E8F0;
  --spp-border-subtle: #F1F5F9;

  /* Tipografi */
  --spp-text-main: #0F172A;
  --spp-text-secondary: #475569;
  --spp-text-muted: #64748B;
  --spp-font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --spp-font-numeric: 'Outfit', 'Inter', sans-serif;

  /* Sidebar Navigasi */
  --spp-sidebar-width: 260px;
  --spp-sidebar-collapsed-width: 76px;
  --spp-sidebar-bg: #0F172A;
  --spp-sidebar-card: #1E293B;
  --spp-sidebar-hover: #1E293B;
  --spp-sidebar-active: #059669;
  --spp-sidebar-text: #94A3B8;

  /* Status Finansial Siswa */
  --spp-status-lunas: #10B981;
  --spp-status-belum: #EF4444;
  --spp-badge-kip: #0284C7;
  --spp-badge-saudara: #D97706;
  --spp-badge-komite: #7C3AED;

  /* Elevasi & Bayangan */
  --spp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --spp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --spp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --spp-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--spp-font-main);
  background-color: var(--spp-bg-canvas);
  color: var(--spp-text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  overflow: hidden;
}

/* App Wrapper: Full Height Viewport */
#app-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ==========================================================================
   LEFT SIDEBAR NAVIGATION (Modern Slate Admin Style)
   ========================================================================== */
#sidebar {
  width: var(--spp-sidebar-width);
  height: 100vh;
  background-color: var(--spp-sidebar-bg);
  color: var(--spp-sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease;
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

/* Sidebar Brand Header */
.sidebar-brand {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-emblem {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
  flex-shrink: 0;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.brand-title {
  font-family: var(--spp-font-numeric);
  font-size: 1.18rem;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: #94A3B8;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Sidebar Navigation Items */
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.menu-label {
  padding: 10px 12px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748B;
  letter-spacing: 0.08em;
}

.nav-item-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #94A3B8;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.nav-item-btn i {
  font-size: 1.18rem;
  min-width: 22px;
  text-align: center;
  color: #64748B;
  transition: color 0.15s;
}

.nav-item-btn:hover {
  background-color: var(--spp-sidebar-hover);
  color: #FFFFFF;
}

.nav-item-btn:hover i {
  color: #10B981;
}

.nav-item-btn.active {
  background-color: var(--spp-primary);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.nav-item-btn.active i {
  color: #FFFFFF;
}

/* Sidebar Footer: Server Status Pill */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background-color: rgba(0, 0, 0, 0.15);
  font-size: 0.76rem;
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--spp-sidebar-card);
  padding: 8px 12px;
  border-radius: 8px;
  color: #E2E8F0;
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10B981;
  box-shadow: 0 0 8px #10B981;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   MAIN CONTENT WRAPPER & TOPBAR
   ========================================================================== */
#main-content-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--spp-bg-canvas);
}

#topbar {
  height: 64px;
  background-color: var(--spp-bg-card);
  border-bottom: 1px solid var(--spp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  box-shadow: var(--spp-shadow-sm);
  z-index: 99;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-sidebar-toggle {
  background: transparent;
  border: 1px solid var(--spp-border);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--spp-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sidebar-toggle:hover {
  background-color: var(--spp-border-subtle);
  color: var(--spp-text-main);
}

.topbar-institution-tag {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-ta {
  background-color: var(--spp-primary-subtle);
  color: var(--spp-primary);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.live-clock-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--spp-font-numeric);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--spp-text-secondary);
  background: var(--spp-bg-canvas);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--spp-border);
}

.user-profile-dock {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--spp-border);
}

.user-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--spp-primary);
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--spp-text-main);
}

.user-role-badge {
  font-size: 0.72rem;
  color: var(--spp-primary);
  font-weight: 500;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--spp-text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 1.1rem;
}

.btn-logout:hover {
  background: #FEE2E2;
  color: #DC2626;
}

/* ==========================================================================
   MAIN VIEWPORT CONTAINER (SPA View Area)
   ========================================================================== */
#main-viewport {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

#main-viewport::-webkit-scrollbar {
  width: 6px;
}
#main-viewport::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

/* Kartu Card Kontainer */
.spp-card {
  background: var(--spp-bg-card);
  border: 1px solid var(--spp-border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--spp-shadow-sm);
  transition: box-shadow 0.2s ease;
}

.spp-card:hover {
  box-shadow: var(--spp-shadow-md);
}

/* Header Halaman / Module Title */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title-block h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--spp-text-main);
  letter-spacing: -0.02em;
  margin: 0;
}

.page-title-block p {
  font-size: 0.88rem;
  color: var(--spp-text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   STAT CARDS (Metric Overview Cards)
   ========================================================================== */
.stat-card {
  background: var(--spp-bg-card);
  border: 1px solid var(--spp-border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--spp-shadow-sm);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon-emerald { background: #ECFDF5; color: #059669; }
.stat-icon-blue    { background: #E0F2FE; color: #0284C7; }
.stat-icon-amber   { background: #FEF3C7; color: #D97706; }
.stat-icon-purple  { background: #F3E8FF; color: #7C3AED; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--spp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-family: var(--spp-font-numeric);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--spp-text-main);
  line-height: 1.2;
}

.stat-note {
  font-size: 0.75rem;
  color: var(--spp-text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   BADGES & STATUS PILLS
   ========================================================================== */
.badge-spp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-spp-lunas {
  background-color: #ECFDF5;
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.badge-spp-belum {
  background-color: #FEF2F2;
  color: #DC2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.badge-spp-kip {
  background-color: #E0F2FE;
  color: #0284C7;
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-spp-saudara {
  background-color: #FEF3C7;
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

/* ==========================================================================
   AUTH GATE SCREEN (Login Panel Staf Bendahara)
   ========================================================================== */
#auth-gate-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 10% 20%, #0F172A 0%, #1E293B 90%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  padding: 20px;
}

.auth-gate-card {
  background: #FFFFFF;
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  padding: 36px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-gate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #059669 0%, #10B981 100%);
}

.auth-logo-badge {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 10px 20px rgba(5, 150, 105, 0.35);
  margin-bottom: 18px;
}

.auth-title {
  font-family: var(--spp-font-numeric);
  font-size: 1.6rem;
  font-weight: 700;
  color: #0F172A;
  margin-bottom: 4px;
}

.auth-institution {
  font-size: 0.88rem;
  color: #64748B;
  font-weight: 500;
  margin-bottom: 24px;
}

.btn-google-login {
  width: 100%;
  background: #FFFFFF;
  color: #0F172A;
  border: 1px solid #CBD5E1;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.btn-google-login:hover {
  background: #F8FAFC;
  border-color: #94A3B8;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.auth-disclaimer {
  margin-top: 24px;
  font-size: 0.76rem;
  color: #94A3B8;
  line-height: 1.45;
}

/* ==========================================================================
   BUTTONS & FORM ELEMENTS
   ========================================================================== */
.btn-spp-primary {
  background: var(--spp-primary);
  color: #FFFFFF;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.btn-spp-primary:hover {
  background: var(--spp-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

.btn-spp-outline {
  background: #FFFFFF;
  color: var(--spp-text-secondary);
  border: 1px solid var(--spp-border);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-spp-outline:hover {
  background: var(--spp-bg-canvas);
  border-color: #CBD5E1;
  color: var(--spp-text-main);
}

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS
   ========================================================================== */
@media (max-width: 992px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

  #sidebar.show-sidebar-mobile {
    transform: translateX(0);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 999;
  }
}

/* ==========================================================================
   MODAL DIALOGS & OVERLAYS (Sistem Popup Modal WinSPP)
   ========================================================================== */
.spp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: sppFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.spp-modal-card {
  background: #FFFFFF;
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  animation: sppScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Custom Scrollbar untuk Modal Card */
.spp-modal-card::-webkit-scrollbar {
  width: 6px;
}
.spp-modal-card::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 8px;
}
.spp-modal-card::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 8px;
}
.spp-modal-card::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

@keyframes sppFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sppScaleUp {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

