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

:root {
    /* Colors */
    --primary: #1B5E20; /* dark green */
    --secondary: #4CAF50; /* green */
    --accent: #FFD700; /* gold */
    
    /* Layout */
    --sidebar-width: 260px;
    --header-height: 60px;
    
    /* Light Theme Content */
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    
    /* Base Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* Login Page */
.login-page {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a1a0a 0%, #1a2e1a 100%);
}

.login-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    color: white;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}
.login-card h2 { margin-bottom: 20px; color: var(--accent); }

.login-card .form-group {
    margin-bottom: 20px;
    text-align: left;
}
.login-card label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.login-card input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.05);
    color: white;
    border-radius: var(--radius-md);
    transition: all 0.3s;
}
.login-card input:focus {
    outline: none;
    border-color: var(--secondary);
    background: rgba(255,255,255,0.1);
}
.login-card .btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}
.login-card .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* Admin Layout */
.admin-layout, .admin-wrapper {
    display: block !important;
    min-height: 100vh;
    width: 100%;
    position: relative !important;
    background: #f4f6f9;
}

/* Sidebar */
.sidebar {
    width: 250px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    background: #1a1a1a !important;
    color: white !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
    transition: transform 0.3s ease;
    box-sizing: border-box !important;
}

.sidebar-header, .sidebar-logo {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}
.sidebar-header img, .sidebar-logo img { max-width: 60px; height: auto; }
.sidebar-header h3, .sidebar-logo h3 { font-size: 1.1rem; color: var(--accent); margin-top: 10px; }

.sidebar-nav {
    padding: 15px 0;
}
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    transition: 0.3s;
    border-left: 3px solid transparent;
}
.sidebar-nav a i { margin-right: 15px; width: 20px; text-align: center; }
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(255,255,255,0.05);
    color: white;
    border-left-color: var(--accent);
}

/* Main Content Wrapper */
.main-wrapper, .main-content {
    margin-left: 250px !important;
    width: calc(100% - 250px) !important;
    min-height: 100vh !important;
    background: #f4f6f9 !important;
    box-sizing: border-box !important;
    display: block !important;
}

/* Topbar */
.topbar {
    height: var(--header-height);
    background: var(--bg-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 90;
}
.sidebar-toggler {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}
.topbar-right { display: flex; align-items: center; gap: 20px; }
.btn-logout {
    color: #e74c3c;
    font-weight: 500;
}

/* Content Area */
.main-content {
    padding: 30px;
    flex: 1;
}
.page-title { margin-bottom: 25px; font-size: 1.5rem; font-weight: 600; }

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    border-left: 4px solid var(--primary);
}
.stat-card:nth-child(2) { border-left-color: #2196F3; }
.stat-card:nth-child(3) { border-left-color: var(--accent); }
.stat-card:nth-child(4) { border-left-color: #e74c3c; }

.stat-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    opacity: 0.5;
    margin-right: 20px;
}
.stat-info h4 { font-size: 1.8rem; margin: 0; }
.stat-info p { color: var(--text-muted); font-size: 0.9rem; margin: 0; }

/* Data Tables */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    overflow: hidden;
    margin-bottom: 30px;
}
.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    background: var(--primary);
    color: white;
    font-weight: 500;
}
.data-table tr:hover { background: #f9f9f9; }

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #144d18; }
.btn-accent { background: var(--accent); color: #000; }
.btn-accent:hover { background: #e6c200; }
.btn-info { background: #2196F3; color: white; }
.btn-danger { background: #e74c3c; color: white; }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; margin-bottom: 8px; font-weight: 500; }
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    transition: 0.3s;
}
.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(76,175,80,0.1);
}
textarea.form-control { min-height: 100px; resize: vertical; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-md);
    transform: translateY(-20px);
    transition: 0.3s;
}
.modal-overlay.active .modal-card { transform: translateY(0); }
.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; }
.modal-body { padding: 20px; }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    position: relative;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #4CAF50; }
.alert-error { background: #ffebee; color: #c62828; border-left: 4px solid #f44336; }

/* Images & Badges */
.img-preview {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}
.badge {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-aktif { background: #e8f5e9; color: #2e7d32; }
.badge-nonaktif { background: #ffebee; color: #c62828; }

/* Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Global Table Mobile Responsiveness */
table {
    width: 100%;
    border-collapse: collapse;
}

/* Responsive */
@media (max-width: 992px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
    .admin-wrapper { display: block !important; }
    .sidebar { width: 100% !important; position: relative !important; height: auto !important; transform: none !important; }
    .main-wrapper, .main-content { margin-left: 0 !important; width: 100% !important; }
    .sidebar-toggler { display: none; }
    
    .topbar { padding: 15px !important; flex-direction: column; gap: 10px; text-align: center; height: auto !important; }
    .main-content { padding: 15px !important; }
    .stats-grid { grid-template-columns: 1fr !important; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .card-header .btn-add { width: 100%; text-align: center; }

    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .login-card { padding: 25px 20px; }
    .topbar-right { gap: 10px; font-size: 0.85rem; flex-wrap: wrap; justify-content: center; }
}
