/* =============================================
   Aplikasi Administrasi Ujian
   SMKN 1 Cipeundeuy - Modern UI Design
   ============================================= */

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

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary: #7c3aed;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --dark: #1e1b4b;
    --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #312e81 50%, #3730a3 100%);
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 280px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4f46e5 60%, #7c3aed 100%);
    position: relative;
    overflow: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: floatDots 20s linear infinite;
}

@keyframes floatDots {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl), 0 0 40px rgba(79, 70, 229, 0.15);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.login-logo h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.login-logo p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.login-card .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-card .form-control {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.9rem;
    transition: var(--transition);
    background: #f8fafc;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background: #fff;
}

.login-card .input-group-text {
    border: 2px solid var(--border-color);
    border-right: none;
    border-radius: 10px 0 0 10px;
    background: #f8fafc;
    color: var(--text-secondary);
}

.login-card .input-group .form-control {
    border-left: none;
    border-radius: 0 10px 10px 0;
}

.btn-login {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 600;
    font-size: 1rem;
    color: #fff;
    width: 100%;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
    color: #fff;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1050;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.sidebar-header h5 {
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.sidebar-header small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

.sidebar-menu {
    padding: 16px 12px;
    list-style: none;
}

.sidebar-menu .menu-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 16px 16px 8px;
}

.sidebar-menu .menu-item {
    margin-bottom: 2px;
}

.sidebar-menu .menu-link {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    gap: 12px;
}

.sidebar-menu .menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-menu .menu-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-menu .menu-link i {
    width: 22px;
    text-align: center;
    font-size: 1rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* ===== TOP NAVBAR ===== */
.top-navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1040;
    padding-top: env(safe-area-inset-top, 0);
}

.top-navbar .page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.top-navbar .page-title small {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 400;
}

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

.navbar-user .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.navbar-user .user-info {
    text-align: right;
}

.navbar-user .user-info .user-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.navbar-user .user-info .user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 28px;
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    opacity: 0.08;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.stat-card.gradient-primary::after {
    background: var(--primary);
}

.stat-card.gradient-success::after {
    background: var(--success);
}

.stat-card.gradient-warning::after {
    background: var(--warning);
}

.stat-card.gradient-info::after {
    background: var(--info);
}

.stat-card.gradient-danger::after {
    background: var(--danger);
}

.stat-card.gradient-secondary::after {
    background: var(--secondary);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 16px;
}

