/* =========================================
   UD RISMA MAJU - FULL RESPONSIVE
   Optimized for PC & Mobile (Android/iOS)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #d1fae5;
    --secondary: #f59e0b;
    --accent: #06b6d4;
    --dark: #1f2937;
    --light: #f3f4f6;
    --white: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #e5e7eb;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

/* === BASE === */
html { scroll-behavior: smooth; }
body {
    font-family: 'Poppins', sans-serif;
    background: var(--light);
    color: var(--dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.6;
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 270px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 10px; }

.sidebar-header {
    padding: 28px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.05);
}
.sidebar-header i { font-size: 42px; margin-bottom: 8px; display: block; }
.sidebar-header h3 { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }

.menu-item {
    padding: 14px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
    font-size: 14px;
    font-weight: 500;
}
.menu-item:hover {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--secondary);
    padding-left: 26px;
}
.menu-item.active {
    background: rgba(255,255,255,0.18);
    color: white;
    border-left-color: var(--secondary);
    font-weight: 600;
}
.menu-item i { width: 22px; text-align: center; font-size: 16px; }

/* === MAIN CONTENT === */
.main-content {
    margin-left: 270px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - 270px);
    transition: margin 0.3s ease, width 0.3s ease;
    background: var(--light);
}

.header {
    background: var(--white);
    padding: 16px 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header h2 { font-size: 22px; font-weight: 700; color: var(--dark); }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.content-wrapper { flex: 1; padding: 28px; }

/* === STATS GRID === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 22px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px;
    display: flex; align-items: center; gap: 18px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.info { border-left-color: var(--info); }
.stat-icon {
    width: 55px; height: 55px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: white;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    flex-shrink: 0;
}
.stat-card.success .stat-icon { background: linear-gradient(135deg, var(--success), #34d399); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, var(--warning), #fbbf24); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, var(--info), #60a5fa); }
.stat-content h3 { font-size: 26px; color: var(--dark); font-weight: 700; margin-bottom: 3px; }
.stat-content p { color: #6b7280; font-size: 13px; font-weight: 500; }

/* === DASHBOARD GRID (2 Kolom di PC) === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 22px;
}

/* === CARDS === */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    background: linear-gradient(to right, #fafafa, #ffffff);
}
.card-header h3 { font-size: 17px; color: var(--dark); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card-header h3 i { color: var(--primary); }
.card-body { padding: 24px; }

/* === TABLES === */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
.table { width: 100%; border-collapse: collapse; min-width: 650px; }
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: var(--light); font-weight: 600; color: var(--dark); text-transform: uppercase; letter-spacing: 0.5px; font-size: 12px; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: #f9fafb; }
.table tbody tr:last-child td { border-bottom: none; }

/* === BADGES === */
.badge { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; display: inline-block; }
.badge-success { background: var(--primary-light); color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }

/* === BUTTONS === */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-family: 'Poppins', sans-serif;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); }
.btn-warning { background: linear-gradient(135deg, var(--secondary), #d97706); }
.btn-sm { padding: 7px 12px; font-size: 12px; min-width: 36px; justify-content: center; }
.action-btn { min-width: 36px; min-height: 36px; padding: 8px; }

/* === FORMS === */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 600; color: var(--dark); font-size: 14px; }
.form-control {
    width: 100%; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; transition: all 0.2s; font-family: 'Poppins', sans-serif;
    background: #fafafa;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(16,185,129,0.1); background: white; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* === MODAL === */
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
    animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
    background: white; padding: 28px; border-radius: 16px;
    width: 92%; max-width: 550px; max-height: 90vh; overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 22px; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 20px; color: var(--dark); font-weight: 700; }
.close { cursor: pointer; font-size: 26px; color: #9ca3af; transition: 0.2s; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.close:hover { color: var(--danger); background: #fee2e2; }
.modal-footer { margin-top: 24px; display: flex; justify-content: flex-end; gap: 12px; }

/* === ALERT === */
.alert { padding: 14px 18px; margin-bottom: 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.alert-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-success { background: var(--primary-light); color: #065f46; border-left: 4px solid var(--success); }

/* === FOOTER === */
.site-footer {
    text-align: center; padding: 18px 20px; background: var(--white); border-top: 1px solid var(--border);
    color: #6b7280; font-size: 13px; width: 100%; margin-top: auto; font-weight: 500;
}
.site-footer span { color: var(--primary); font-weight: 700; }

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-page {
    display: flex; justify-content: center; align-items: center; min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--accent) 100%);
    position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; width: 300px; height: 300px;
    background: rgba(255,255,255,0.1); border-radius: 50%;
    top: -50px; right: -50px;
}
.login-page::after {
    content: ''; position: absolute; width: 200px; height: 200px;
    background: rgba(255,255,255,0.05); border-radius: 50%;
    bottom: -30px; left: -30px;
}
.login-box {
    background: white; border-radius: 20px; box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    width: 100%; max-width: 420px; padding: 36px; position: relative; z-index: 5;
    animation: fadeInUp 0.5s;
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.login-header { text-align: center; margin-bottom: 28px; }
.login-header i { font-size: 56px; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 12px; display: inline-block; }
.login-header h2 { font-size: 26px; color: var(--dark); margin-bottom: 6px; font-weight: 700; }
.login-header p { color: #6b7280; font-size: 14px; }
.btn-login { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border: none; border-radius: var(--radius-sm); font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 12px; transition: 0.2s; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,185,129,0.4); }

/* =========================================
   PUBLIC PAGE (PENGUNJUNG)
   ========================================= */
.public-page { background: var(--white); }
.navbar { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; padding: 16px 0; position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.navbar .container { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.nav-brand { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.nav-menu { display: flex; gap: 22px; align-items: center; }
.nav-menu a { color: white; text-decoration: none; font-weight: 500; transition: 0.2s; }
.nav-menu a:hover { opacity: 0.85; }
.btn-login-nav { background: rgba(255,255,255,0.2); padding: 9px 20px; border-radius: 25px; border: 2px solid white; }

.hero { background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); color: white; padding: 90px 20px; text-align: center; }
.hero h1 { font-size: 40px; margin-bottom: 18px; font-weight: 700; }
.hero p { font-size: 17px; opacity: 0.95; max-width: 600px; margin: 0 auto 28px; }
.btn-hero { display: inline-block; background: white; color: var(--primary); padding: 14px 36px; border-radius: 30px; text-decoration: none; font-weight: 700; transition: 0.3s; box-shadow: 0 8px 20px rgba(0,0,0,0.15); }
.btn-hero:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.2); }

.products-section { padding: 70px 20px; max-width: 1200px; margin: 0 auto; background: var(--light); }
.section-header { text-align: center; margin-bottom: 45px; }
.section-header h2 { font-size: 32px; color: var(--dark); font-weight: 700; margin-bottom: 8px; }
.section-header p { color: #6b7280; font-size: 15px; }
.filter-bar { display: flex; gap: 10px; justify-content: center; margin-bottom: 35px; flex-wrap: wrap; }
.filter-btn { padding: 10px 22px; border: 2px solid var(--primary); background: white; color: var(--primary); border-radius: 25px; cursor: pointer; font-weight: 600; transition: 0.2s; font-family: 'Poppins', sans-serif; }
.filter-btn.active, .filter-btn:hover { background: var(--primary); color: white; transform: translateY(-2px); }

.product-grid { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 22px; padding: 12px 8px 28px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.product-grid::-webkit-scrollbar { height: 6px; }
.product-grid::-webkit-scrollbar-track { background: #e5e7eb; border-radius: 10px; }
.product-grid::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }
.product-card { flex: 0 0 270px; min-width: 270px; scroll-snap-align: start; background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: 0.3s; }
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.product-image { background: linear-gradient(135deg, var(--primary), var(--accent)); height: 150px; display: flex; align-items: center; justify-content: center; font-size: 55px; color: white; }
.product-info { padding: 22px; }
.product-info h3 { font-size: 17px; color: var(--dark); margin-bottom: 6px; font-weight: 600; }
.price-value { font-size: 22px; font-weight: 700; color: var(--primary); margin: 8px 0; }
.stok-value.low { color: var(--danger); font-weight: 700; }

.about-section, .contact-section { padding: 70px 20px; max-width: 1000px; margin: 0 auto; }
.contact-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 35px; }
.contact-item { display: flex; gap: 16px; padding: 22px; background: white; border-radius: var(--radius); box-shadow: var(--shadow); transition: 0.3s; }
.contact-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.contact-item i { font-size: 28px; color: var(--primary); flex-shrink: 0; }

/* =========================================
   OPTIMASI KHUSUS HP (ANDROID/iOS)
   ========================================= */

@media (max-width: 768px) {
    /* 1. SIDEBAR: Mode Overlay (Menumpuk di atas, bukan mendorong konten) */
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
        z-index: 1001; /* Pastikan paling atas */
    }
    .sidebar.active {
        transform: translateX(0);
    }

    /* 2. MAIN CONTENT: Full Lebar */
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* 3. HEADER: Hemat Ruang */
    .header {
        padding: 12px 15px; /* Perkecil padding */
    }
    .header h2 {
        font-size: 18px; /* Perkecil judul */
    }
    .user-info {
        display: none; /* Sembunyikan profil di HP agar header tidak penuh */
    }

    /* 4. CONTENT WRAPPER: Hemat Ruang */
    .content-wrapper {
        padding: 15px; /* Padding kecil agar konten luas */
    }

    /* 5. STATS CARD: Stack Vertikal */
    .stats-grid {
        grid-template-columns: 1fr; /* 1 Kolom */
        gap: 12px;
    }
    .stat-card {
        padding: 15px;
    }
    .stat-icon {
        width: 45px; height: 45px;
        font-size: 20px;
    }
    .stat-content h3 {
        font-size: 20px;
    }

    /* 6. DASHBOARD GRID: Form & Tabel Bertumpuk */
    .dashboard-grid {
        grid-template-columns: 1fr !important; /* Paksa 1 Kolom */
        gap: 15px;
    }

    /* 7. CARD & FORM: Rapi */
    .card {
        margin-bottom: 15px;
        border-radius: 10px;
    }
    .card-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .card-header .btn {
        width: 100%; /* Tombol Tambah Full Lebar */
        justify-content: center;
    }
    .card-body {
        padding: 15px;
    }
    
    /* Form Input: Stack ke bawah & Font Besar */
    .form-row {
        grid-template-columns: 1fr; /* Input 1 baris 1 kolom */
        gap: 12px;
    }
    .form-control {
        padding: 12px; /* Padding input lebih besar untuk jari */
        font-size: 16px; /* Zoom prevention on iOS */
    }
    .form-group label {
        font-size: 13px;
    }

    /* 8. TABLE: Scroll Horizontal Rapi */
    .table-wrapper {
        margin: 0 -15px; /* Lebar full mentok kiri-kanan */
        padding: 0 15px;
        overflow-x: auto;
    }
    .table {
        min-width: 600px; /* Lebar tabel tetap, user geser ke samping */
        font-size: 13px;
    }
    .table th, .table td {
        padding: 10px 12px; /* Padding sel lebih kecil */
        white-space: nowrap; /* Mencegah teks turun ke bawah */
    }

    /* 9. TOMBOL AKSI: Besar & Mudah Ditekan */
    .btn {
        padding: 10px 16px;
        min-height: 44px; /* Standar sentuh Android */
        font-size: 14px;
        width: 100%; /* Tombol utama full lebar */
        justify-content: center;
    }
    /* Tombol kecil di tabel (Edit/Hapus) */
    .btn-sm, .action-btn {
        width: auto; /* Jangan full lebar di dalam tabel */
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
        font-size: 14px;
    }

    /* 10. MODAL: Fullscreen */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
        max-height: 85vh;
        overflow-y: auto;
    }
    .modal-header {
        margin-bottom: 15px;
    }
    .modal-footer {
        flex-direction: column; /* Tombol modal tumpuk */
        gap: 10px;
    }
    .modal-footer .btn {
        width: 100%;
    }

    /* 11. HERO & PUBLIC: Rapi */
    .hero {
        padding: 60px 20px;
    }
    .hero h1 {
        font-size: 24px;
    }
    .product-grid {
        padding-bottom: 20px;
    }
    .product-card {
        flex: 0 0 220px; /* Kartu produk sedikit lebih kecil */
    }
}

/* KHUSUS HP KECIL (Samsung Mini, iPhone SE, dll) */
@media (max-width: 480px) {
    .stats-grid { gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-icon { width: 40px; height: 40px; font-size: 18px; }
    .stat-content h3 { font-size: 18px; }
    .content-wrapper { padding: 10px; }
    .table th, .table td { padding: 8px 10px; font-size: 12px; }
}