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

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #10b981;
    --dark: #0f172a;
    --light: #f8fafc;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Premium Glassmorphism Tokens */
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --glass-highlight: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--dark);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.1); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.5); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.8); }

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    box-shadow: var(--glass-highlight), var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-container { display: flex; min-height: 100vh; overflow-x: hidden; max-width: 100%; }

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 24px;
}

.sidebar-header h2 {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(to right, #60A5FA, #A78BFA, #F472B6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: #9CA3AF;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    margin: 4px 12px;
    border-radius: 10px;
}

.nav-item i { margin-right: 12px; font-size: 18px; transition: transform 0.3s; }

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left: none;
    transform: translateX(4px);
}

.nav-item:hover i { transform: scale(1.1); }

.nav-dropdown {
    cursor: pointer;
    position: relative;
}

.dropdown-menu {
    display: none;
    background: rgba(0,0,0,0.2);
    margin: 0 12px;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 20px 10px 48px;
    color: #9CA3AF;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.dropdown-item:hover, .dropdown-item.active {
    color: white;
    background: rgba(255,255,255,0.05);
}

.dropdown-item i {
    margin-right: 10px;
    font-size: 14px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    transition: all 0.3s ease;
    min-width: 0;
    max-width: calc(100vw - 260px);
    overflow-x: hidden;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    background: var(--glass-bg);
    padding: 16px 24px;
    border-radius: 20px;
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.top-header h1 { font-size: 28px; font-weight: 700; color: #1e293b; letter-spacing: -0.5px; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.8);
    padding: 6px 16px 6px 6px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.5);
    transition: all 0.3s;
}
.user-profile:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
    width: 100%;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}
.stat-card:hover::before { transform: translateX(100%); }
.stat-card:hover { transform: translateY(-8px); box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15); }

