:root {
    --primary-green: #2d5016;
    --light-green: #4a7c2d;
    --accent-red: #dc3545;
    --light-red: #f8d7da;
    --bg-light: #f8f9fa;
}

/* Reset & Base */
body, html {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    margin: 0;
    padding: 0;
    height: 100%;
}

/* Custom Colors */
.text-success-custom {
    color: var(--primary-green) !important;
}

.bg-success-custom {
    background-color: var(--primary-green) !important;
}

.btn-success-custom {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    color: white;
}

.btn-success-custom:hover {
    background-color: var(--light-green);
    border-color: var(--light-green);
    color: white;
}

.btn-outline-light:hover {
    background-color: white;
    color: var(--primary-green);
}

/* Landing Page */
.landing-page {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.hero-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    padding: 50px 0;
}

.logo-animated {
    width: 40px;
    height: 40px;
    animation: float 3s ease-in-out infinite;
}

.logo-hero-animated {
    animation: float 3s ease-in-out infinite;
    max-width: 400px;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.feature-box {
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.feature-box:hover {
    transform: translateY(-5px);
}

/* Login Page */
.logo-login {
    width: 80px;
    height: 80px;
    animation: float 3s ease-in-out infinite;
}

/* Wrapper & Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar - FIXED dengan warna original */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, var(--primary-green) 0%, var(--light-green) 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    margin: 15px;
    border-radius: 10px;
    border-left: 3px solid var(--accent-red);
    flex-shrink: 0;
}

.sidebar-user i {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-user p {
    font-size: 14px;
    margin: 0;
}

.sidebar-user small {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Sidebar Menu */
.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-menu li {
    margin: 5px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-red);
}

.sidebar-menu li a i {
    margin-right: 10px;
    width: 20px;
}

/* Menu Divider */
.sidebar-menu .menu-divider {
    margin: 15px 0 10px 0;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-menu .menu-divider span {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    opacity: 0.7;
}

/* Logout Menu - di bagian bawah */
.sidebar-menu .logout-menu {
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px solid rgba(220, 53, 69, 0.3);
    flex-shrink: 0;
}

.sidebar-menu .logout-link {
    display: flex;
    align-items: center;
    padding: 15px 25px;
    color: #ffffff !important;
    background: rgba(220, 53, 69, 0.2);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid var(--accent-red);
    font-weight: 600;
    font-size: 15px;
}

.sidebar-menu .logout-link:hover {
    background: rgba(220, 53, 69, 0.4);
    border-left-color: #ffffff;
    padding-left: 30px;
}

.sidebar-menu .logout-link i {
    margin-right: 10px;
    width: 20px;
    font-size: 18px;
    color: #ff6b6b;
}

/* Animasi pulse untuk logout */
@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(220, 53, 69, 0);
    }
}

.sidebar-menu .logout-link:hover i {
    animation: pulse-red 1.5s infinite;
    color: #ffffff;
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    background: var(--bg-light);
    transition: margin-left 0.3s ease-in-out;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

.content-area {
    min-height: calc(100vh - 56px);
}

/* Stats Cards */
.stat-card {
    transition: transform 0.3s;
    border-left: 4px solid var(--primary-green);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.bg-success-light {
    background-color: rgba(45, 80, 22, 0.1);
}

/* Table */
.table {
    background: white;
}

.table thead {
    background: var(--bg-light);
}

/* Cards */
.card {
    border-radius: 10px;
    overflow: hidden;
}

.card-header {
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-area > * {
    animation: fadeIn 0.5s ease-out;
}

/* === STYLING DAFTAR SISWA === */
.siswa-list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.siswa-item-vertical {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 15px 12px 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.siswa-item-vertical:hover {
    background: #f8f9fa;
    border-color: var(--primary-green);
    box-shadow: 0 2px 4px rgba(45, 80, 22, 0.1);
    transform: translateX(3px);
}

.siswa-item-vertical .form-check {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    width: 100%;
}

.siswa-item-vertical .form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 0;
    margin-right: 15px;
    cursor: pointer;
    border: 2px solid #dee2e6;
    flex-shrink: 0;
    position: relative;
}

.siswa-item-vertical .form-check-input:checked {
    background-color: var(--accent-red);
    border-color: var(--accent-red);
}

.siswa-item-vertical .form-check-input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 0.25rem rgba(45, 80, 22, 0.25);
}

.siswa-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    width: 100%;
    user-select: none;
    padding: 2px 0;
}

.siswa-number {
    font-size: 11px;
    padding: 4px 9px;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
    border-radius: 4px;
}

.siswa-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex-grow: 1;
    line-height: 1.5;
}

.siswa-item-vertical input[type="checkbox"]:checked + label .siswa-name {
    font-weight: 700;
    color: var(--accent-red);
}

.siswa-item-vertical input[type="checkbox"]:checked + label .siswa-number {
    background-color: var(--accent-red) !important;
    color: white;
}

/* Container untuk siswa list dengan scrollbar */
#siswa_list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar styling untuk siswa list */
#siswa_list::-webkit-scrollbar {
    width: 10px;
}

