/**
 * Main Stylesheet
 * Aplikasi Pantauan Hafalan Al-Quran
 * Design: Islamic-inspired Modern
 */

/* =====================================================
   CSS Variables
   ===================================================== */
:root {
    /* Al-Hafidz Masda Theme */
    --primary: #0B3954; /* Deep Navy Blue */
    --primary-light: #16567C; /* Lighter Navy */
    --primary-dark: #072538; /* Darker Navy */
    --secondary: #006D5B; /* Emerald/Teal Green */
    --accent: #C59B3F; /* Elegant Gold */
    --accent-dark: #A67D28; /* Darker Gold for hover */

    --bg-main: #F4F7F9; /* Very soft blue-tinted background */
    --bg-card: #FFFFFF;
    --bg-sidebar: #0B3954; /* Match primary navy */
    --bg-header: rgba(255, 255, 255, 0.95);

    --text-primary: #2C3E50;
    --text-secondary: #546E7A;
    --text-light: #FFFFFF;
    --text-muted: #90A4AE;

    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    --border-color: #E2E8F0;
    
    /* Modern Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50%;

    --sidebar-width: 260px;
    --header-height: 70px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-main);
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* =====================================================
   Typography
   ===================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Amiri', 'Georgia', serif;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* =====================================================
   App Container
   ===================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

/* =====================================================
   Sidebar
   ===================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-light);
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    object-fit: cover;
    background: #fff;
    padding: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.logo-text {
    display: flex;
    flex-direction: column;
    font-family: 'Amiri', serif;
    line-height: 1.1;
}

.logo-text span:first-child {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.logo-text .logo-subtitle {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 1.5px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.3rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar-nav::-webkit-scrollbar {
    display: none;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin: 1px 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 15px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-light);
}

.nav-link.active {
    background: var(--accent);
    color: var(--primary-dark);
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 20px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-logout-btn {
    color: rgba(255,255,255,0.7);
    font-size: 1.2rem;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}
.sidebar-logout-btn:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.05) translateX(2px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.user-role {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
    margin-top: 2px;
}

/* =====================================================
   Badge Classes
   ===================================================== */
.badge-admin { background: var(--accent); color: var(--primary-dark); }
.badge-guru { background: #81D4FA; color: #0277BD; }
.badge-siswa { background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.4); }
.badge-ortu { background: #FFAB91; color: #E64A19; }
.badge-secondary { background: #E0E0E0; color: #616161; }

/* =====================================================
   Main Content
   ===================================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* =====================================================
   Top Header
   ===================================================== */
.top-header {
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-primary);
    cursor: pointer;
}

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

.datetime {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.datetime i {
    color: var(--primary);
}

/* =====================================================
   Checkbox Styles (Form Check Input)
   ===================================================== */
.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.15);
    border-color: var(--primary);
}

/* =====================================================
   Dropdown Menu
   ===================================================== */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.dropdown-toggle:hover {
    background: var(--bg-main);
}

.user-avatar-small {
    width: 35px;
    height: 35px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name-small {
    font-weight: 500;
    color: var(--text-primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1100 !important;
}

.dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: var(--text-primary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-main);
}

.dropdown-item.text-danger {
    color: var(--error);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* =====================================================
   Content Wrapper
   ===================================================== */
.content-wrapper {
    flex: 1;
    padding: 25px;
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #FFEBEE;
    color: #C62828;
    border-left: 4px solid var(--error);
}

.alert-warning {
    background: #FFF3E0;
    color: #E65100;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: #E3F2FD;
    color: #1565C0;
    border-left: 4px solid var(--info);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

.alert.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.card.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

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

.card-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 15px 22px;
    border-top: 1px solid var(--border-color);
    background: #FAFAFA;
}

/* =====================================================
   Stat Cards
   ===================================================== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--primary);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.stat-icon.green {
    background: #E8F5E9;
    color: var(--primary);
}

.stat-icon.yellow {
    background: #FFF8E1;
    color: var(--accent-dark);
}

.stat-icon.blue {
    background: #E3F2FD;
    color: var(--info);
}

.stat-icon.purple {
    background: #F3E5F5;
    color: #7B1FA2;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.3px;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%) scale(0);
    border-radius: 50%;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
    opacity: 0;
}

.btn:hover::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: var(--text-light);
    border: 1px solid transparent;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 4px 12px rgba(27, 94, 32, 0.3);
}

.btn-secondary {
    background: #F1F5F9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #E2E8F0;
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: var(--text-light);
}

.btn-success:hover {
    background: #43A047;
}

.btn-danger {
    background: var(--error);
    color: var(--text-light);
}

.btn-danger:hover {
    background: #E53935;
}

.btn-warning {
    background: var(--warning);
    color: var(--text-light);
}

.btn-warning:hover {
    background: #FB8C00;
}

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

.btn-outline:hover {
    background: var(--primary);
    color: var(--text-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
}

/* =====================================================
   Forms
   ===================================================== */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-label.required::after {
    content: ' *';
    color: var(--error);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    background: #F8FAFC;
    transition: var(--transition);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    background: var(--bg-card);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.15);
}

.form-control.error {
    border-color: var(--error);
}

.form-control:disabled {
    background: #F5F5F5;
    cursor: not-allowed;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    background: #F8FAFC;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23546E7A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-select:focus {
    outline: none;
    background-color: var(--bg-card);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.15);
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--error);
    margin-top: 4px;
}