.stat-icon.bg-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.stat-icon.bg-success {
    background: linear-gradient(135deg, #059669, var(--success));
}

.stat-icon.bg-warning {
    background: linear-gradient(135deg, #d97706, var(--warning));
}

.stat-icon.bg-info {
    background: linear-gradient(135deg, #2563eb, var(--info));
}

.stat-icon.bg-danger {
    background: linear-gradient(135deg, #dc2626, var(--danger));
}

.stat-icon.bg-secondary {
    background: linear-gradient(135deg, #6d28d9, var(--secondary));
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: var(--card-bg);
    transition: var(--transition);
}

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

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

.card-header h5 {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 24px;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 18px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--dark));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    border: none;
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    border: none;
    color: #fff;
}

.btn-info {
    background: linear-gradient(135deg, var(--info), #2563eb);
    border: none;
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    border: none;
    color: #fff;
}

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

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

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

.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
}

/* ===== TABLES ===== */
.table {
    font-size: 0.88rem;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* ===== BADGES ===== */
.badge {
    font-weight: 600;
    font-size: 0.73rem;
    padding: 5px 10px;
    border-radius: 6px;
}

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-status.bg-success::before {
    background: #fff;
}

.badge-status.bg-warning::before {
    background: #fff;
}

.badge-status.bg-danger::before {
    background: #fff;
}

/* ===== MODALS ===== */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 18px 24px;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-header .modal-title {
    font-weight: 700;
    font-size: 1rem;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ===== FORMS ===== */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.88rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* ===== WIZARD STEPS ===== */
.wizard-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
    gap: 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    position: relative;
}

.wizard-step::after {
    content: '';
    position: absolute;
    right: -20px;
    width: 40px;
    height: 2px;
    background: var(--border-color);
    top: 50%;
}

.wizard-step:last-child::after {
    display: none;
}

.wizard-step .step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition);
}

.wizard-step.active .step-number {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.wizard-step.completed .step-number {
    background: var(--success);
    color: #fff;
}

.wizard-step .step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.wizard-step.active .step-label {
    color: var(--primary);
}

.wizard-step.completed .step-label {
    color: var(--success);
}

/* ===== ALERTS ===== */
.alert {
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 0.88rem;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.1));
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    color: #92400e;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.1));
    color: #1e40af;
    border-left: 4px solid var(--info);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

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

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* ===== PHOTO GALLERY ===== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.photo-item {
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    aspect-ratio: 4/3;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.photo-item:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-lg);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item .photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 0.78rem;
}

/* ===== BERITA ACARA ===== */
.berita-acara-preview {
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.berita-acara-preview .header-ba {
    text-align: center;
    border-bottom: 3px double #333;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.berita-acara-preview .signature-section {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
}

.berita-acara-preview .signature-box {
    text-align: center;
    width: 250px;
}

.berita-acara-preview .signature-box img {
    width: 120px;
    height: 120px;
    margin: 8px 0;
}

/* ===== TOUCH & MOBILE BASE ===== */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .menu-link,
    .dropdown-toggle,
    .paginate_button {
        min-height: 44px;
        min-width: 44px;
    }

    .form-control,
    .form-select {
        font-size: 16px;
        /* prevents zoom on iOS */
    }

    .sidebar-menu .menu-link {
        min-height: 48px;
        padding: 14px 16px;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: min(var(--sidebar-width), 85vw);
        max-width: 280px;
    }

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

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

    .btn-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1049;
    }

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

    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }
}

@media (max-width: 767.98px) {
    .page-content {
        padding: 16px;
        padding-left: env(safe-area-inset-left, 16px);
        padding-right: env(safe-area-inset-right, 16px);
    }

    .top-navbar {
        padding: 0 12px 0 16px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        height: 56px;
    }

    .top-navbar .page-title {
        font-size: 1rem;
    }

    .top-navbar .page-title small {
        font-size: 0.7rem;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .card-header {
        padding: 14px 18px;
    }

    .card-body {
        padding: 18px;
    }

    .wizard-steps {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .wizard-step::after {
        display: none;
    }

    .navbar-user .user-info {
        display: none;
    }

    .berita-acara-preview {
        padding: 20px;
    }

    .table-responsive {
        font-size: 0.82rem;
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }

    .table-dashboard-guru thead th,
    .table-dashboard-guru tbody td,
    .table-monitoring-guru thead th,
    .table-monitoring-guru tbody td {
        font-size: 0.62rem;
        padding: 5px 6px;
    }

    .table-dashboard-guru .badge,
    .table-monitoring-guru .badge {
        font-size: 0.58rem;
        padding: 2px 5px;
    }

    .row.g-4 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
}

/* Layar kecil (smartphone 4-6 inch, lebar ~375-480px) */
@media (max-width: 575.98px) {
    body {
        padding-left: env(safe-area-inset-left, 0);
        padding-right: env(safe-area-inset-right, 0);
    }

    .login-card {
        margin: 12px;
        padding: 28px 20px;
        max-width: none;
    }

    .login-logo img {
        width: 64px;
        height: 64px;
    }

    .login-logo h4 {
        font-size: 1.1rem;
    }

    .login-logo p {
        font-size: 0.8rem;
    }

    .login-card .form-control {
        padding: 12px 14px;
    }

    .btn-login {
        padding: 14px;
    }

    .page-content {
        padding: 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .top-navbar {
        height: 52px;
        padding: 0 10px 0 12px;
        padding-left: max(10px, env(safe-area-inset-left));
    }

    .top-navbar .page-title {
        font-size: 0.9rem;
    }

    .top-navbar .page-title small {
        display: none;
    }

    .navbar-user .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
        margin-bottom: 12px;
    }

    .stat-card .stat-value {
        font-size: 1.35rem;
    }

    .stat-card .stat-label {
        font-size: 0.78rem;
    }

    .card-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: stretch;
    }

    .card-header h5 {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 14px;
    }

    .btn {
        padding: 10px 16px;
    }

    .btn-sm {
        padding: 8px 12px;
        min-height: 38px;
    }

    .table thead th,
    .table tbody td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .table-dashboard-guru {
        font-size: 0.6rem;
    }

    .table-dashboard-guru thead th,
    .table-dashboard-guru tbody td {
        padding: 4px 6px;
        font-size: 0.55rem;
    }

    .table-dashboard-guru thead th:nth-child(1),
    .table-dashboard-guru tbody td:nth-child(1) {
        width: 2rem;
        max-width: 2rem;
    }

    .table-dashboard-guru thead th:nth-child(2),
    .table-dashboard-guru tbody td:nth-child(2) {
        max-width: 90px;
    }

    .table-dashboard-guru thead th:nth-child(3),
    .table-dashboard-guru tbody td:nth-child(3) {
        width: 3.5rem;
        max-width: 3.5rem;
    }

    .table-dashboard-guru .badge {
        font-size: 0.5rem;
        padding: 2px 4px;
    }

    .modal-dialog {
        margin: 8px;
        max-width: calc(100% - 16px);
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }

    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .empty-state {
        padding: 32px 16px;
    }

    .empty-state i {
        font-size: 2.5rem;
    }

    .import-section {
        padding: 20px 16px;
    }

    .berita-acara-preview {
        padding: 16px;
    }

    .berita-acara-preview .signature-box {
        width: 180px;
    }

    .berita-acara-preview .signature-box img {
        width: 90px;
        height: 90px;
    }

    /* DataTables mobile: stack controls */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        margin-bottom: 10px;
    }

    .dataTables_wrapper .row {
        flex-direction: column;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        margin-top: 10px;
        text-align: center;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 8px 12px;
        margin: 2px;
    }
}

