/* ================================================= */
/* STYLE.CSS - SELURUH KODE TERBARU                  */
/* (Perbaikan TERFOKUS pada Urutan Navigasi Mobile)  */
/* ================================================= */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    font-size: 10pt;
}

.container {
    max-width: 100%;
    margin: 20px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto; /* TETAPKAN ini agar tabel bisa di-scroll jika total lebar melebihi layar */
    width: 95%; /* Adjust as needed */
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    /* --- KEY FIX HERE --- */
    margin-top: 60px; /* Adjust this value if your nav height changes */
    /* Add padding-top to the body if the container doesn't cover full width or to prevent content from touching the very top edge after nav */
}

h1 {
    color: #0056b3;
    text-align: center;
    margin-bottom: 20px;
}

table {
    width: 100%; /* Tetap 100% untuk mengisi container */
    border-collapse: collapse;
    margin-top: 20px;
    table-layout: auto; /* INI KUNCI UNTUK MEMATENKAN LEBAR KOLOM */
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    white-space: nowrap; /* Mencegah teks membungkus */
    overflow: hidden; /* Sembunyikan teks yang melampaui batas kolom */
    text-overflow: ellipsis; /* Tampilkan ... jika teks terpotong */
}

/* Atur lebar spesifik untuk setiap kolom */
/* Sesuaikan lebar ini sesuai kebutuhan data Anda */
table th:nth-child(1),
table td:nth-child(1) { width: 60px; } /* Foto */
table th:nth-child(2),
table td:nth-child(2) { width: 140px; } /* Outlet */
table th:nth-child(3),
table td:nth-child(3) { width: 150px; } /* Number */
table th:nth-child(4),
table td:nth-child(4) { width: 90px; } /* Customer Name */
table th:nth-child(5),
table td:nth-child(5) { width: 50px; } /* Date */
table th:nth-child(6),
table td:nth-child(6) { width: 100px; } /* Category */
table th:nth-child(7),
table td:nth-child(7) { width: 220px; } /* Variant */
table th:nth-child(8),
table td:nth-child(8) { width: 100px; } /* Code */
table th:nth-child(9),
table td:nth-child(9) { width: 40px; }  /* Dikirim */
table th:nth-child(10),
table td:nth-child(10) { width: 100px; } /* Tanggal Retur */
table th:nth-child(11),
table td:nth-child(11) { width: 100px; } /* Retur Diterima */
table th:nth-child(12),
table td:nth-child(12) { width: 100px; } /* Retur Iltijam */
/* Pastikan kolom Aksi (terakhir) memiliki lebar yang cukup */
table th:last-child,
table td:last-child { width: 150px; } /* Aksi (Tombol Retur) */

/* Tambahkan aturan untuk membolehkan wrapping pada kolom tertentu jika perlu, contoh untuk Category/Variant jika memang sangat panjang dan harus dibaca penuh */
table td:nth-child(4), /* Customer Name */
table td:nth-child(6), /* Category */
table td:nth-child(7)  /* Variant */
{

}

th {
    background-color: #007bff;
    color: white;
}

tr:hover {
    background-color: #dddddd;
}

a {
    display: inline-block;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    margin-bottom: 10px;
}

textarea {
    width: 98%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Gaya untuk tombol umum yang tidak spesifik */
button {
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease; /* Transisi untuk hover */
}

button:hover {
    background-color: #218838;
}

/* Modal (Pop-up) Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width:100%; /* Could be more or less, depending on screen size */
    max-width: none; /* Max width for larger screens */
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
    -webkit-animation-name: animatetop;
    -webkit-animation-duration: 0.4s;
    animation-name: animatetop;
    animation-duration: 0.4s
}

/* Add Animation */
@-webkit-keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}

@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute; /* Position close button */
    top: 10px;
    right: 15px;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    margin-top: 0;
    color: #2d302c;
    text-align: center;
    margin-bottom: 20px;
}

/* Style for reset button inside modal to match other buttons */
.modal-content .reset-button {
    background-color: #dc3545; /* Red */
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-block; /* Keep it inline with the filter button */
}

.modal-content .reset-button:hover {
    background-color: #c82333;
}

/* Warna Baris Tabel Bergantian Berdasarkan Tanggal */
/* Aturan dasar untuk menghilangkan warna bawaan pada baris tbody */
table tbody tr {
    background-color: transparent; /* Pastikan tidak ada warna default yang menimpa */
}