#siswa_list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
    margin: 5px 0;
}

#siswa_list::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 10px;
}

#siswa_list::-webkit-scrollbar-thumb:hover {
    background: #1a3009;
}

/* Fix untuk Bootstrap 5 checkbox alignment */
.form-check {
    min-height: auto;
}

.form-check-input {
    margin-left: 0 !important;
}

/* Override Bootstrap 5 Form Check */
.siswa-item-vertical .form-check {
    padding-left: 0 !important;
}

.siswa-item-vertical .form-check-input {
    float: none !important;
    margin-left: 0 !important;
}

/* Pastikan checkbox tidak overflow */
.siswa-list-container {
    overflow: visible;
}

.siswa-item-vertical {
    overflow: visible;
}

/* Responsive */
@media (max-width: 768px) {
    /* Navbar mobile tetap di atas */
    .navbar.d-lg-none {
        display: block !important;
        z-index: 999;
    }
    
    /* Body margin-top untuk navbar fixed */
    body {
        padding-top: 56px;
    }
    
    /* Wrapper tidak perlu margin-top karena body sudah punya padding */
    .wrapper {
        margin-top: 0 !important;
    }
    
    /* Sidebar di mobile */
    .sidebar {
        position: fixed;
        top: 56px;
        left: 0;
        width: 260px;
        height: calc(100vh - 56px);
        background: linear-gradient(180deg, var(--primary-green) 0%, var(--light-green) 100%);
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1001;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    /* Sidebar muncul */
    .sidebar.show {
        transform: translateX(0) !important;
        z-index: 1001;
    }
    
    /* Overlay */
    .sidebar.show::after {
        content: '';
        position: fixed;
        top: 56px;
        left: 260px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    /* Main content di mobile */
    .main-content {
        margin-left: 0 !important;
        margin-top: 0;
        width: 100%;
    }
}

@media (min-width: 769px) {
    /* Desktop: navbar jangan tampil */
    .navbar.d-lg-none {
        display: none !important;
    }
    
    /* Desktop: body normal */
    body {
        padding-top: 0;
    }
    
    /* Desktop: sidebar normal */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        transform: translateX(0) !important;
        z-index: 1000;
    }
    
    /* Desktop: main content normal */
    .main-content {
        margin-left: 260px !important;
        margin-top: 0 !important;
    }
    
    /* Desktop: wrapper normal */
    .wrapper {
        margin-top: 0 !important;
    }
}

/* Sembunyikan tombol toggle lama di mobile */
@media (max-width: 768px) {
  /* Jika tombol lama punya class tertentu, ganti selector di bawah ini sesuai HTML Anda */
  .content .btn-sidebar-toggle,
  .main-content .btn-sidebar-toggle,
  .btn-toggle-desktop,
  .toggle-desktop-only {
    display: none !important;
  }
  
  /* Jika tombol lama tidak punya class, sembunyikan tombol yang berada di dalam wrapper/main-content */
  .wrapper .main-content button[id="sidebarToggle"],
  .wrapper .main-content button[id="sidebar-toggle"]:not(.position-fixed) {
    display: none !important;
  }
}

/* =========================================================
   ENHANCEMENT PATCH (tempel di paling bawah CSS lama)
   Tidak mengubah struktur/layout utama, hanya mempercantik.
========================================================= */

/* 1) Variabel tambahan untuk konsistensi */
:root{
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 10px rgba(0,0,0,.06);
  --shadow-md: 0 10px 25px rgba(0,0,0,.10);
  --shadow-lg: 0 18px 45px rgba(0,0,0,.14);

  --border-soft: 1px solid rgba(0,0,0,.08);
  --text-dark: #1f2937;
  --text-muted: #6b7280;

  --focus-ring: 0 0 0 .25rem rgba(45, 80, 22, .18);
}

/* 2) Base polishing */
html, body{
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{
  text-underline-offset: 3px;
}

/* 3) Cards: lebih “premium” dan konsisten */
.card{
  border-radius: var(--radius-md) !important;
  border: var(--border-soft) !important;
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.card:hover{
  box-shadow: var(--shadow-md);
}

.card-header{
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.70)) !important;
  backdrop-filter: blur(8px);
}

/* 4) Buttons: lebih tegas dan enak dilihat */
.btn{
  border-radius: 10px;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, border-color .15s ease;
}

.btn:active{
  transform: translateY(1px);
}

.btn-success-custom{
  box-shadow: 0 6px 14px rgba(45, 80, 22, .18);
}

.btn-success-custom:hover{
  box-shadow: 0 10px 20px rgba(45, 80, 22, .22);
}

.btn-outline-danger,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-success{
  border-width: 1px;
}

/* 5) Form: fokus lebih jelas (aksesibilitas) */
.form-control,
.form-select{
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.14);
  transition: box-shadow .15s ease, border-color .15s ease;
}

