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

/* style.css - UI Modern (Light/Emerald) untuk Absensi YAPINK */
:root {
    --primary: #024731; /* SPMB Dark Green */
    --primary-hover: #036343;
    --primary-light: #0d9488;
    
    --bg-main: #f3f4f6; /* Lighter background */
    --bg-card: #ffffff;
    
    --text-main: #1f2937;
    --text-muted: #6b7280;
    
    --border-color: #e5e7eb;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -1px rgb(0 0 0 / 0.03);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
}

* {
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-main);
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Login Screen */
#login-screen {
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.card {
    background-color: var(--bg-card);
    padding: 2rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    border: 1px solid var(--border-color);
}

#login-screen .card {
    border-top: none;
    max-width: 400px;
    margin: 0 auto; /* Ensure it's centered if the parent doesn't handle it */
}

.card h1 {
    color: var(--text-main);
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.875rem;
    font-weight: 700;
    text-align: center;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    margin-bottom: 0.5rem;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: #94a3b8;
    width: 1.25rem;
    height: 1.25rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-input.with-icon {
    padding-left: 2.75rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-outline {
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    color: #334155;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.error-msg {
    color: var(--danger);
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    font-size: 0.875rem;
    min-height: 20px;
    display: none;
}
.error-msg:not(:empty) {
    display: block;
}

/* Dashboard Layout */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 280px;
    background-color: var(--primary); /* Dark Green */
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    border-right: none;
    color: white;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
}

.sidebar .logo span small {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: transparent;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-menu li {
    padding: 0.75rem 1.25rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-menu li svg {
    width: 1.25rem;
    height: 1.25rem;
}

.sidebar-menu li:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-menu li.active {
    background-color: var(--primary-hover); /* Lighter Green */
    color: white;
    font-weight: 600;
}

.main-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-color: var(--bg-main);
}

.navbar {
    display: flex;
    justify-content: flex-end; /* Align to right */
    align-items: center;
    padding: 1rem 2rem;
    background-color: var(--primary); /* Dark Green like SPMB */
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: none;
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tahun-ajaran-badge {
    background-color: var(--primary-hover);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.tahun-ajaran-badge .status-aktif {
    background: white;
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
}

.user-profile-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#user-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
}

.badge {
    background-color: white;
    color: var(--primary);
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 2px;
}

.main-content {
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 1.5rem;
}

.hero-card {
    background-color: #111827; /* Dark slate */
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: radial-gradient(circle at top right, rgba(2, 71, 49, 0.4), transparent 50%);
    pointer-events: none;
}

.hero-card .badge-top {
    background-color: rgba(2, 71, 49, 0.8);
    color: #34d399; /* emerald-400 */
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    display: inline-block;
    margin-bottom: 1rem;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.hero-card h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: white;
}

.hero-card p {
    color: #9ca3af; /* gray-400 */
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 1.5rem 0;
    max-width: 100%;
}

.hero-card .hero-actions {
    display: flex;
    gap: 1rem;
}

.hero-card .btn-hero {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hero-card .btn-hero:hover {
    background: rgba(255, 255, 255, 0.2);
}


.dashboard-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "title icon"
        "value icon"
        "desc icon";
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.stat-card .stat-icon {
    grid-area: icon;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: start;
}

.stat-card h3 {
    grid-area: title;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    grid-area: value;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-desc {
    grid-area: desc;
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.content-section {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.content-section h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background-color: #f8fafc;
}

.data-table tbody tr {
    transition: background-color 0.15s;
}

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

.status-in { color: var(--success); font-weight: 600; }
.status-out { color: var(--warning); font-weight: 600; }

/* Modal CSS */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(15, 23, 42, 0.5); /* backdrop blur-like */
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin-bottom: 0 !important;
}

.close-modal {
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-muted);
    margin-top: -5px;
    background: none;
    border: none;
    padding: 0;
}

.close-modal:hover {
    color: var(--danger);
}

/* Utilities for cards with flex inside */
.card-flex {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0;
    padding: 15px;
}

/* Responsive Design */
/* Responsive Design - Bottom Navigation for Mobile */
@media (max-width: 768px) {
    .layout-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 50;
        background-color: var(--bg-card);
        box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.05);
        transition: all 0.3s ease-in-out;
    }

    .sidebar .logo {
        display: none; /* Hide logo in bottom nav */
    }

    .hamburger-menu {
        display: flex !important;
        align-items: center;
        justify-content: center;
        color: white;
    }

    .tahun-ajaran-badge {
        display: none !important; /* Hide long text on mobile to save space */
    }

    .sidebar-menu {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        width: 100%;
        gap: 0;
        padding: 0;
        justify-content: space-around;
        scrollbar-width: none; 
        -ms-overflow-style: none;
    }
    .sidebar-menu::-webkit-scrollbar {
        display: none;
    }

    /* BOTTOM NAV (Not Expanded) */
    .sidebar:not(.expanded) {
        /* Bottom nav defaults */
    }
    .sidebar:not(.expanded) .sidebar-user-profile {
        display: none !important;
    }
    .sidebar:not(.expanded) .sidebar-menu li span {
        display: none !important; /* Hide text in bottom nav */
    }
    .sidebar:not(.expanded) .sidebar-menu li {
        color: #94a3b8; /* Inactive icon color */
    }
    .sidebar:not(.expanded) .sidebar-menu li.active {
        background-color: #e6f4ea; /* Light green bg */
        color: var(--primary);
        border-radius: 12px;
        margin: 0.25rem;
        padding: 0.5rem;
    }
    
    #btn-more-menu {
        display: flex !important; /* Keep Hamburger in bottom nav */
    }

    /* LEFT DRAWER (Expanded) */
    .sidebar.expanded {
        border-radius: 0;
        width: 280px;
        height: 100vh;
        top: 0;
        bottom: auto;
        background-color: var(--primary); /* Green drawer */
        box-shadow: 4px 0 15px rgba(0,0,0,0.3);
        display: flex;
        flex-direction: column;
        z-index: 9999;
    }

    .sidebar.expanded .logo {
        display: flex;
        padding: 1.5rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        justify-content: space-between;
        align-items: center;
        color: white;
    }

    .sidebar.expanded .sidebar-menu {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-y: auto;
        justify-content: flex-start;
        padding: 1rem 0;
    }

    .sidebar.expanded .sidebar-menu li {
        width: 100%;
        flex: none; /* Cegah merenggang vertikal */
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.85rem 1.5rem;
        font-size: 1rem;
        color: white;
    }

    .sidebar.expanded .sidebar-menu li span {
        display: inline !important; /* Show text */
        margin-left: 1rem;
    }

    .sidebar.expanded .sidebar-menu li.active {
        background-color: rgba(255,255,255,0.1);
        border-radius: 8px;
        margin: 0.25rem 1rem;
        width: auto;
    }

    .sidebar.expanded .sidebar-close-btn {
        display: flex !important;
    }

    .sidebar.expanded #btn-more-menu {
        display: none !important; /* Hide bottom-nav hamburger when drawer is open */
    }

    .sidebar.expanded .sidebar-user-profile {
        display: flex !important;
        margin-top: auto;
        margin-bottom: 2rem;
        margin-left: 1rem;
        margin-right: 1rem;
        padding: 1rem;
        background: rgba(0,0,0,0.2);
        border-radius: 8px;
        align-items: center;
        gap: 1rem;
        color: white;
    }

    .sidebar-user-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--primary-light, #0d9488);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        color: white;
    }

    .sidebar-menu li {
        margin-bottom: 0;
        white-space: nowrap;
        flex: 1;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 0.75rem 0.25rem;
        font-size: 0.65rem;
        gap: 0.25rem;
        border-radius: 0;
        cursor: pointer;
    }

    .sidebar-menu li svg {
        width: 1.5rem;
        height: 1.5rem;
    }

    .main-content-wrapper {
        padding-bottom: 70px; /* Make space for bottom nav */
    }

    .navbar {
        padding: 1rem;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }

    .content-section .card, 
    .content-section > div[style*="display: flex"], 
    .content-section > div[style*="display:flex"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .form-input {
        width: 100% !important;
        min-width: 100% !important;
    }

    .main-content, .content-section {
        min-width: 0; /* Prevents flex children from bursting out */
    }

    /* Force tables to be fully scrollable inside their containers */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Add shadow hints for scrolling left/right */
        background: 
            linear-gradient(to right, white 30%, rgba(255,255,255,0)),
            linear-gradient(to right, rgba(255,255,255,0), white 70%) 100% 0,
            radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.15), rgba(0,0,0,0)),
            radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.15), rgba(0,0,0,0)) 100% 0;
        background-repeat: no-repeat;
        background-color: white;
        background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        background-attachment: local, local, scroll, scroll;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem; /* Reduce gap on mobile to fit 2 columns better */
    }
}

.sidebar-user-profile {
    display: flex;
    margin-top: auto;
    margin-bottom: 1rem;
    margin-left: 1rem;
    margin-right: 1rem;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    align-items: center;
    gap: 1rem;
    color: white;
}
.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0d9488;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

/* Matrix Schedule Stickiness */
#tab-pemetaan-jadwal .data-table th { position: sticky; top: 0; z-index: 10; background-color: var(--primary); color: white; }
.sticky-col-1 { position: sticky; left: 0; z-index: 5; background-color: white; border-right: 1px solid #ddd; font-weight: bold; width: 100px; min-width: 100px; max-width: 100px; box-sizing: border-box; }
.sticky-col-2 { position: sticky; left: 100px; z-index: 5; background-color: white; border-right: 2px solid var(--primary-light); width: 120px; min-width: 120px; max-width: 120px; box-sizing: border-box; }


/* Stats Header Mobile Centering */
.stats-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.stats-section-header h2 {
    margin: 0;
}
.stats-section-header input[type="date"] {
    width: auto;
    margin: 0;
}
@media (max-width: 768px) {
    .stats-section-header {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
}

/* --- READONLY MASTER DATA IN ADMS --- */