/* Layar sangat kecil (~320-400px, HP 4-5 inch) */
@media (max-width: 400px) {
    .login-card {
        margin: 8px;
        padding: 24px 16px;
    }

    .login-logo img {
        width: 56px;
        height: 56px;
    }

    .page-content {
        padding: 10px;
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }

    .top-navbar .page-title {
        font-size: 0.85rem;
    }

    .stat-card .stat-value {
        font-size: 1.25rem;
    }

    .stat-card .stat-label {
        font-size: 0.75rem;
    }

    .card-header h5 {
        font-size: 0.85rem;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    .table thead th,
    .table tbody td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .table-dashboard-guru thead th,
    .table-dashboard-guru tbody td {
        padding: 3px 5px;
        font-size: 0.5rem;
    }

    .table-dashboard-guru thead th:nth-child(1),
    .table-dashboard-guru tbody td:nth-child(1) {
        width: 3rem;
        max-width: 3rem;
    }

    .table-dashboard-guru thead th:nth-child(2),
    .table-dashboard-guru tbody td:nth-child(2) {
        max-width: 70px;
    }

    .table-dashboard-guru thead th:nth-child(3),
    .table-dashboard-guru tbody td:nth-child(3) {
        width: 3rem;
        max-width: 3rem;
    }

    .table-dashboard-guru .badge {
        font-size: 0.45rem;
        padding: 1px 3px;
    }

    .badge {
        font-size: 0.65rem;
        padding: 4px 8px;
    }

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

    .wizard-step {
        padding: 10px 16px;
    }

    .wizard-step .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .profile-dropdown .dropdown-menu {
        min-width: 180px;
        right: 0;
        left: auto;
    }
}

/* ===== DATATABLE OVERRIDES ===== */
.dataTables_wrapper .dataTables_filter input {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 36px 6px 12px; /* Ditambah padding dikanan (36px) agar panah tidak numpuk */
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

/* ===== ANIMATION UTILITIES ===== */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== DASHBOARD GURU: LEBAR KOLOM & HIGHLIGHT ===== */
.table-dashboard-guru {
    table-layout: fixed;
    width: 100%;
}

.table-dashboard-guru thead th:nth-child(1),
.table-dashboard-guru tbody td:nth-child(1) {
    width: 25%;
    max-width: 140px;
    text-align: left !important;
}

.table-dashboard-guru thead th:nth-child(2),
.table-dashboard-guru tbody td:nth-child(2) {
    width: 5rem;
    max-width: 5rem;
    text-align: center;
    white-space: nowrap;
}

.table-dashboard-guru thead th:nth-child(3),
.table-dashboard-guru tbody td:nth-child(3) {
    width: auto;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left !important;
}

/* Force Flex Start for Ruang Column Content (Desktop & Mobile) */
.table-dashboard-guru tbody td:nth-child(1) strong {
    display: flex;
    align-items: center;
    justify-content: flex-start !important;
    gap: 5px;
}

.table-dashboard-guru tbody tr.ruang-pengawas-saya,
.table-monitoring-guru tbody tr.ruang-pengawas-saya {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.06) 100%);
    border-left: 4px solid var(--success);
}