.stat-icon {
    width: 64px; height: 64px; border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: white;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.stat-icon.primary { background: linear-gradient(135deg, #6366f1, #a855f7); }
.stat-icon.success { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-icon.warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

.stat-details h3 { font-size: 15px; color: #475569; margin-bottom: 4px; font-weight: 600; }
.stat-details p { font-size: 32px; font-weight: 800; color: #0f172a; }

.table-container { width: 100%; overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 16px 20px; text-align: left; }
th { 
    font-weight: 600; color: #334155; 
    background: rgba(255,255,255,0.7);
    border-bottom: 2px solid rgba(0,0,0,0.05);
    text-transform: uppercase; font-size: 13px; letter-spacing: 0.5px;
}
td { border-bottom: 1px solid rgba(255,255,255,0.4); }
tr { transition: all 0.2s; }
tr:hover { background: rgba(255,255,255,0.9); transform: scale(1.005); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.form-group { margin-bottom: 24px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #334155; }
.form-control {
    width: 100%; padding: 12px 16px; border: 1px solid rgba(255,255,255,0.6);
    border-radius: 12px; background: rgba(255,255,255,0.7);
    transition: all 0.3s ease; font-size: 15px; color: #1e293b;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.form-control:focus { 
    outline: none; border-color: var(--primary); 
    background: white; box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
input[type="text"].form-control, textarea.form-control {
    text-transform: uppercase;
}
input[type="text"].form-control::placeholder, textarea.form-control::placeholder {
    text-transform: none;
}

.btn {
    padding: 12px 24px; border-radius: 12px; border: none; font-weight: 600;
    cursor: pointer; text-decoration: none; display: inline-flex;
    align-items: center; gap: 8px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px; position: relative; overflow: hidden;
}
.btn::after {
    content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0.2);
    opacity: 0; transition: opacity 0.3s;
}
.btn:hover::after { opacity: 1; }
.btn:hover { transform: translateY(-3px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: linear-gradient(135deg, var(--primary), #818CF8); color: white; box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #F87171); color: white; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.btn-secondary { background: linear-gradient(135deg, #64748b, #94a3b8); color: white; }
.btn-warning { background: linear-gradient(135deg, var(--warning), #FBBF24); color: white; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }

.badge { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; }
.badge-success { background: #D1FAE5; color: #065F46; border: 1px solid #34D399; }
.badge-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FBBF24; }
.badge-primary { background: #DBEAFE; color: #1E40AF; border: 1px solid #60A5FA; }
.badge-info { background: #E0F2FE; color: #0369A1; border: 1px solid #38BDF8; }

/* Premium Centered Login Layout */
.login-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh;
    background: url('https://images.unsplash.com/photo-1497366216548-37526070297c?auto=format&fit=crop&q=80') center/cover;
    background-attachment: fixed;
    margin: 0;
    padding: 20px;
}

.login-overlay { 
    position: absolute; inset: 0; 
    background: linear-gradient(135deg, rgba(15,23,42,0.8) 0%, rgba(30,27,75,0.85) 100%); 
    backdrop-filter: blur(8px); 
    z-index: 1;
}

.premium-glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 24px 40px -8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.login-box { 
    position: relative; 
    width: 100%; 
    max-width: 420px; 
    padding: 40px 32px; 
    z-index: 10; 
    border-radius: 24px; 
    animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.logo-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4), inset 0 2px 4px rgba(255,255,255,0.4);
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 { 
    color: white; font-size: 32px; margin-bottom: 8px; font-weight: 800; letter-spacing: 1px;
}
.login-header p { color: #cbd5e1; font-size: 15px; }

.login-alert {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    backdrop-filter: blur(4px);
    animation: shake 0.4s ease-in-out;
}

.premium-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.input-icon {
    position: absolute;
    left: 16px;
    color: #94a3b8;
    font-size: 16px;
    transition: color 0.3s ease;
    pointer-events: none;
}

.premium-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    color: white;
    font-size: 15px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.premium-input::placeholder {
    color: #94a3b8;
}

.premium-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: #818cf8;
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15);
    outline: none;
}

.premium-input:focus + .input-icon,
.premium-input:not(:placeholder-shown) ~ .input-icon {
    color: #818cf8;
}

.btn-premium {
    width: 100%;
    padding: 16px;
    margin-top: 8px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #818cf8, #6366f1);
}

.btn-premium i {
    transition: transform 0.3s ease;
}

.btn-premium:hover i {
    transform: translateX(4px);
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 480px) {
    .login-box {
        padding: 32px 24px;
        border-radius: 20px;
    }
}

.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.6);
    z-index: 90; backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s;
}

/* ==========================================
   LAYOUT UTILITIES
   ========================================== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

/* ==========================================
   MOBILE RESPONSIVE â€” max-width: 768p   ========================================== */
@media (max-width: 768px) {

    /* ---- Prevent Horizontal Overflow ---- */
    *, *::before, *::after { box-sizing: border-box; }
    html, body { overflow-x: hidden; width: 100%; }

    /* ---- Sidebar & Navigation ---- */
    .sidebar {
        transform: translateX(-100%);
        width: 75vw;
        max-width: 280px;
        overflow-y: auto;
    }
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay.active { display: block; opacity: 1; }

    /* ---- Main Content ---- */
    .main-content {
        margin-left: 0 !important;
        max-width: 100vw !important;
        padding: 12px;
        overflow-x: hidden;
        width: 100%;
    }

    /* ---- Hamburger Button ---- */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.5);
        border: 1px solid rgba(255,255,255,0.8);
        border-radius: 10px;
        font-size: 18px;
        width: 38px;
        height: 38px;
        min-width: 38px;
        color: var(--dark);
        cursor: pointer;
        transition: all 0.2s;
    }
    .mobile-menu-toggle:active { transform: scale(0.9); }

    /* ---- Top Header ---- */
    .top-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        margin-bottom: 16px;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    .top-header h1 {
        font-size: 17px;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .top-header-left {
        gap: 8px;
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    /* ---- User Profile  ---- */
    .user-profile { padding: 4px 10px 4px 4px; gap: 6px; flex-shrink: 0; }
    .user-profile img { width: 30px; height: 30px; border-radius: 50%; }
    .user-profile > div { font-size: 11px; }

    /* ---- Dashboard Stat Cards ---- */
    .dashboard-cards {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 14px;
        width: 100%;
    }
    .stat-card {
        padding: 14px;
        gap: 10px;
        flex-direction: column;
        align-items: flex-start;
    }
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 19px;
        border-radius: 12px;
    }
    .stat-details h3 { font-size: 12px; }
    .stat-details p { font-size: 24px; }

    /* ---- Glass Panel ---- */
    .glass-panel {
        border-radius: 12px;
        padding: 16px !important;
        margin-bottom: 14px !important;
    }

    /* ---- Chart Container ---- */
    .glass-panel > div[style*="height: 350px"] {
        height: 200px !important;
    }

    /* ---- Chart Filter Area ---- */
    .chart-header-wrap {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    .chart-header-wrap select { width: 100% !important; }

    /* ---- Tables ---- */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
        max-width: 100%;
    }
    /* Jangan paksa min-width di tabel - biarkan scroll alami */
    table { width: 100%; min-width: 480px; }
    th, td { padding: 9px 10px; font-size: 12px; }
    th { font-size: 11px; }

    /* ---- Buttons ---- */
    .btn {
        padding: 8px 12px;
        font-size: 12px;
        gap: 5px;
    }

    /* ---- Forms ---- */
    .form-grid { grid-template-columns: 1fr; }
    form .form-group { grid-column: span 1 !important; }

    /* ---- Detail grid Karyawan ---- */
    .detail-grid { grid-template-columns: 1fr !important; }

    /* ---- Flex Action Buttons ---- */
    div[style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
    }

    /* ---- Upload Area ---- */
    .upload-area-custom { padding: 28px 16px; }
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
        gap: 10px;
    }
}

/* ==========================================
   SMALL PHONES â€” max-width: 480px
   ========================================== */
@media (max-width: 480px) {
    .main-content { padding: 10px; }

    .dashboard-cards {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .stat-card { padding: 10px; gap: 8px; }
    .stat-icon { width: 38px; height: 38px; font-size: 16px; border-radius: 10px; }
    .stat-details h3 { font-size: 11px; }
    .stat-details p { font-size: 20px; }

    .top-header h1 { font-size: 15px; }
    .top-header { padding: 8px 10px; }

    /* Sembunyikan teks nama user â€” hanya tampilkan avatar */
    .user-profile > div:last-child { display: none; }
    .user-profile { padding: 3px; border-radius: 50%; }
    .user-profile img { width: 34px; height: 34px; }

    .btn { padding: 7px 10px; font-size: 11px; gap: 4px; }
    table { min-width: 380px; }
    th, td { padding: 7px 8px; font-size: 11px; }

    .glass-panel > div[style*="height: 350px"] {
        height: 170px !important;
    }

    .glass-panel { padding: 12px !important; }
}

.mobile-menu-toggle { display: none; }
