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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.5);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

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

body {
    background: #0f172a;
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Background gradient mesh sama dengan beranda/login */
.bg-gradient-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 15% 50%, rgba(168, 85, 247, 0.2), transparent 35%),
                radial-gradient(circle at 85% 30%, rgba(56, 189, 248, 0.2), transparent 35%),
                radial-gradient(circle at 40% 80%, rgba(236, 72, 153, 0.1), transparent 40%);
    z-index: -2;
    pointer-events: none;
}

.bg-gradient-mesh::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJmIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iLjY1IiBudW1PY3RhdmVzPSIzIiAvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNmKSIgb3BhY2l0eT0iMC4wNCIgLz48L3N2Zz4=');
    background-repeat: repeat;
    opacity: 0.3;
    pointer-events: none;
}

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

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100%; /* Better than 100vh for mobile */
    max-height: 100dvh;
    z-index: 10;
    overflow-y: auto; /* Allow scrolling if items are too tall */
    padding-bottom: 5rem; /* Extra padding to ensure bottom items aren't hidden behind browser UI */
}

.sidebar-header {
    text-align: center;
    margin-bottom: 3rem;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

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

.nav-item.active {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.nav-item.active i {
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2.5rem 3rem;
}

/* Header Navbar (Top) */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--card-bg);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: var(--glass-border);
    backdrop-filter: blur(10px);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 0 15px var(--accent-glow);
}

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

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

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Dashboard Cards Layout */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Glass Card */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.glass-card:hover::before {
    opacity: 1;
}

.metric-title {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-title i {
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0.8;
}

.metric-value {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

/* Recent Activity Section */
.content-section {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
}

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

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Micro animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* Table Responsive Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 20px;
}

/* Placeholder Table for visual richness */
.beautiful-table {
    width: 100%;
    border-collapse: collapse;
}

.beautiful-table th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.beautiful-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.beautiful-table tr {
    transition: background 0.3s ease;
}

.beautiful-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-warning { background: rgba(234, 179, 8, 0.15); color: #fde047; border: 1px solid rgba(234, 179, 8, 0.3); }

/* Logout Form Button */
.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    width: 100%;
    text-align: left;
}
.logout-btn:focus { outline: none; }

/* Responsive Design */

/* Mobile Header Toggle */
.mobile-toggle {
    display: none;
    font-size: 1.8rem;
    color: var(--text-main);
    cursor: pointer;
    background: transparent;
    border: none;
    outline: none;
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 250px;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1.5rem;
        width: 100%;
        transition: margin 0.3s ease;
    }
    
    .mobile-toggle {
        display: block;
        margin-right: 15px;
    }

    .top-navbar {
        justify-content: flex-start;
    }

    .page-title {
        flex: 1;
        font-size: 1.4rem;
    }
    
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .metric-value {
        font-size: 2.5rem;
    }
}

@media (max-width: 576px) {
    .user-name, .user-role {
        display: none;
    }
    
    .user-profile {
        padding: 0;
        background: transparent;
        border: none;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .page-title {
        font-size: 1.2rem;
    }
}

/* =========================================================================
   Forms & Inputs (Beautiful Glassmorphism Forms)
   ========================================================================= */

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
    width: 100%;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.form-group label i {
    margin-right: 0.4rem;
    color: var(--accent);
}

.form-control {
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.form-control::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

.form-control:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Fix select option colors */
select.form-control option {
    background-color: var(--bg-secondary);
    color: var(--text-main);
}

select.form-control:focus option {
    background-color: var(--bg-secondary);
}

/* Chrome autofill styling fix for dark mode */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px var(--bg-secondary) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: none;
    letter-spacing: 0.3px;
}

.btn i {
    font-size: 1.2rem;
}

.btn:active {
    transform: translateY(2px) scale(0.98);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.8rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.btn-primary i {
    font-size: 1.25rem;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px var(--accent-glow);
}

/* Responsiveness adjustments for forms */
@media (max-width: 768px) {
    .form-group[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin-top: 1.5rem !important;
    }
}
