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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #10b981;
    --accent: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--background);
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

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

body {
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('batik_kawung.png');
    background-size: 250px;
    background-repeat: repeat;
    opacity: 0.15;
    filter: blur(0.5px);
    z-index: -1;
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Glassmorphism Components */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
    padding: 2rem;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 1.5rem;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent),
                radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent);
}

.login-card {
    width: 100%;
    max-width: 450px;
    animation: fadeIn 0.8s ease-out;
}

.brand-logo {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
    text-align: center;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.btn {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

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

.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.nav-item i {
    margin-right: 1rem;
    font-size: 1.25rem;
}

.nav-item:hover, .nav-item.active {
    background: #f1f5f9;
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

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

.stat-card {
    padding: 1.5rem;
    border-radius: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Data Table */
.table-container {
    overflow-x: auto;
    margin-top: 2rem;
}
/* Filters & Actions Bar */
.table-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
    background: var(--surface);
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.search-input-group {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input-group .form-input {
    padding-left: 2.75rem;
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.filter-select {
    padding: 0.6rem 2rem 0.6rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

.page-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link:hover:not(.active) {
    background: var(--surface-hover);
    border-color: var(--primary-light);
}

/* Sortable Headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem !important;
}

th.sortable::after {
    content: '\f0dc';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.5;
}

th.sortable.asc::after {
    content: '\f0de';
    color: var(--primary);
    opacity: 1;
}

th.sortable.desc::after {
    content: '\f0dd';
    color: var(--primary);
    opacity: 1;
}

/* Action Buttons */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.action-btn:hover {
    background: var(--surface-hover);
    color: var(--primary);
    border-color: var(--primary-light);
}

.action-btn.btn-view:hover { color: #3b82f6; border-color: rgba(59, 130, 246, 0.3); background: rgba(59, 130, 246, 0.05); }
.action-btn.btn-edit:hover { color: #f59e0b; border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.05); }
.action-btn.btn-delete:hover { color: #ef4444; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.05); }
.action-btn.btn-toggle:hover { color: #10b981; border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.05); }

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}
.status-online { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1); }
.status-offline { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); }

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

th {
    text-align: left;
    padding: 1.25rem 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
    vertical-align: middle;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-approved { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.status-pending { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-rejected { background: rgba(244, 63, 94, 0.1); color: #f43f5e; }

/* Responsive Utilities */
.mobile-only { display: none !important; }
.desktop-only { display: block; }

@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 2rem 0.75rem; }
    .sidebar .nav-text { display: none; }
    .main-content { margin-left: 80px; }
}

/* Mobile App Styling */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }

    /* Native App Styling for Admin/Head/GM */
    body:not(.role-user) .sidebar { 
        display: none !important; 
    }
    
    body:not(.role-user) .mobile-menu-btn { 
        display: none !important; 
    }

    body:not(.role-user) .main-content { 
        margin-left: 0; 
        padding: 1rem 1rem 5rem 1rem !important; 
        width: 100%;
        max-width: 100vw;
    }
    
    /* Original Web Styling for User (Karyawan) */
    body.role-user .sidebar { 
        transform: translateX(-100%);
        width: 280px; 
        padding: 2rem 1.5rem;
        transition: transform 0.3s ease;
        z-index: 1000;
        display: flex;
    }
    body.role-user .sidebar.active {
        transform: translateX(0);
    }
    body.role-user .sidebar .nav-text { display: inline-block; }
    body.role-user .main-content { margin-left: 0; padding: 1rem !important; }
    body.role-user .mobile-bottom-nav { display: none !important; }
    
    /* Native App Bottom Navigation Bar */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 -5px 15px rgba(0,0,0,0.05);
        justify-content: space-around;
        align-items: center;
        z-index: 1000;
        padding-bottom: env(safe-area-inset-bottom, 0px); /* For iOS notch */
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-muted);
        width: 25%;
        height: 100%;
        transition: all 0.2s ease;
    }

    .mobile-nav-item i {
        font-size: 1.25rem;
        margin-bottom: 0.2rem;
        transition: transform 0.2s;
    }

    .mobile-nav-item span {
        font-size: 0.65rem;
        font-weight: 600;
    }

    .mobile-nav-item.active {
        color: var(--primary);
    }
    
    .mobile-nav-item.active i {
        transform: translateY(-2px);
    }

    /* Floating Action Button inside Bottom Nav (Optional, usually centered) */
    .mobile-nav-fab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: white;
        background: linear-gradient(135deg, var(--primary), var(--primary-hover));
        width: 50px;
        height: 50px;
        border-radius: 50%;
        transform: translateY(-15px);
        box-shadow: 0 5px 15px rgba(79, 70, 229, 0.4);
        border: 4px solid var(--background);
        z-index: 1001;
    }

    .mobile-nav-fab i {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    /* Tweaks for a more native feel */
    body {
        -webkit-tap-highlight-color: transparent;
    }
    
    .glass-card {
        border-radius: 1rem;
        padding: 1.25rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 10px rgba(0,0,0,0.03);
        border: 1px solid rgba(0,0,0,0.05);
    }
    
    .page-title h1 {
        font-size: 1.5rem !important;
    }
}