/* Warna Dasar untuk Baris Tabel (akan diatur oleh JS) */
.base-color-blue {
    background-color: rgba(71, 158, 44, 0.3); /* Cornflower Blue Muda yang sedikit transparan */
}

.base-color-yellow {
    background-color: rgba(247, 247, 72, 0.3); /* Kuning Muda yang sedikit transparan */
}

/* Opacity Alternatif untuk baris dalam tanggal yang sama */
/* Baris genap dalam satu blok tanggal akan memiliki opacity yang lebih rendah */
.row-opacity-alt {
    opacity: 0.8; /* Sesuaikan nilai ini untuk perbedaan opacity antar baris dalam blok tanggal yang sama */
}

/* Penting: Pastikan hover styling berada di bawah kelas warna dasar agar tidak ditimpa */
/* Dan di atas .returned-row agar hover tetap bekerja di atas baris retur */
tr:hover:not(.returned-row) { /* Hanya terapkan hover jika bukan baris retur */
    background-color: rgba(0, 0, 0, 0.05); /* Warna hover yang lebih netral atau sesuai selera */
    opacity: 1 !important; /* Pastikan opacity penuh saat di-hover */
}

/* Gaya untuk baris yang ditandai sebagai retur */
.returned-row {
    background-color: #ffcccc !important; /* Merah muda */
    color: #cc0000 !important; /* Teks merah tua */
    text-decoration: line-through; /* Opsional: coret teks */
    opacity: 0.7 !important; /* Sedikit transparan agar terlihat seperti 'dibatalkan' */
}

/* Gaya untuk status 'RETURED' */
.returned-status {
    color: #cc0000;
    font-weight: bold;
    font-size: 0.8em;
    background-color: #ffeaea; /* Latar belakang untuk label status */
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap; /* Pastikan teks tidak membungkus */
}

/* Gaya untuk tombol 'Retur Item' */
.mark-returned-item-btn {
    background-color: #dc3545; /* Merah */
    color: white;
    padding: 5px 10px; /* Ukuran lebih kecil dari tombol standar */
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em; /* Ukuran font lebih kecil */
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Mencegah tombol membungkus */
}

.mark-returned-item-btn:hover {
    background-color: #c82333;
}

/* Gaya untuk tombol 'Sudah Retur' (disabled) */
.mark-returned-item-btn[disabled] {
    background-color: #cccccc; /* Abu-abu terang */
    color: #666666; /* Teks abu-abu gelap */
    cursor: not-allowed;
}

/* Pastikan style untuk kolom yang clickable */
.clickable-number { /* Number tetap clickable untuk retur per nomor */
    cursor: pointer;
    text-decoration: underline;
    color: #007bff; /* Warna biru untuk menunjukkan bisa diklik */
}

.clickable-number:hover,
.clickable-variant:hover, /* Ini hanya akan berefek jika class masih ada di HTML */
.clickable-code:hover { /* Ini hanya akan berefek jika class masih ada di HTML */
    color: #0056b3;
}

/* NEW: Styles for Dashboard Charts */
.pie-chart-section {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.chart-container {
    max-width: 500px;
    height: 400px;
    margin: 0;
}

h2 {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8em;
}

.line-charts-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 40px;
    padding: 0 15px;
}

.line-chart-wrapper {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    max-height: 400px; /* Batasi tinggi maksimum wrapper */
    overflow: hidden; /* Sembunyikan overflow jika konten melebihi max-height */
}

.line-chart-wrapper.full-width-chart {
    max-width: 900px;
}

.line-chart-wrapper h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.4em;
    text-align: center;
    margin-bottom: 15px;
}

.line-chart-wrapper canvas {
    max-width: 100%;
    height: 300px !important;
    display: block;
}

.date-filter-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.date-filter-group label {
    font-weight: bold;
    color: #555;
    white-space: nowrap;
}

.date-filter-group input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    width: 130px;
    text-align: center;
}

.table-responsive-wrapper {
    overflow-x: auto;
    width: 100%;
    margin-top: 20px;
}

h1 {
    color: #333;
    margin-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #4806fd;
    font-weight: bold;
}

table thead {
    width: 100%;
    background-color: #007bff;
    color: white;
}

table tbody {
    height: 400px;
    overflow-y: auto;
    width: 100%;
    border-top: 1px solid #ddd;
}