/* =====================================================
   Tables
   ===================================================== */
.table-container {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
}

.data-table th {
    background: #e2e8f0;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: #F8F8F8;
}

.data-table tbody tr:nth-child(even) {
    background: #FAFAFA;
}

.data-table tbody tr:nth-child(even):hover {
    background: #F0F0F0;
}

/* =====================================================
   Progress Bar
   ===================================================== */
.progress {
    height: 10px;
    background: #E0E0E0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--error); }
.progress-bar.primary { background: var(--primary); }

/* =====================================================
   Badges
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF3E0; color: #E65100; }
.badge-danger { background: #FFEBEE; color: #C62828; }
.badge-info { background: #E3F2FD; color: #1565C0; }
.badge-primary { background: #E8F5E9; color: var(--primary); }

/* =====================================================
   Rating Stars
   ===================================================== */
.rating {
    display: flex;
    gap: 4px;
}

.rating i {
    font-size: 1.1rem;
}

.rating i.filled {
    color: var(--accent-dark);
}

.rating i.empty {
    color: #E0E0E0;
}

/* =====================================================
   Avatar
   ===================================================== */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-light);
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.85rem; }
.avatar-lg { width: 60px; height: 60px; font-size: 1.4rem; }

.avatar-primary { background: var(--primary); }
.avatar-secondary { background: #757575; }
.avatar-success { background: var(--success); }
.avatar-warning { background: var(--warning); }

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: var(--transition);
}