.table-dashboard-guru tbody tr.ruang-pengawas-saya:hover,
.table-monitoring-guru tbody tr.ruang-pengawas-saya:hover {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.table-dashboard-guru tbody tr.ruang-pengawas-saya td,
.table-monitoring-guru tbody tr.ruang-pengawas-saya td {
    font-weight: 500;
}

/* Chevron Rotation */
.table-dashboard-guru tbody tr[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

.table-dashboard-guru tbody tr .fa-chevron-down {
    transition: transform 0.3s ease;
}

/* Mobile Detail Padding Adjustment */
@media (max-width: 575.98px) {
    .table-dashboard-guru .collapse .p-3 {
        padding: 0.75rem !important;
        /* Reduce padding on mobile */
    }

    .table-dashboard-guru .collapse h6 {
        font-size: 0.8rem;
    }
}

/* ===== MONITORING TABLE ===== */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-indicator.done {
    background: var(--success);
}

.status-indicator.pending {
    background: var(--warning);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ===== IMPORT SECTION ===== */
.import-section {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.05), rgba(124, 58, 237, 0.05));
    border: 2px dashed var(--primary-light);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    margin-bottom: 24px;
    transition: var(--transition);
}

.import-section:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(124, 58, 237, 0.08));
}

.import-section i {
    font-size: 2rem;
    color: var(--primary-light);
    margin-bottom: 12px;
}

/* ===== PROFILE DROPDOWN ===== */
.profile-dropdown .dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 200px;
}