.form-control:focus,
.form-select:focus{
  border-color: rgba(45, 80, 22, .55);
  box-shadow: var(--focus-ring);
}

/* 6) Table: lebih rapi */
.table{
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table thead{
  background: rgba(248, 249, 250, .92);
}

.table thead th{
  font-weight: 700;
  color: #111827;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.table-hover tbody tr{
  transition: background-color .15s ease;
}
.table-hover tbody tr:hover{
  background-color: rgba(45, 80, 22, .04);
}

/* 7) Sidebar menu: lebih klikable */
.sidebar-menu li a{
  border-radius: 10px;
  margin: 2px 12px;
  padding: 12px 16px;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active{
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}

.sidebar-menu li a i{
  opacity: .95;
}

/* 8) Stats cards */
.stat-card{
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover{
  box-shadow: var(--shadow-md);
}

/* 9) Prefer-reduced-motion: ramah pengguna */
@media (prefers-reduced-motion: reduce){
  *{
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* 10) Dark-mode opsional */
@media (prefers-color-scheme: dark){
  :root{
    --bg-light: #0b1220;
    --text-dark: #e5e7eb;
    --text-muted: #9ca3af;
    --border-soft: 1px solid rgba(255,255,255,.10);
  }

  body, html{
    background-color: var(--bg-light);
    color: var(--text-dark);
  }

  .card, .table{
    background: rgba(17,24,39,.85);
    border: var(--border-soft) !important;
  }

  .table thead{
    background: rgba(31,41,55,.85);
  }

  .form-control, .form-select{
    background: rgba(17,24,39,.70);
    color: var(--text-dark);
    border: 1px solid rgba(255,255,255,.12);
  }
}
