/* style.css - Tema Premium "Astra" - Versi Full Responsive */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --astra-primary: #3A79F7;
    --astra-primary-dark: #2968E4;
    --astra-secondary: #1D2B48;
    --astra-gradient: linear-gradient(135deg, var(--astra-primary), #6C55F9); /* Tetap digunakan untuk item aktif */
    --bg-main: #F4F7FC; /* Sedikit lebih cerah */
    --bg-sidebar: #1D2B48;
    --bg-card: #FFFFFF;
    --bg-input: #FDFDFD;
    --text-primary: #1D2B48;
    --text-secondary: #697489;
    --text-light: #FFFFFF;
    --border-color: #EAEBF0;
    --shadow-color: rgba(29, 43, 72, 0.1);
    --success-color: #00C48C;
    --error-color: #FF4D4D;
    --success-bg: rgba(0, 196, 140, 0.08);
    --error-bg: rgba(255, 77, 77, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* Gaya Body Dasar */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

/* KONTENER BARU UNTUK LAYOUT UTAMA APLIKASI */
.app-layout-container {
    display: flex;
    width: 100%;
    height: 100vh; /* Mengisi seluruh tinggi viewport */
}

/* Kontainer KHUSUS untuk Halaman Login */
.login-wrapper { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 100vh; padding: 1rem; }

/* --- Layout Halaman Login --- */
.auth-container { display: flex; width: 100%; max-width: 1000px; background-color: var(--bg-card); border-radius: 12px; overflow: hidden; box-shadow: 0 20px 40px -10px var(--shadow-color); }
.auth-branding { width: 45%; background: var(--astra-gradient); color: white; display: flex; justify-content: center; align-items: center; padding: 3rem; text-align: center; }
.branding-content h2 { color: white; font-size: 2rem; margin-bottom: 1rem; }
.branding-content p { color: white; opacity: 0.9; font-size: 0.95rem; }
.auth-form-section { width: 55%; padding: 2.5rem 3rem; display: flex; flex-direction: column; justify-content: center; }
.form-title { font-size: 1.75rem; margin-bottom: 0.5rem; }
.form-subtitle { color: var(--text-secondary); margin-bottom: 2rem; }

/* --- Sidebar Navigasi --- */
.sidebar { width: 260px; background-color: var(--bg-sidebar); color: var(--text-light); padding: 1.5rem; display: flex; flex-direction: column; flex-shrink: 0; transition: transform 0.3s ease-in-out; z-index: 1000; }
.sidebar-header { text-align: center; padding: 1rem 0; margin-bottom: 1rem; font-size: 1.75rem; font-weight: 700; flex-shrink: 0; }
.sidebar-nav { flex-grow: 1; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; padding: 0.9rem 1.25rem; margin-bottom: 0.5rem; border-radius: 8px; color: rgba(255, 255, 255, 0.7); text-decoration: none; transition: all 0.2s; font-weight: 500; }
.sidebar-nav a:hover { background-color: rgba(255, 255, 255, 0.1); color: var(--text-light); }
.sidebar-nav a.active { background: var(--astra-gradient); color: var(--text-light); font-weight: 600; }
.sidebar-nav a i { margin-right: 1rem; width: 20px; text-align: center; }
.sidebar-footer { margin-top: 1rem; text-align: center; flex-shrink: 0; }
.user-profile { background-color: rgba(255, 255, 255, 0.05); padding: 1rem; border-radius: 8px; margin-bottom: 1rem; }
.user-profile p { margin: 0; font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); }
.user-profile strong { font-size: 0.9rem; color: var(--text-light); font-weight: 600; }

/* --- Gaya Baru untuk Grup Menu --- */
.menu-group { margin-bottom: 0.5rem; }
.menu-group-toggle { display: flex; align-items: center; width: 100%; padding: 0.9rem 1.25rem; background: none; border: none; border-radius: 8px; color: rgba(255, 255, 255, 0.7); text-align: left; cursor: pointer; font-family: 'Poppins', sans-serif; font-size: 1rem; font-weight: 500; transition: all 0.2s; }
.menu-group-toggle:hover { background-color: rgba(255, 255, 255, 0.1); color: var(--text-light); }
.menu-group-toggle i { margin-right: 1rem; width: 20px; text-align: center; }
.menu-group-toggle .arrow { margin-left: auto; transition: transform 0.3s; }
.menu-group.active > .menu-group-toggle .arrow { transform: rotate(180deg); }
.menu-group.active > .menu-group-toggle { color: var(--text-light); background-color: rgba(255, 255, 255, 0.05); }

/* --- PERBAIKAN: Transisi Accordion Menu --- */
.sub-menu {
    display: grid;
    grid-template-rows: 0fr; /* Mulai dari keadaan tertutup */
    transition: grid-template-rows 0.3s ease-in-out;
}
.menu-group.active > .sub-menu {
    grid-template-rows: 1fr; /* Buka ke ukuran kontennya */
}
.sub-menu-items { overflow: hidden; padding-left: 1rem; }
.sub-menu a { padding-left: 2.75rem; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.25rem; display: flex; align-items: center; }
.sub-menu a:hover { color: var(--astra-primary); }
.sub-menu a.active { background: none; color: var(--astra-primary); font-weight: 600; }

/* --- Konten Utama & Header --- */
.main-content { flex: 1; min-width: 0; padding: 1.25rem; overflow-y: auto; height: 100vh; }
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.25rem; }
.page-header-title { margin: 0; font-size: 1.5rem; font-weight: 600; }
.page-header-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hamburger-menu { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-primary); }