.profile-dropdown .dropdown-item {
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.profile-dropdown .dropdown-item:hover {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
}

.profile-dropdown .dropdown-divider {
    margin: 6px 0;
}

/* ===== MONITORING TABLE RESPONSIVE ===== */
.table-monitoring-guru {
    table-layout: fixed;
    width: 100%;
}

.table-monitoring-guru thead th:nth-child(1),
.table-monitoring-guru tbody td:nth-child(1) {
    width: 30%;
    /* RUANG */
}

.table-monitoring-guru thead th:nth-child(2),
.table-monitoring-guru tbody td:nth-child(2) {
    width: 20%;
    /* ABSENSI */
    text-align: center;
}

.table-monitoring-guru thead th:nth-child(3),
.table-monitoring-guru tbody td:nth-child(3) {
    width: 30%;
    /* BERITA ACARA */
    text-align: center;
}

.table-monitoring-guru thead th:nth-child(4),
.table-monitoring-guru tbody td:nth-child(4) {
    width: 20%;
    /* FOTO */
    text-align: center;
}

/* Mobile override for Monitoring Table */
@media (max-width: 575.98px) {
    .table-monitoring-guru {
        font-size: 0.6rem;
    }

    .table-monitoring-guru thead th,
    .table-monitoring-guru tbody td {
        padding: 4px 6px;
        font-size: 0.55rem;
    }

    /* RUANG */
    .table-monitoring-guru thead th:nth-child(1),
    .table-monitoring-guru tbody td:nth-child(1) {
        width: 35%;
        max-width: 35%;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ABSENSI */
    .table-monitoring-guru thead th:nth-child(2),
    .table-monitoring-guru tbody td:nth-child(2) {
        width: 20%;
        max-width: 20%;
    }

    /* BERITA ACARA */
    .table-monitoring-guru thead th:nth-child(3),
    .table-monitoring-guru tbody td:nth-child(3) {
        width: 25%;
        max-width: 25%;
    }

    /* FOTO */
    .table-monitoring-guru thead th:nth-child(4),
    .table-monitoring-guru tbody td:nth-child(4) {
        width: 20%;
        max-width: 20%;
    }

    .table-monitoring-guru .badge {
        font-size: 0.5rem;
        padding: 2px 4px;
        white-space: nowrap;
    }

    /* Hide text inside badges on very small screens if needed, or keep short */
    .table-monitoring-guru .badge i {
        display: none;
    }

    .btn-mobile-responsive {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        line-height: 1.2;
    }
}

@media (max-width: 480px) {
    .btn-mobile-responsive {
        font-size: 0.55rem !important;
        /* Extremely small for 4-6 inch screens */
        padding: 0.15rem 0.3rem !important;
        font-weight: 500;
        min-width: auto;
    }

    .btn-mobile-responsive i {
        font-size: 0.5rem !important;
        /* Scale icon down too */
    }
}

@media (max-width: 400px) {
    .table-monitoring-guru {
        font-size: 0.5rem;
        table-layout: fixed;
    }

    .table-dashboard-guru thead th,
    .table-dashboard-guru tbody td,
    .table-monitoring-guru thead th,
    .table-monitoring-guru tbody td {
        padding: 3px 5px !important;
        font-size: 0.5rem !important;
        vertical-align: middle !important;
        /* Ensure vertical center for both */
    }

    /* Column 1: Ruang (Matches Top Table Col 1 style + width adj) */
    .table-monitoring-guru thead th:nth-child(1),
    .table-monitoring-guru tbody td:nth-child(1) {
        width: 38%;
        max-width: 38%;
        white-space: normal;
        text-align: left;
    }

    /* Column 2: Absensi (Matches Top Table Col 3 style) */
    .table-monitoring-guru thead th:nth-child(2),
    .table-monitoring-guru tbody td:nth-child(2) {
        width: 22%;
        max-width: 22%;
        text-align: center;
    }

    /* Column 3: BA (Matches Top Table Col 3 style) */
    .table-monitoring-guru thead th:nth-child(3),
    .table-monitoring-guru tbody td:nth-child(3) {
        width: 26%;
        max-width: 26%;
        text-align: center;
    }

    /* Column 4: Foto (Matches Top Table Col 3 style) */
    .table-monitoring-guru thead th:nth-child(4),
    .table-monitoring-guru tbody td:nth-child(4) {
        width: 14%;
        max-width: 14%;
        text-align: center;
    }

    /* Badges: Strict matching with top table */
    .table-monitoring-guru .badge {
        font-size: 0.45rem !important;
        padding: 2px 4px !important;
        margin-left: 2px !important;
        display: inline-block;
        vertical-align: middle;
    }

    /* Flex alignment for room name + badge to match "Ruang 19 <badge>" style */
    .table-monitoring-guru td:nth-child(1) strong {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 3px;
        width: 100%;
    }

    /* Force Dashboard Table Alignment on Mobile - ALL COLUMNS LEFT */
    .table-dashboard-guru thead th,
    .table-dashboard-guru tbody td {
        text-align: left !important;
    }

    /* Fix flex alignment for Ruang column in Dashboard Table */
    .table-dashboard-guru tbody td:nth-child(1) strong {
        display: flex;
        align-items: center;
        justify-content: flex-start !important;
        /* Force left alignment */
        flex-wrap: wrap;
        gap: 3px;
    }
}