/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    padding-top: 80px;
}

/* --- Tombol Modern --- */
.add-to-cart-card-button, #checkout-button {
    border: none;
    cursor: pointer;
    font-weight: bold;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background-color 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.add-to-cart-card-button:hover, #checkout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.add-to-cart-card-button:active, #checkout-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.add-to-cart-card-button {
    background-color: #ff6600;
    color: white;
    padding: 0.75rem 1rem;
    width: 100%;
    margin-top: auto; 
}

#checkout-button {
    background-color: #25D366;
    color: white;
    padding: 0.85rem 1.5rem;
    width: 100%;
    font-size: 1.1rem;
    margin-top: 1rem;
}

#checkout-button:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

/* PERBAIKAN: Tombol "Lihat Pesanan" dengan Ikon, Badge, dan Total Harga */
#cart-button {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 30px;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    z-index: 1000;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
    transition: all 0.3s ease;
}

#cart-button:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.5);
}

.cart-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.cart-button-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.cart-button-text {
    font-size: 1rem;
    font-weight: bold;
}

.cart-button-total {
    font-size: 0.9rem;
    font-weight: normal;
}

.cart-count-badge {
    background-color: #ff4d4d;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid #007bff;
    margin-left: 0.5rem; /* Jarak dari detail teks */
}


/* Header */
header {
    background-color: #ff6600;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: fixed;
    top: 0;
    z-index: 999;
    width: 100%;
    height: 80px;
}

header h1 {
    font-size: 1.8rem;
    white-space: nowrap;
}

.search-and-filter {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    width: 100%;
}

#search-input, #category-select {
    padding: 0.75rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
}

#search-input {
    max-width: 300px;
}

#category-select {
    background-color: white;
    color: #333;
    cursor: pointer;
}

/* Main Content */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

#promo-container {
    background-color: #ffcc00;
    text-align: center;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
}

#product-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-image-container {
    width: 100%;
    height: 250px;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h3 {
    margin-bottom: 0.5rem;
}

.card-content p {
    color: #ff6600;
    font-weight: bold;
    margin-bottom: 1rem;
}

/* Toast Notification */
#toast-notification {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    z-index: 1002;
    transition: bottom 0.5s ease-in-out;
}

#toast-notification.show {
    bottom: 90px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid #888;
    border-radius: 8px;
    max-width: 550px; 
    position: relative;
}

.modal-content.large {
    max-width: 800px;
}

.close-button {
    color: #aaa;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

/* Product Detail Modal */
.product-details-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.product-gallery {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.main-image-container {
    position: relative;
}

.main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #eee;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 50%;
    z-index: 1;
    transition: background-color 0.2s;
    user-select: none;
    display: none;
}

.gallery-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.gallery-arrow.prev { left: 10px; }
.gallery-arrow.next { right: 10px; }

.product-thumbnails {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.thumbnail-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.thumbnail-image:hover, .thumbnail-image.active {
    border-color: #ff6600;
}

.product-info { flex: 1; }

/* Cart & Checkout Modal */
#cart-items { margin-bottom: 1rem; max-height: 40vh; overflow-y: auto; }

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.cart-item:last-child { border-bottom: none; }
.cart-item-image { width: 80px; height: 80px; object-fit: cover; border-radius: 5px; }
.cart-item-details { display: flex; flex-direction: column; }
.cart-item-name { font-weight: bold; }
.quantity-controls { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.quantity-btn { background-color: #eee; border: 1px solid #ccc; width: 28px; height: 28px; cursor: pointer; border-radius: 5px; }
.cart-item-subtotal { text-align: right; }
.cart-item-subtotal p { font-weight: bold; }
.remove-item-btn { background: none; border: none; color: #ff6600; text-decoration: underline; cursor: pointer; font-size: 0.9rem; margin-top: 0.5rem; text-align: right; }
.cart-total { text-align: right; margin-top: 1rem; font-size: 1.2rem; }
.checkout-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.checkout-form input, .checkout-form textarea { width: 100%; padding: 0.75rem; border: 1px solid #ccc; border-radius: 5px; font-size: 1rem; }

/* PERBAIKAN: Tata Letak Opsi Pembayaran */
.payment-options { margin-top: 1rem; }
.payment-options h4 { margin-bottom: 0.75rem; }
.payment-label {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}
.payment-label:has(input:checked) {
    border-color: #007bff;
    background-color: #f0f8ff;
}
.payment-label input[type="radio"] {
    margin-right: 10px;
    width: auto;
}


/* Footer */
footer { text-align: center; padding: 1.5rem; margin-top: 2rem; background-color: #333; color: white; }

/* Mobile Responsive Styles */
@media (max-width: 850px) {
    header { flex-direction: column; height: auto; padding: 1rem; }
    body { padding-top: 140px; }
    .search-and-filter { flex-direction: column; width: 100%; gap: 0.5rem; }
    #search-input, #category-select { width: 100%; max-width: none; }
    .product-details-content { flex-direction: column; }
}

@media (max-width: 600px) {
    main { padding: 1rem; }
    #product-container { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
    .modal-content { padding: 1.5rem; }
    .cart-item { grid-template-columns: 60px 1fr auto; gap: 0.75rem; }
    .cart-item-image { width: 60px; height: 60px; }
}