/* --- Wrapper untuk Aksi Header Kanan --- */
.header-actions-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* --- Gaya Baru untuk Menu Notifikasi di Header --- */
.header-notification-menu { position: relative; }
.notification-menu-toggle {
    position: relative;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.notification-menu-toggle:hover { background-color: #f0f2f5; }
.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--error-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}
.critical-stock-badge {
    background-color: #ff9f43; /* Orange Warning Color */
}
.notification-menu-dropdown .notif-icon.warning {
    background-color: rgba(255, 159, 67, 0.1);
    color: #ff9f43;
}


.notification-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 10px 30px -5px var(--shadow-color);
    border: 1px solid var(--border-color);
    z-index: 1001;
    opacity: 0;
    transform: translateY(10px);
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}
.header-notification-menu.active .notification-menu-dropdown { opacity: 1; transform: translateY(0); visibility: visible; }
.notification-menu-dropdown .dropdown-header { padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border-color); }
.notification-menu-dropdown .dropdown-body { max-height: 350px; overflow-y: auto; }
.notification-menu-dropdown .dropdown-item { display: flex; gap: 1rem; padding: 1rem 1.1rem; color: var(--text-secondary); text-decoration: none; border-bottom: 1px solid var(--border-color); }
.notification-menu-dropdown .dropdown-item:last-child { border-bottom: none; }
.notification-menu-dropdown .dropdown-item:hover { background-color: #f8f9fa; }
.notification-menu-dropdown .notif-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; background-color: rgba(58, 121, 247, 0.1); color: var(--astra-primary); display: flex; align-items: center; justify-content: center; }
.notification-menu-dropdown .notif-content p { margin: 0; font-size: 0.9rem; color: var(--text-primary); line-height: 1.4; }
.notification-menu-dropdown .notif-content small { font-size: 0.75rem; color: var(--text-secondary); }
.notification-menu-dropdown .dropdown-item-empty { padding: 2rem 1rem; text-align: center; color: var(--text-secondary); }
.notification-menu-dropdown .dropdown-footer { padding: 0.75rem; text-align: center; border-top: 1px solid var(--border-color); }
.notification-menu-dropdown .dropdown-footer a { font-weight: 600; color: var(--astra-primary); text-decoration: none; }