.pagination a {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.pagination a:hover {
    background: var(--bg-main);
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: var(--text-light);
}

.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* =====================================================
   Grid Layouts
   ===================================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col, [class*="col-"] {
    padding: 0 12px;
}

.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.33%; max-width: 33.33%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-8 { flex: 0 0 66.67%; max-width: 66.67%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* Responsive Columns */
@media (min-width: 576px) {
    .col-sm-2 { flex: 0 0 16.66%; max-width: 16.66%; }
    .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
    .col-sm-4 { flex: 0 0 33.33%; max-width: 33.33%; }
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .col-sm-8 { flex: 0 0 66.67%; max-width: 66.67%; }
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 768px) {
    .col-md-2 { flex: 0 0 16.66%; max-width: 16.66%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.33%; max-width: 33.33%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-8 { flex: 0 0 66.67%; max-width: 66.67%; }
    .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (min-width: 992px) {
    .col-lg-2 { flex: 0 0 16.66%; max-width: 16.66%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.33%; max-width: 33.33%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-8 { flex: 0 0 66.67%; max-width: 66.67%; }
    .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}

/* =====================================================
   Utilities
   ===================================================== */
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--error); }
.text-muted { color: var(--text-muted); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none; }

/* =====================================================
   Responsive Design
   ===================================================== */
@media (max-width: 1024px) {
    .col-3, .col-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .col-8 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block;
    }

    /* Full width on mobile for all column sizes */
    .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Reset responsive breakpoint classes */
    [class*="col-md-"], [class*="col-lg-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .top-header {
        padding: 0 15px;
    }

    .page-title {
        font-size: 1.1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content-wrapper {
        padding: 15px;
    }

    .datetime {
        display: none;
    }

    .user-name-small {
        display: none;
    }

    .stat-card {
        margin-bottom: 15px;
    }

    .table-container {
        font-size: 0.75rem;
    }

    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
    
    .progress-col {
        min-width: 45px;
        width: 45px;
    }
    
    .surah-col {
        white-space: nowrap;
    }
    
    .total-ayat-col {
        white-space: nowrap;
    }
    
    .table-star {
        font-size: 0.55rem !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    .card-body {
        padding: 15px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    /* Full width buttons on mobile */
    .btn-block {
        width: 100%;
        margin-bottom: 10px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: 8px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .page-header h2 {
        margin-bottom: 0;
    }

    .page-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .page-actions .btn {
        flex: 1;
        min-width: 120px;
    }

    .form-group .btn-lg {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Form controls mobile */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Card responsive */
    .card {
        margin-bottom: 15px;
    }

    /* Filter bar mobile */
    .filter-bar {
        padding: 15px;
    }

    .filter-row {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
        flex: none;
    }

    .filter-group .btn {
        width: 100%;
    }

    /* Stat cards mobile - 4 columns and ultra small size */
    .col:has(> .stat-card),
    [class*="col-"]:has(> .stat-card) {
        flex: 0 0 25% !important;
        max-width: 25% !important;
        padding: 0 4px !important;
    }
    
    .row:has(> [class*="col-"] > .stat-card) {
        margin: 0 -4px !important;
    }

    .stat-card {
        padding: 8px 4px;
        margin-bottom: 8px;
        border-radius: 8px;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .stat-card::before {
        width: 3px;
    }

    .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
        margin-bottom: 6px;
        border-radius: 6px;
        margin-left: auto;
        margin-right: auto;
    }

    .stat-value {
        font-size: 1rem;
        text-align: center;
    }
    
    .stat-label {
        font-size: 0.6rem;
        margin-top: 2px;
        text-align: center;
        line-height: 1.1;
        white-space: normal;
        word-break: break-word;
    }

    /* Modal mobile */
    .modal {
        width: 95%;
        max-width: none;
        margin: 10px;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Pagination mobile */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Raport mobile */
    .raport-container {
        margin: 0;
        border-radius: 0;
    }

    .raport-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .raport-student-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Avatar and user info mobile */
    .user-info {
        padding: 10px;
    }

    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    /* Info box mobile */
    .info-box {
        flex-direction: column;
        text-align: center;
    }

    /* Alert mobile */
    .alert {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    /* Form row mobile - all stacked */
    .row {
        margin: 0 -8px;
    }

    [class*="col-"] {
        padding: 0 8px;
        margin-bottom: 15px;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */
@media print {
    body, html {
        height: auto !important;
        overflow: visible !important;
    }

    .app-container, .main-content, .content-wrapper {
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }

    .sidebar,
    .top-header,
    .page-header,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 0;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    .raport-container {
        box-shadow: none !important;
    }
}

/* =====================================================
   Login Page Specific
   ===================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 40px;
    transform: translateY(0);
    animation: floatUp 0.8s ease-out forwards;
}

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

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.login-title {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =====================================================
   Empty State
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* =====================================================
   Password Toggle
   ===================================================== */
.toggle-password {
    transition: color 0.2s ease;
}

.toggle-password:hover {
    color: var(--primary) !important;
}


.empty-state h4 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
}

/* =====================================================
   Display Utilities (Responsive Layouts)
   ===================================================== */
.d-none { display: none !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-table { display: table !important; }
.d-table-cell { display: table-cell !important; }

/* Small Devices (≥576px) */
@media (min-width: 576px) {
    .d-sm-none { display: none !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-inline-block { display: inline-block !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
    .d-sm-table-cell { display: table-cell !important; }
}

/* Medium Devices (≥768px) */
@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-inline { display: inline !important; }
    .d-md-inline-block { display: inline-block !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
    .d-md-table-cell { display: table-cell !important; }
}

/* Large Devices (≥992px) */
@media (min-width: 992px) {
    .d-lg-none { display: none !important; }
    .d-lg-inline { display: inline !important; }
    .d-lg-inline-block { display: inline-block !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
    .d-lg-table-cell { display: table-cell !important; }
}

/* Extra Large Devices (≥1200px) */
@media (min-width: 1200px) {
    .d-xl-none { display: none !important; }
    .d-xl-inline { display: inline !important; }
    .d-xl-inline-block { display: inline-block !important; }
    .d-xl-block { display: block !important; }
    .d-xl-flex { display: flex !important; }
    .d-xl-table-cell { display: table-cell !important; }
}

/* =====================================================
   Rating Stars Utilities
   ===================================================== */
.rating .fa-star {
    font-size: 1.1rem;
    color: #E0E0E0;
    margin-right: 2px;
}
.rating .fa-star.filled {
    color: #FFD54F !important;
}

/* =====================================================
   Welcome Header (Siswa)
   ===================================================== */
.welcome-header-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}
.welcome-header-card .card-body {
    padding: 25px;
}
.welcome-title {
    color: white;
    margin-bottom: 5px;
}
.welcome-subtitle {
    opacity: 0.9;
    margin: 0;
}
.welcome-progress-percent {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}
.welcome-progress-label {
    opacity: 0.8;
}

@media (max-width: 768px) {
    .welcome-header-card .card-body {
        padding: 15px;
    }
    .welcome-title {
        font-size: 1.3rem;
    }
    .welcome-subtitle {
        font-size: 0.85rem;
    }
    .welcome-stats-col {
        text-align: left !important;
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid rgba(255,255,255,0.2);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .welcome-progress-percent {
        font-size: 2rem;
        margin-bottom: 0;
    }
}

.progress-col {
    min-width: 120px;
}

.table-star {
    font-size: 0.8rem;
}

/* =====================================================
   Kategori Hafalan Card
   ===================================================== */
.kategori-box {
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 15px;
}
.kategori-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}
.kategori-title {
    font-size: 1.5rem;
    margin-bottom: 5px;
}
.kategori-subtitle {
    margin: 0;
}
.kategori-stat-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

@media (max-width: 768px) {
    .kategori-card-body {
        padding: 15px;
    }
    .kategori-box {
        padding: 12px;
        border-radius: 10px;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: left;
    }
    .kategori-icon {
        font-size: 2rem;
        margin-bottom: 0;
    }
    .kategori-title {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }
    .kategori-subtitle {
        font-size: 0.85rem;
    }
    .kategori-stats {
        font-size: 0.85rem;
    }
    .kategori-stat-item {
        padding: 6px 0;
    }

    /* 3 stat cards row on mobile */
    .stat-row-3 .col {
        flex: 0 0 33.33% !important;
        max-width: 33.33% !important;
        padding: 0 4px !important;
    }
    .stat-row-3 .stat-card {
        padding: 8px !important;
    }
    .stat-row-3 .stat-icon {
        width: 25px !important;
        height: 25px !important;
        font-size: 0.8rem !important;
        margin-bottom: 5px !important;
    }
    .stat-row-3 .stat-value {
        font-size: 1rem !important;
    }
    .stat-row-3 .stat-label {
        font-size: 0.6rem !important;
        line-height: 1.1;
    }
    .stat-row-3 .progress {
        height: 4px !important;
        margin-bottom: 2px !important;
    }
    
    /* Riwayat Setoran Table on Mobile */
    .riwayat-table-header {
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 5px !important;
        padding: 10px !important;
    }
    .riwayat-table-header h3 {
        font-size: 0.95rem !important;
        white-space: nowrap;
        margin: 0;
    }
    .riwayat-table-header form {
        margin: 0 !important;
    }
    .riwayat-table-header form input {
        font-size: 0.75rem !important;
        padding: 4px 6px !important;
    }
    .riwayat-table th, .riwayat-table td {
        padding: 6px 4px !important;
        font-size: 0.7rem !important;
        line-height: 1.1;
    }
    .riwayat-table .rating .fa-star {
        font-size: 0.55rem !important;
        margin-right: 1px !important;
    }
    .riwayat-table .badge {
        font-size: 0.55rem !important;
        padding: 2px 4px !important;
        margin-top: 2px !important;
    }
    .riwayat-table .font-semibold {
        font-size: 0.75rem !important;
    }
}

/* =====================================================
   Raport Container (Fixed A4 Size)
   ===================================================== */
.raport-wrapper {
    overflow-x: auto;
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    text-align: center; /* Center the scaled content */
}

.raport-container {
    display: inline-block;
    text-align: left;
    width: 210mm;
    min-width: 794px;
    min-height: 297mm;
    padding: 15mm 10mm;
    margin: 0 auto;
    background: #fff;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    position: relative;
    color: #000;
}

@media screen and (max-width: 820px) {
    .raport-wrapper { padding: 10px 5px; } /* Reduce horizontal padding */
    .raport-container { zoom: 0.85; -moz-transform: scale(0.85); -moz-transform-origin: top center; }
}
@media screen and (max-width: 700px) {
    .raport-container { zoom: 0.74; -moz-transform: scale(0.74); }
}
@media screen and (max-width: 600px) {
    .raport-container { zoom: 0.61; -moz-transform: scale(0.61); }
}
@media screen and (max-width: 500px) {
    .raport-container { zoom: 0.55; -moz-transform: scale(0.55); }
}
@media screen and (max-width: 450px) {
    .raport-container { zoom: 0.48; -moz-transform: scale(0.48); }
}
@media screen and (max-width: 400px) {
    .raport-container { zoom: 0.44; -moz-transform: scale(0.44); }
}
@media screen and (max-width: 360px) {
    .raport-container { zoom: 0.39; -moz-transform: scale(0.39); }
}
@media screen and (max-width: 320px) {
    .raport-container { zoom: 0.34; -moz-transform: scale(0.34); }
}

@media print {
    .raport-wrapper {
        padding: 0;
        background: none;
        margin: 0;
        box-shadow: none;
    }
    .raport-container {
        width: 100%;
        min-width: auto;
        min-height: auto;
        box-shadow: none;
        padding: 0;
        margin: 0;
        display: block;
        zoom: 1;
        -moz-transform: none;
    }
}

/* Import Action Buttons */
.btn-import-outline {
    color: var(--primary);
    background: #e2e8f0;
    border: 1px solid var(--primary);
    font-weight: 600;
    transition: all var(--transition-fast);
}
.btn-import-outline:hover {
    background: var(--primary);
    color: var(--text-light);
}
.btn-import-accent {
    background: var(--accent);
    color: var(--primary-dark);
    border: 1px solid var(--accent);
    font-weight: 600;
    transition: all var(--transition-fast);
}
.btn-import-accent:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

/* Action Buttons for Desktop */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons button, .action-buttons a.action-btn {
    background: none;
    cursor: pointer;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
}

.action-buttons a.action-btn:hover, .action-buttons button:hover {
    opacity: 0.8;
}

/* Mobile Card View */
.student-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.student-card-mobile {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 15px;
}

.student-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.student-info-mobile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.student-info-mobile > div:not(.avatar) {
    min-width: 0;
}

.student-info-mobile .font-semibold {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.avatar-md {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
}

.student-card-stats {
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.stat-mini {
    text-align: center;
}

.stat-mini-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-mini-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.student-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.student-card-actions .btn {
    flex: 1;
    min-width: 80px;
    justify-content: center;
}

/* Mobile Pagination */
.pagination-mobile {
    padding: 15px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.pagination-mobile .pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pagination-mobile .pagination a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
}

.pagination-mobile .pagination a:hover {
    background: var(--primary-dark);
}

.pagination-info {
    font-weight: 600;
    color: var(--text-secondary);
}
