/* General Body and Base Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Main Content Container - Default width for all pages */
.container {
    background-color: #ffffff;
    padding: 40px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 1400px;
    box-sizing: border-box;
    margin: 40px auto;
    flex-grow: 1;
}

/* Master Data Page Specific Styles (OVERRIDE DEFAULT CONTAINER WIDTH FOR LISTS) */
body.master-data-page .container {
    width: 98%;
    max-width: 2200px;
    padding: 40px 15px;
}

body.master-data-page nav {
    width: 98%;
    max-width: 2200px;
    padding: 0 15px;
}

/* Header and Navigation Bar */
header {
    background: linear-gradient(to right, #2c3e50, #34495e);
    padding: 18px 0;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    width: 100%;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

nav .logo {
    color: #ecf0f1;
    text-decoration: none;
    font: 700 26px 'Inter', sans-serif;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-links a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 500;
    font-size: 15px;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-3px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-links span {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

/* Notification Bell Styles */
.notification-bell-container {
    position: relative;
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    z-index: 100;
}

.notification-bell {
    font-size: 22px;
    color: #ecf0f1;
    transition: color 0.3s ease;
    pointer-events: auto;
}

.notification-bell:hover {
    color: #f1c40f;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: #e74c3c;
    color: white;
    font: bold 12px/1 sans-serif;
    border-radius: 50%;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
    border: 1px solid #2c3e50;
    z-index: 101;
    pointer-events: none;
    animation: blink 1.5s infinite alternate;
}

.notification-badge.hidden {
    display: none;
    animation: none;
}

@keyframes blink {
    from { opacity: 1; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Notification Dropdown */
.notification-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    flex-direction: column;
    transform-origin: top right;
    animation: fadeInScale 0.2s ease-out;
}

.notification-dropdown.active {
    display: flex;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8faff;
    border-radius: 8px 8px 0 0;
}

.notification-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
}

.notification-count-header {
    background-color: #3498db;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font: bold 13px sans-serif;
}

.notification-list {
    padding: 0;
    margin: 0;
    list-style: none;
    color: #333;
}

.notification-list .notification-item {
    padding: 12px 20px;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.notification-list .notification-item:hover {
    background-color: #f0f2f5;
}

.notification-list .notification-item:last-child {
    border-bottom: none;
}

.notification-item .message-text {
    margin-bottom: 5px;
    color: #333;
}
.notification-item.low_stock .message-text {
    color: #8a6d3b;
}
.notification-list .notification-item.expiring-soon .message-text,
.notification-list .notification-item.expired .message-text {
    color: #a94442;
}

.notification-item .timestamp-text {
    font-size: 12px;
    color: #888;
}

.notification-list .notification-item.low_stock {
    background-color: #fff3cd;
    border-left: 5px solid #f39c12;
}
.notification-list .notification-item.expiring-soon {
    background-color: #fcebeb;
    border-left: 5px solid #e74c3c;
}
.notification-list .notification-item.expired {
    background-color: #fcebeb;
    border-left: 5px solid #c0392b;
    font-weight: bold;
}

.no-notifications {
    font-style: italic;
    color: #888;
    padding: 20px;
    text-align: center;
}

.notification-footer {
    padding: 10px 20px;
    border-top: 1px solid #eee;
    text-align: center;
    background-color: #f8faff;
    border-radius: 0 0 8px 8px;
}

.notification-footer a {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.notification-footer a:hover {
    text-decoration: underline;
}

/* DROPDOWN PROFIL BARU */
.profile-menu-container {
    position: relative;
    cursor: pointer;
    margin-left: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    z-index: 100;
}

.profile-icon {
    font-size: 26px;
    color: #ecf0f1;
    transition: color 0.3s ease;
    pointer-events: auto;
}

.profile-icon:hover {
    color: #3498db;
}

.profile-dropdown {
    position: absolute;
    top: 45px; /* Sesuaikan jarak dari ikon */
    right: 0;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    width: 250px; /* Lebar dropdown */
    z-index: 1000;
    display: none;
    flex-direction: column;
    padding: 0;
    animation: fadeInScale 0.2s ease-out;
}

.profile-dropdown.active {
    display: flex;
}

.profile-dropdown a {
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    font-size: 15px;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
}

.profile-dropdown a:last-child {
    border-bottom: none;
    color: #e74c3c;
    font-weight: bold;
}
.profile-dropdown a:last-child:hover {
    background-color: #f8d7da;
    color: #c0392b;
}

.profile-dropdown a:hover {
    background-color: #f0f2f5;
    color: #2c3e50;
}

.profile-dropdown .dropdown-header {
    font-weight: 600;
    color: #2c3e50;
    padding: 15px 20px;
    background-color: #f8faff;
    border-bottom: 1px solid #eee;
    border-radius: 8px 8px 0 0;
    font-size: 16px;
}
/* AKHIR DROPDOWN PROFIL BARU */


/* General Button Styles */
.button {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font: 600 15px 'Inter', sans-serif;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Specific Button Colors */
.logout-button { background-color: #e74c3c; }
.logout-button:hover { background-color: #c0392b; }
.edit-button { background-color: #f39c12; }
.edit-button:hover { background-color: #e67e22; }
.danger { background-color: #e74c3c; }
.danger:hover { background-color: #c0392b; }
.success { background-color: #2ecc71; }
.success:hover { background-color: #27ae60; }

/* Form Container Styles (Used for login, add/edit item, inbound, outbound) */
.form-container {
    max-width: 550px;
    margin: 50px auto;
    padding: 40px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

h1, h2, h3 {
    color: #2c3e50;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

form label {
    font: 600 15px 'Inter', sans-serif;
    color: #555;
    text-align: left;
    margin-bottom: 5px;
    display: block;
}

form input[type="text"],
form input[type="password"],
form input[type="number"],
form input[type="date"],
form select,
form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input[type="text"]:focus,
form input[type="password"]:focus,
form input[type="number"]:focus,
form input[type="date"]:focus,
form select:focus,
form textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* Styles for Read-only/Disabled Fields */
form input[readonly],
form input[disabled],
form select[disabled] {
    background-color: #e9ecef;
    color: #555;
    cursor: not-allowed;
    opacity: 0.9;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

form select[disabled] option {
    color: #555;
}

form button[type="submit"] {
    background-color: #2ecc71;
    color: white;
    padding: 14px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font: 600 17px 'Inter', sans-serif;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    margin-top: 20px;
}

form button[type="submit"]:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

.cancel-button {
    background-color: #95a5a6;
    margin-top: 10px;
}
.cancel-button:hover {
    background-color: #7f8c8d;
}

/* Flash Messages (Alerts) */
.flashes {
    list-style-type: none;
    padding: 0;
    margin-bottom: 30px;
}

.flashes li {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.flashes .success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flashes .danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flashes .info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.flashes .warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Status colors (for Master Barang & Expiring Items) */
.status-active { color: #2ecc71; font-weight: 700; }
.status-inactive { color: #e74c3c; font-weight: 700; }
/* Status colors for transaction types */
.status-success { color: #2ecc71; font-weight: bold; }
.status-danger { color: #e74c3c; font-weight: bold; }


/* Table Styles - DEFAULT */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 30px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

th, td {
    border: none;
    padding: 15px 20px;
    text-align: left;
}

th {
    background-color: #e0e6ed;
    color: #2c3e50;
    font: 700 14px 'Inter', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Add borders to table cells for a grid effect */
th:not(:last-child), td:not(:last-child) {
    border-right: 1px solid #f0f0f0;
}
tr:not(:last-child) td {
    border-bottom: 1px solid #f0f0f0;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}
tr:hover {
    background-color: #eef4f9;
}


/* Dashboard Grid Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.dashboard-card {
    background-color: #f8faff;
    border: 1px solid #dbe9ff;
    border-radius: 12px;
    padding: 35px;
    text-align: center;
    text-decoration: none;
    color: #2c3e50;
    transition: all 0.3s ease;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.dashboard-card:hover {
    background-color: #e0eaff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(-5px);
}

.dashboard-card h3 {
    margin-top: 0;
    color: #3498db;
    font-size: 24px;
    margin-bottom: 15px;
}

.dashboard-card p {
    font-size: 16px;
    color: #666;
}

/* --- NEW: Summary Cards on Dashboard --- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 40px;
}

.summary-card {
    background-color: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.summary-card h4 {
    color: #555;
    font-size: 18px;
    margin: 0 0 10px 0;
    text-align: center;
}

.summary-card p {
    font-size: 32px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.summary-card.low-stock-card {
    background-color: #fff8e1;
    border-color: #ffc107;
}

.summary-card.low-stock-card h4 {
    color: #856404;
}

.summary-card.low-stock-card p {
    color: #ffc107;
}

.summary-card.expiring-card {
    background-color: #ffe0e0;
    border-color: #dc3545;
}

.summary-card.expiring-card h4 {
    color: #721c24;
}

.summary-card.expiring-card p {
    color: #dc3545;
}

/* --- NEW: Chart Styles --- */
.chart-container-wrapper {
    background-color: #ffffff;
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
}

.chart-container-wrapper h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: left;
    color: #34495e;
    font-size: 20px;
}

.chart-canvas-container {
    position: relative;
    height: 400px;
    width: 100%;
}


/* Footer Styles */
footer {
    text-align: center;
    padding: 25px;
    background-color: #34495e;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 50px;
    font-size: 14px;
}

/* Filter form specific alignment and styling (GLOBAL - for all filter forms) */
.filter-form-container {
    background-color: #f8faff;
    border: 1px solid #dbe9ff;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.filter-form h3 {
    text-align: left;
    margin-top: 0;
    margin-bottom: 20px;
    color: #34495e;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    align-items: flex-start;
}

/* Base style for all form groups inside filter-form */
.filter-form .form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    width: 100%;
}

/* --- KUNCI PERBAIKAN: Wrapper untuk input dan tombol agar sejajar (for Master Barang & Expiring Items) --- */
.filter-form .input-and-filter-buttons-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    min-height: 44px;
    justify-content: space-between;
    padding-right: 5px;
}

/* --- KUNCI PERBAIKAN: Input dalam filter form --- */
.filter-form input[type="text"],
.filter-form input[type="date"],
.filter-form select {
    flex: 1 1 auto;
    min-width: 180px;
    max-width: 100%;
    box-sizing: border-box !important;
    padding: 10px 12px !important;
    line-height: 1 !important;
    height: 44px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    width: auto !important;
}

/* --- KUNCI PERBAIKAN: Grup tombol dalam filter form (untuk tombol "Terapkan" dan "Reset") --- */
.filter-form .filter-actions-group {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

/* Style for buttons placed at the bottom of the filter form (for Riwayat Transaksi dan Export All) */
.filter-form .filter-actions-group-bottom {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    margin-top: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-form .button {
    padding: 10px 18px !important;
    font-size: 15px;
    box-shadow: none;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box !important;
    line-height: 1 !important;
    flex-shrink: 0;
    flex-grow: 0;
    white-space: nowrap;
}
.filter-form .button:hover {
    transform: none;
    box-shadow: none;
}

/* Override default button colors for filter actions */
.filter-form .filter-actions-group .button[type="submit"] {
    background-color: #3498db;
}
.filter-form .filter-actions-group .button[type="submit"]:hover {
    background-color: #2980b9;
}
.filter-form .filter-actions-group .cancel-button {
    background-color: #95a5a6;
}
.filter-form .filter-actions-group .cancel-button:hover {
    background-color: #7f8c8d;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .container {
        padding: 30px;
        margin: 20px auto;
    }
    nav {
        flex-direction: column;
        gap: 20px;
        padding: 0 15px;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    nav .logo {
        margin-bottom: 15px;
    }
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    .form-container {
        margin: 30px auto;
        padding: 30px;
    }
    h1, h2, h3 {
        font-size: 24px;
    }

    /* Adjust for master-data-page on smaller screens */
    body.master-data-page .container {
        padding: 20px;
        width: 98%;
    }
    body.master-data-page nav {
        width: 98%;
    }
}

/* --- KUNCI PERBAIKAN: Hanya menumpuk di bawah 600px --- */
@media (max-width: 600px) {
    .filter-form .input-and-filter-buttons-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-form .filter-actions-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .filter-form .button {
        width: 100%;
    }

    .summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 15px;
        width: 98%;
    }
    nav .logo {
        font-size: 20px;
    }
    .nav-links a {
        font-size: 13px;
        padding: 6px 10px;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .form-container {
        padding: 20px;
    }
    h1, h2, h3 {
        font-size: 22px;
    }
}

/*
    ========================================================================
    KODE PAGINASI BARU
    Memastikan tombol-tombol paginasi sejajar, rata tengah, dan responsif.
    ========================================================================
*/
.pagination-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
}

.pagination-controls .pagination {
    list-style: none; /* Menghilangkan bullet points */
    padding: 0;
    margin: 0;
    display: flex; /* Mengatur item-item menjadi sejajar horizontal */
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.pagination-controls .pagination li {
    display: flex;
    align-items: center;
}

/* Mengatur tampilan tombol/nomor halaman */
.pagination-controls .pagination a.button,
.pagination-controls .pagination span.button {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 4px;
    box-shadow: none;
    transition: background-color 0.3s;
    text-decoration: none;
    line-height: 1.2;
    box-sizing: border-box;
}

.pagination-controls .pagination a.button:hover {
    background-color: #2980b9;
    transform: none;
    box-shadow: none;
}

.pagination-controls .pagination li.active span.button {
    background-color: #3498db;
    color: white;
}

.pagination-controls .pagination li.disabled span.button {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Mengatur teks "Halaman X dari Y" */
.pagination-controls p {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    text-align: center;
}