/* --- Gaya Baru untuk Menu Pengguna di Header --- */
.header-user-menu { position: relative; }
.user-menu-toggle { display: flex; align-items: center; gap: 0.5rem; background-color: var(--bg-input); border: 1px solid var(--border-color); padding: 0.4rem 0.9rem; border-radius: 2rem; cursor: pointer; transition: all 0.2s; }
.user-menu-toggle:hover { background-color: #f0f2f5; }
.user-menu-toggle span { font-weight: 600; }
.user-menu-toggle .arrow { transition: transform 0.3s; }
.header-user-menu.active .user-menu-toggle .arrow { transform: rotate(180deg); }

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 10px 30px -5px var(--shadow-color);
    border: 1px solid var(--border-color);
    z-index: 1001;
    opacity: 0;
    transform: translateY(10px);
    visibility: hidden;
    transition: all 0.3s ease;
}
.header-user-menu.active .user-menu-dropdown { opacity: 1; transform: translateY(0); visibility: visible; }
.dropdown-header { padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border-color); }
.dropdown-header strong { font-size: 1rem; }
.dropdown-header p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }
.dropdown-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 1.1rem; color: var(--text-secondary); text-decoration: none; }
.dropdown-item:hover { background-color: #f8f9fa; }

/* --- Tampilan Mobile: Overlay & Sidebar Terbuka --- */
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 999; }
body.sidebar-open .sidebar-overlay { display: block; }
body.sidebar-open .sidebar { transform: translateX(0); }

/* --- Komponen Umum (Card, Form, Button, etc) --- */
.card { background-color: var(--bg-card); border-radius: 12px; padding: 1.25rem; border: 1px solid var(--border-color); box-shadow: 0 10px 30px -5px var(--shadow-color); margin-bottom: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-weight: 500; font-size: 0.8rem; color: var(--text-secondary); }
.form-control { width: 100%; padding: 0.65rem 0.9rem; background-color: var(--bg-input); border: 1px solid var(--border-color); border-radius: 8px; font-size: 0.9rem; transition: all 0.2s; }
.form-control:focus { outline: none; border-color: var(--astra-primary); box-shadow: 0 0 0 3px rgba(58, 121, 247, 0.2); }

/* Gaya baru untuk input dengan ikon */
.input-group {
    position: relative;
}
.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    opacity: 0.6;
}
.input-group .form-control {
    padding-left: 40px; /* Beri ruang untuk ikon */
}

