/* style.css - Gaya Bersama untuk Aplikasi Pemesanan */

:root {
    --primary-color: #7B5E3C; /* Coklat Kopi */
    --secondary-color: #D6C49F; /* Krem Muda */
    --background-color: #F7F5F0; /* Latar Belakang Krem */
    --card-background: #FFFFFF; /* Putih untuk Kartu */
    --text-color: #333333; /* Abu-abu Tua */
    --text-light: #555555;
    --border-color: #E0E0E0; /* Abu-abu Muda */
    --error-color: #D60000;
    --success-color: #4CAF50; /* Hijau untuk sukses */
    --warning-color: #ff9800; /* Oranye untuk peringatan */
    --font-family: 'Poppins', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Reset to prevent unwanted images */
*, *::before, *::after {
    background-image: none !important;
}

/* Override any external background images */
html, body {
    background-image: none !important;
    background-attachment: scroll !important;
}

body {
    margin: 0;
    background-color: var(--background-color);
    font-family: var(--font-family);
    color: var(--text-color);
    padding: 20px;
    box-sizing: border-box;
    line-height: 1.6;
    padding-top: 80px; /* Add padding for fixed navbar */
    overflow-x: hidden; /* Prevent horizontal scroll that might show unwanted content */
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    background-color: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background-image: none !important; /* Ensure no background images in container */
}

/* Ensure product images are controlled and don't overflow */
.product-image {
    max-width: 100%;
    height: 200px;
    overflow: hidden;
    background: none !important;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
}

.product-image img {
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hide any pseudo-elements that might contain unwanted content */
body::before, body::after,
.container::before, .container::after {
    display: none !important;
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 1em;
}

h1 {
    text-align: center;
    font-size: 2.2em;
    margin-bottom: 1.5em;
}

h2 {
    font-size: 1.8em;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5em;
}

/* --- Navigation Bar --- */
.navbar {
    background-color: var(--primary-color);
    padding: 10px 20px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: #fff;
    font-size: 1.5em;
    font-weight: 700;
    text-decoration: none;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 20px;
}

.nav-item a {
    color: #f0eada;
    text-decoration: none;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.nav-item a:hover,
.nav-item a.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.nav-cart-count {
    background-color: var(--error-color);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75em;
    position: relative;
    top: -8px;
    right: -3px;
    min-width: 18px; /* Ensure circle shape even for single digit */
    text-align: center;
    display: inline-block; /* Make sure it takes space */
}

/* User navigation styles */
.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.user-info {
    color: #f0eada;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-role {
    color: var(--secondary-color);
    font-size: 0.85em;
    font-weight: 400;
}

.logout-btn {
    color: #f0eada !important;
    text-decoration: none;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.5);
}


/* --- Bagian Form --- */
.search-form, .filter-form, .payment-options form {
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    background-color: #fdfcf9;
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.form-group {
    flex: 1 1 250px; /* Fleksibel untuk berbagai ukuran layar */
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1em;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-color);
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(123, 94, 60, 0.15);
    outline: none;
}

input::placeholder {
    color: #aaa;
}

select {
    appearance: none;
    background: white url('data:image/svg+xml;utf8,<svg fill="%23aaa" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 15px center;
    background-size: 16px 16px;
    cursor: pointer;
}

/* --- Tombol --- */
button, .button, a.button { /* Include anchor tags styled as buttons */
    padding: 12px 25px;
    font-size: 1em;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.1s ease, box-shadow 0.2s ease;
    text-decoration: none; /* Ensure no underline on links */
    display: inline-flex; /* Use inline-flex for icon alignment */
    align-items: center; /* Vertically align icon and text */
    justify-content: center; /* Center content horizontally */
    gap: 8px; /* Space between icon and text */
    color: inherit; /* Default color for buttons */
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
button:hover, .button:hover, a.button:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

button:active, .button:active, a.button:active {
    transform: scale(0.98);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff !important; /* Ensure text is white */
}
.btn-primary:hover {
    background-color: #6a4f35;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-color) !important;
}
.btn-secondary:hover {
    background-color: #cbb894;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color) !important;
    box-shadow: none; /* Less prominent shadow for outline */
}
.btn-outline:hover {
    background-color: #f8f8f8;
    border-color: #ccc;
}
.btn-outline:active {
     box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}


.btn-danger {
    background-color: transparent;
    color: var(--error-color) !important;
    padding: 6px 10px; /* Lebih kecil untuk ikon */
    font-size: 0.9em;
    border: none; /* Remove border for icon buttons */
    box-shadow: none;
}
.btn-danger:hover {
    background-color: rgba(214, 0, 0, 0.1);
}

.search-form button[type="submit"] {
    flex-basis: 150px; /* Lebar tetap untuk tombol search */
    flex-grow: 0;
    align-self: flex-end; /* Pastikan sejajar di bawah */
}

/* --- Grid Produk --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* Grid responsif */
    gap: 25px;
    margin-bottom: 40px;
}

.product-card {
    background-color: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align items to the top */
    margin-bottom: 15px;
    gap: 10px;
}

.product-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
    flex-grow: 1; /* Allow title to take available space */
}

.product-title .brand { /* Misal: "RumahKopi" */
    display: block;
    font-size: 0.85em;
    color: var(--text-light);
    font-weight: 400;
}

.product-image {
    width: 100%;
    max-width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
}

.product-details {
   margin-top: auto; /* Dorong ke bawah */
}

.product-price {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.add-button {
    width: 100%;
}
.add-button i {
    margin-right: 5px; /* Space between icon and text */
}

/* --- Item di Keranjang / Riwayat / Detail --- */
.order-item, .history-item, .detail-item {
    background-color: #fdfcf9;
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Agar responsif */
    gap: 15px;
    border: 1px solid var(--border-color);
}

/* Specific hover for history items */
.history-item {
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.history-item:hover {
    background-color: #f5f2ec;
}

.item-details, .history-info, .detail-info {
    flex: 1 1 200px; /* Fleksibel */
}

.item-name, .history-id span, .detail-name {
    font-weight: 600;
    font-size: 1.05em;
    margin: 0 0 5px 0;
}
.history-id, .detail-id {
     font-weight: 600;
     font-size: 1.05em;
     margin-bottom: 5px;
}
.history-qty, .history-date, .detail-qty {
     font-size: 0.9em;
     color: var(--text-light);
}
.history-date{
    display: block; /* Makes date appear on new line */
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-button {
    background-color: #eee;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    color: var(--text-color);
    line-height: 1; /* Pastikan tombol tidak terlalu tinggi */
    transition: background-color 0.2s ease;
}
 .qty-button:hover {
     background-color: #ddd;
 }

.qty-number {
    font-weight: 600;
    font-size: 1em;
    min-width: 20px;
    text-align: center;
}

.item-actions, .history-actions-item, .detail-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0; /* Agar tidak mengecil */
}

.item-price, .history-price, .detail-price {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--primary-color);
    white-space: nowrap;
}

/* --- Ringkasan Pesanan (Keranjang) --- */
.order-summary {
    margin-top: 25px;
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: #fdfcf9;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-color);
}
.summary-row:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

 .summary-row.total {
     font-size: 1.2em;
     font-weight: 700;
     border-top: 2px solid var(--primary-color);
     padding-top: 15px;
     margin-top: 10px;
     border-bottom: none; /* Remove dashed line for total */
 }
.summary-label, .total-label {
     color: var(--text-color);
 }

 .summary-value, .total-amount {
     color: var(--primary-color);
     font-weight: 600;
 }
 .total-amount {
     font-weight: 700;
 }


.payment-options {
    margin-top: 30px;
    margin-bottom: 20px;
}

.payment-options h3 {
    margin-bottom: 15px;
    font-size: 1.2em;
}


.cart-actions, .history-page-actions { /* Renamed history actions container */
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: flex-end; /* Tombol ke kanan */
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

/* --- Header Halaman Riwayat --- */
 .history-header {
     display: flex;
     justify-content: space-between;
     align-items: center;
     margin-bottom: 20px;
     font-size: 0.95em;
     color: var(--text-light);
     flex-wrap: wrap; /* Responsive */
     gap: 10px;
 }
 .history-header h2 {
     margin-bottom: 0; /* Remove extra margin from h2 inside header */
     border-bottom: none;
     padding-bottom: 0;
 }


/* --- Tampilan Detail Pesanan --- */
.order-detail-container {
    /* Styles for the detail page container if needed */
}
.detail-item {
    background: #f9f9f9;
    border: 1px solid #eee;
}
.order-detail-summary { /* Added class for detail summary */
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}
.order-detail-summary .summary-row span:first-child { /* Style labels in detail summary */
    font-weight: normal;
    color: var(--text-light);
}
.order-detail-summary .summary-row span:last-child { /* Style values */
    font-weight: 600;
}
.order-detail-summary .summary-row.total span { /* Keep total row bold */
     font-weight: 700;
     color: var(--primary-color);
 }


/* --- Tombol kembali/tutup --- */
.back-button-container {
    margin-top: 30px;
    text-align: center; /* Center the button */
}
.btn-back {
     min-width: 150px;
}


/* --- Pesan Status --- */
.status-message {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    border-radius: var(--border-radius);
    background-color: #e7f3fe; /* Example: light blue */
    color: #0d6efd; /* Example: blue */
    border: 1px solid #b6d4fe;
}
.status-message.empty {
    background-color: #fff3cd;
    color: #664d03;
    border-color: #ffecb5;
}
.status-message a { /* Style links inside status messages */
    color: inherit; /* Use the message text color */
    font-weight: 600;
}


/* --- Custom Notification --- */
.custom-notification {
    position: fixed;
    top: 80px; /* Position below navbar */
    right: 20px;
    background-color: var(--success-color); /* Default: success */
    color: white;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateX(110%); /* Start further off-screen */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    max-width: 400px; /* Limit width */
}
.custom-notification.warning { background-color: var(--warning-color); }
.custom-notification.error { background-color: var(--error-color); }

.custom-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-grow: 1; /* Allow message to take space */
}

#notification-message {
    line-height: 1.4;
}

.btn-close-notification {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.6em;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s ease;
}
.btn-close-notification:hover {
    color: white;
}

/* --- Responsiveness --- */
@media (max-width: 768px) {
    body { padding-top: 70px; } /* Adjust for potentially smaller navbar */
    .container { padding: 20px; }
    h1 { font-size: 2em; }
    h2 { font-size: 1.5em; }

    .nav-container { flex-direction: column; align-items: flex-start; }
    .nav-menu { margin-top: 10px; flex-direction: column; gap: 5px; width: 100%;}
    .nav-item a { display: block; text-align: center; }

    .search-form, .filter-form { flex-direction: column; align-items: stretch; }
    .search-form button[type="submit"] { width: 100%; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; }
    .product-card { padding: 15px; }

    .order-item, .history-item, .detail-item { flex-direction: column; align-items: flex-start; } /* Stack vertically */
     .item-details, .history-info, .detail-info,
     .item-actions, .history-actions-item, .detail-actions {
         width: 100%; /* Take full width */
     }
     .item-actions {
         flex-direction: row;
         justify-content: space-between; /* Space out price and delete */
         margin-top: 10px;
         align-items: center;
     }

    .cart-actions, .history-page-actions {
        justify-content: center;
        flex-direction: column; /* Stack buttons vertically */
    }
    .cart-actions .button, .history-page-actions .button,
    .cart-actions button, .history-page-actions button { /* Ensure all buttons stack */
        width: 100%; /* Make buttons full width */
    }
}

@media (max-width: 480px) {
    body { padding: 10px; padding-top: 60px; }
    .container { padding: 15px; margin: 10px auto; }
    h1 { font-size: 1.8em; }
    h2 { font-size: 1.3em; }
    button, .button, a.button { padding: 10px 20px; font-size: 0.9em; }
    .products-grid { grid-template-columns: 1fr; } /* Satu kolom di layar sangat kecil */
    .product-title { font-size: 1em; }
    .product-price { font-size: 1em; }
    .item-name, .item-price, .history-id, .history-price, .detail-name, .detail-price { font-size: 1em; }
    .history-header { flex-direction: column; align-items: flex-start; gap: 5px;}
    .nav-brand { font-size: 1.2em; }

     /* Adjust notification position on small screens */
    .custom-notification {
        top: 65px; /* Adjust based on navbar height */
        right: 10px;
        left: 10px; /* Make it wider */
        max-width: none; /* Allow full width */
    }
}
/* style.css - Tambahan untuk Fitur Tambah Produk */

.add-product-section {
    background-color: #fdfcf9;
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-top: 40px;
    margin-bottom: 30px;
}

.add-product-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary-color);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

#addProductForm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Grid responsif untuk form */
    gap: 20px;
}

#addProductForm .form-group {
    margin-bottom: 0; /* Hapus margin bawah karena sudah ada gap */
}

/* Lebarkan tombol submit jika perlu pada layar kecil */
#addProductForm button[type="submit"] {
    grid-column: 1 / -1; /* Buat tombol span full width di grid */
    justify-self: end; /* Posisikan ke kanan */
    margin-top: 10px;
    width: auto; /* Reset width agar tidak full width jika tidak perlu */
    padding-left: 30px;
    padding-right: 30px;
}

@media (max-width: 600px) {
    #addProductForm button[type="submit"] {
         width: 100%; /* Full width di layar kecil */
    }
}