.table-photo-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
    display: block;
    margin: 0 auto;
}

#salesTable td {
    vertical-align: middle;
}


/* ================================================= */
/* PERBAIKAN & PENYESUAIAN NAVIGASI (HANYA BAGIAN INI YANG DIUBAH/DITAMBAHKAN) */
/* ================================================= */

/* Main Navigation Styling */
.main-nav {
    background-color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

/* Grouping of Navigation Items */
.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Logo Styling */
.nav-logo {
    height: 30px;
}

/* Navigation Links Styling (for .nav-center) */
.main-nav .nav-center a {
    color: #333;
    text-decoration: none;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 14px;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.main-nav .nav-center a:hover {
    color: #e44d26;
}

/* Logout Link Styling (for .nav-right) */
.main-nav .nav-right a {
    color: #e44d26;
    font-weight: bold;
    text-decoration: none;
    padding: 8px 12px;
    font-size: 14px;
    transition: color 0.3s ease;
}

.main-nav .nav-right a:hover {
    color: #a02d1a;
}

/* Class to show the menu (will be toggled by JS) */
.nav-center.active {
    display: flex; /* Tampilkan menu saat aktif */
}

/* Optional: Animation for hamburger icon to 'X' */
.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Hamburger Icon Styling (default: hidden for desktop) */
/* >>> INI ADALAH BLOK YANG SAYA ATUR ULANG POSISINYA <<< */
.menu-toggle {
    display: none; /* Sembunyikan secara default di desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    cursor: pointer;
    z-index: 1001;
    /* DEBUGGING VISUAL SEMENTARA: Hapus ini setelah berhasil */
    border: 1px solid lime; /* Border hijau untuk melihat area toggle */
}

.menu-toggle .bar {
    width: 100%;
    height: 3px;
    background-color: #333;
    transition: all 0.3s ease-in-out;
    /* DEBUGGING VISUAL SEMENTARA: Hapus ini setelah berhasil */
    background-color: red; /* Warna merah untuk melihat batang hamburger */
}

.logout-mobile {
    display: none;
}

/* Pastikan link logout desktop terlihat di desktop */
.logout-desktop {
    display: block; /* Atau inline-block, tergantung kebutuhan */
}
/* Responsive Design for Mobile Devices */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
    }

    .nav-center {
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
        gap: 5px;
        display: none; /* Sembunyikan secara default, akan di-toggle dengan JavaScript */
    }

    .nav-center a {
        width: 100%;
        text-align: left;
        padding: 10px 15px;
        border-bottom: 1px solid #eee;
    }

    .nav-center a:last-child {
        border-bottom: none;
    }

    .nav-left {
        width: 100%;
        /* Mengatur item di nav-left untuk hamburger di kiri, logo di kanan */
        display: flex; /* Pastikan flexbox aktif */
        justify-content: space-between; /* Menempatkan item di ujung-ujung */
        align-items: center; /* Pusatkan secara vertikal */
        min-height: 40px; /* Memastikan tinggi minimum */
    }

    /* Mengatur urutan elemen dalam nav-left */
    .nav-left .nav-logo {
        order: 2; /* Logo kedua */
        margin: 0 auto; /* Pusatkan logo jika ada ruang kosong */
    }

    .nav-left .menu-toggle {
        order: 1; /* Hamburger pertama */
    }

    .nav-right {
        display: none;
    }

    /* Hamburger menu icon - INI AKAN MENIMPA display: none; DI ATAS KETIKA DI LAYAR MOBILE */
    .menu-toggle {
        display: flex; /* Tampilkan hamburger icon */
        cursor: pointer;
        font-size: 24px;
        color: #333;
        /* order: 2; /* Hapus order di sini karena sudah diatur di .nav-left */
    }
    .logout-mobile {
        display: block; /* Tampilkan sebagai blok agar mengambil baris penuh */
        /* Anda mungkin ingin menyesuaikan styling di sini agar cocok dengan item menu lainnya */
        background-color: #f8d7da; /* Contoh warna latar belakang untuk logout di menu mobile */
        color: #721c24; /* Contoh warna teks */
        text-align: center;
        margin-top: 10px; /* Sedikit spasi dari item menu lainnya */
    }

    /* Sembunyikan link logout desktop di mobile */
    .logout-desktop {
        display: none;
    }
}