.form-control:focus { outline: none; border-color: var(--astra-primary); box-shadow: 0 0 0 3px rgba(58, 121, 247, 0.2); }
.btn { padding: 0.6rem 1rem; border: none; border-radius: 8px; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.2s; display: inline-flex; justify-content: center; align-items: center; gap: 0.5rem; text-decoration: none; }
.btn-primary { background: var(--astra-gradient); color: white; }
.btn-secondary { background-color: #EAEBF0; color: var(--text-secondary); }
.btn-delete { background-color: var(--error-bg); color: var(--error-color); }
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.alert { padding: 0.9rem 1.1rem; margin-bottom: 1rem; border-radius: 8px; font-weight: 500; }
.alert-danger { background-color: var(--error-bg); color: var(--error-color); }
.alert-success { background-color: var(--success-bg); color: var(--success-color); }
.alert-warning { background-color: rgba(255, 180, 29, 0.1); color: #D98200; }

/* --- Komponen Filter Card --- */
.filter-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    padding: 0;
    border: none;
    box-shadow: none;
}
.filter-group {
    flex: 1 1 180px; /* Flex-grow, flex-shrink, flex-basis */
    display: flex;
    flex-direction: column;
}
/* --- Tampilan Tabel Responsif --- */
.table-container { background-color: var(--bg-card); border-radius: 12px; padding: 1rem; border: 1px solid var(--border-color); }
.table-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.table-header h2 { margin: 0; font-size: 1.15rem; }
.desktop-table { width: 100%; border-collapse: collapse; }
.desktop-table th, .desktop-table td { padding: 0.8rem 1rem; text-align: left; vertical-align: middle; }
.desktop-table thead { border-bottom: 2px solid var(--border-color); }
.desktop-table th { font-weight: 600; color: var(--text-secondary); font-size: 0.75rem; text-transform: uppercase; }
.desktop-table tbody tr { border-bottom: 1px solid var(--border-color); }
.desktop-table tbody tr:last-child { border-bottom: none; }
.action-links a { margin-right: 0.8rem; font-weight: 500; text-decoration: none; }
.action-links .edit-link { color: var(--astra-primary); }
.action-links .delete-link { color: var(--error-color); }

/* --- Tampilan Kartu Mobile untuk Tabel --- */
.mobile-card-view { display: none; }
.mobile-card { background-color: var(--bg-card); border-radius: 12px; margin-bottom: 1rem; border: 1px solid var(--border-color); padding: 1.5rem; }
.mobile-card-header { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.mobile-card-row { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid #f0f0f0; }
.mobile-card-row:last-child { border-bottom: none; }
.mobile-card-row .label { font-weight: 500; color: var(--text-secondary); }
.mobile-card-row .value { font-weight: 500; text-align: right; }
.mobile-card-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
.mobile-card-actions .btn { flex-grow: 1; }
.role-badge { padding: 0.3em 0.8em; font-size: 0.75rem; font-weight: 600; border-radius: 1rem; }
.role-admin { background-color: rgba(58, 121, 247, 0.1); color: #2968E4; }
.role-staff { background-color: rgba(255, 180, 29, 0.1); color: #D98200; }
.status-processing { background-color: rgba(108, 85, 249, 0.1); color: #6C55F9; } /* Purple */
.status-ready-to-ship { background-color: rgba(58, 121, 247, 0.1); color: #3A79F7; } /* Blue */
.status-sent { background-color: rgba(58, 121, 247, 0.1); color: #3A79F7; } /* Blue */
.status-paid { background-color: var(--success-bg); color: var(--success-color); }
.status-partially-paid { background-color: rgba(255, 180, 29, 0.1); color: #D98200; } /* Orange */
.status-overdue { background-color: var(--error-bg); color: var(--error-color); }
.status-invoiced { background-color: #e9ecef; color: #495057; } /* Gray */

/* --- Media Queries --- */
@media (max-width: 992px) {
    .sidebar { position: fixed; top: 0; left: 0; height: 100%; transform: translateX(-100%); }
    .hamburger-menu { display: block; }
    .main-content { padding: 1.5rem; width: 100%; }
    .page-header-title { font-size: 1.5rem; }
    .auth-branding { display: none; }
    .auth-container { flex-direction: column; max-width: 480px; }
    .auth-form-section { width: 100%; padding: 2rem; }
}
/* PERBAIKAN: Sembunyikan menu notifikasi gabungan di desktop */
.mobile-only { display: none !important; }


/* PERBAIKAN: Optimasi dropdown notifikasi untuk mobile */
@media (max-width: 480px) {
    .notification-menu-dropdown {
        width: 95vw; /* Lebar dropdown 95% dari lebar viewport */
        right: 2.5vw; /* Posisikan agar ada sedikit margin di kanan */
        left: 2.5vw; /* Posisikan agar ada sedikit margin di kiri */
        max-width: none; /* Hapus batasan lebar maksimal jika ada */
    }
}

@media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header-actions { flex-direction: column; }
    .page-header-actions .btn { width: 100%; }
    .table-container .desktop-table { display: none; }
    .mobile-card-view { display: block; }
}
/* PERBAIKAN: Tampilkan menu gabungan dan sembunyikan menu terpisah di mobile */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }
}
