/* assets/css/style.css - Mobile Friendly & Clean Typography System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #1e3a8a;
  --primary-hover: #1d4ed8;
  --sidebar-width: 250px;
  --bg-surface: #f8fafc;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.925rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Typography Hierarchy Refinement */
h1, h2, h3, h4, h5, h6 {
  color: #0f172a;
  font-weight: 600;
  letter-spacing: -0.02em;
}

h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 0.95rem; }

.extra-small {
  font-size: 0.75rem !important;
}

/* Mobile Overlay Backdrop */
#sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1035;
  transition: opacity 0.3s ease;
}

#sidebar-overlay.show {
  display: block;
}

/* Sidebar Styling */
#sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  min-height: 100vh;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
}

#sidebar .sidebar-brand {
  padding: 1.25rem 1rem;
  background: #090d16;
  border-bottom: 1px solid #1e293b;
}

#sidebar .nav-link {
  color: #94a3b8;
  padding: 0.7rem 1rem;
  margin: 0.2rem 0.6rem;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

#sidebar .nav-link:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

#sidebar .nav-link.active {
  color: #ffffff;
  background: #2563eb;
}

#sidebar .nav-link i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

/* Main Content Area */
#content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
}

/* Top Navbar */
.top-navbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* Stat Cards */
.stat-card {
  background: #ffffff;
  border-radius: 0.85rem;
  border: 1px solid #e2e8f0;
  box-shadow: var(--card-shadow);
  padding: 1.25rem;
  height: 100%;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.bg-income { background: #dcfce7; color: #166534; }
.bg-expense { background: #fee2e2; color: #991b1b; }
.bg-profit { background: #dbeafe; color: #1e40af; }
.bg-pengelola { background: #fef3c7; color: #92400e; }
.bg-pengembangan { background: #f3e8ff; color: #6b21a8; }
.bg-madrasah { background: #e0f2fe; color: #075985; }

/* Table Container & Touch Optimization */
.custom-table-container {
  background: #ffffff;
  border-radius: 0.85rem;
  border: 1px solid #e2e8f0;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.table > :not(caption) > * > * {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
}

.table thead th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e2e8f0;
}

/* Responsive Styles for Mobile (< 992px) */
@media (max-width: 991.98px) {
  #sidebar {
    transform: translateX(-100%);
  }
  
  #sidebar.show {
    transform: translateX(0);
  }

  #content {
    margin-left: 0;
    width: 100%;
  }

  .top-navbar {
    padding: 0.65rem 1rem;
  }

  /* Padding body mobile */
  .p-4 {
    padding: 1rem !important;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  /* Filter form responsive stacked layout */
  .filter-form-mobile {
    flex-direction: column;
    align-items: stretch !important;
  }

  /* Table horizontal scrollable touch optimization */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
}

/* Printable Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }
  #sidebar, .top-navbar, #sidebar-overlay, .no-print, .btn, footer {
    display: none !important;
  }
  #content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .card, .custom-table-container {
    border: none !important;
    box-shadow: none !important;
  }
  .table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  .table th, .table td {
    border: 1px solid #000000 !important;
    padding: 6px 8px !important;
  }
}
