/* css/style.css */

/* General Body & Font */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f9fa; /* Latar belakang sangat terang */
    color: #343a40;
    line-height: 1.6;
}

/* Navbar Customization */
.navbar {
    border-bottom: 1px solid #e0e0e0; /* Garis tipis di bawah navbar */
    padding-top: 0.5rem; /* Sedikit padding atas/bawah */
    padding-bottom: 0.5rem;
}
.navbar-brand {
    font-size: 1.8rem;
    font-weight: 700;
    color: #28a745 !important; /* Hijau Sayurbox */
    display: flex; /* Gunakan flex untuk logo dan teks jika ada */
    align-items: center;
    padding-right: 0; /* Hapus padding kanan default */
    margin-right: 15px; /* Jarak antara brand dan menu pertama */
}
.navbar-brand img { /* Gaya untuk gambar logo */
    height: 40px; /* Tinggi tetap untuk logo */
    margin-right: 0px; /* Hapus margin kanan pada gambar logo */
    object-fit: contain; /* Pastikan logo tidak terdistorsi */
}
.navbar-nav .nav-item {
    margin-right: 5px; /* Sedikit spasi antar item menu */
}
.navbar-nav .nav-link {
    font-weight: 500;
    color: #343a40 !important;
    padding: 0.5rem 0.8rem; /* Mengurangi padding link navigasi */
    transition: color 0.3s ease;
}
.navbar-nav .nav-link:hover {
    color: #28a745 !important;
}
.navbar-toggler {
    border: none;
}
.navbar-toggler:focus {
    box-shadow: none;
}
.navbar .input-group { /* Gaya untuk form pencarian di navbar */
    max-width: 250px; /* Batasi lebar maksimum search bar */
    margin-right: 15px; /* Spasi kanan dari keranjang */
}
.input-group .form-control {
    border-radius: 0.5rem 0 0 0.5rem;
}
.input-group .btn-outline-success {
    border-radius: 0 0.5rem 0.5rem 0;
    border-color: #28a745;
    color: #28a745;
}
.input-group .btn-outline-success:hover {
    background-color: #28a745;
    color: white;
}
.badge.bg-danger {
    font-size: 0.7em;
    top: -8px;
    right: -8px;
    padding: .4em .6em;
}

/* Hero Section (Carousel) */
#heroCarousel {
    margin-bottom: 3rem;
}
.hero-carousel-img {
    height: 550px; /* Tinggi lebih besar untuk hero */
    object-fit: cover;
    filter: brightness(70%); /* Sedikit lebih gelap */
}
@media (max-width: 991.98px) {
    .hero-carousel-img {
        height: 400px;
    }
}
@media (max-width: 767.98px) {
    .hero-carousel-img {
        height: 280px;
    }
    .carousel-caption h5 {
        font-size: 1.5rem;
    }
    .carousel-caption p {
        font-size: 0.85rem;
    }
}
.carousel-caption {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 15px 25px;
    border-radius: 8px;
    bottom: 15%; /* Posisikan lebih ke tengah */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    color: white;
}
.carousel-caption h5 {
    font-weight: 700;
    font-size: 2.5rem;
}
.carousel-caption p {
    font-size: 1.1rem;
}
.carousel-control-prev-icon, .carousel-control-next-icon {
    background-color: rgba(0,0,0,0.5);
    border-radius: 50%;
    padding: 15px;
}

/* Section Titles */
.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #343a40;
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    padding-bottom: 10px;
}
.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: #28a745; /* Hijau Sayurbox */
    border-radius: 2px;
}

/* Category Cards */
.category-card {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: white;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
}
.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15) !important;
}
.category-card i {
    font-size: 3.5rem; /* Ukuran ikon lebih besar */
    color: #28a745; /* Hijau Sayurbox */
    margin-bottom: 1rem;
}
.category-card h5 {
    font-weight: 600;
    font-size: 1.1rem;
    color: #343a40;
}

/* Product Cards */
.product-card {
    border: 1px solid #e0e0e0; /* Border tipis */
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: white;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}
.product-card img {
    height: 220px; /* Tinggi gambar produk */
    object-fit: cover;
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}
.product-card .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}
.product-card .card-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    height: 2.6em; /* Batasi hingga 2 baris */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* Tambahkan properti standar */
    -webkit-box-orient: vertical;
    margin-bottom: 0.5rem;
}
.product-card .card-text.text-muted {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}
.product-card .price {
    font-size: 1.35rem;
    font-weight: 700;
    color: #28a745;
    margin-top: 1rem; /* Spasi di atas harga */
    margin-bottom: 1rem;
}
.product-card .btn {
    border-radius: 0.5rem;
    font-weight: 600;
}
.product-card .btn-success {
    background-color: #28a745;
    border-color: #28a745;
}
.product-card .btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}
.product-card .btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
}
.product-card .btn-outline-primary:hover {
    background-color: #0d6efd;
    color: white;
}

/* General Buttons */
.btn-primary, .btn-success, .btn-info, .btn-warning, .btn-danger {
    border-radius: 0.5rem;
}
.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.25rem;
}
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Banner Ads Section */
.banner-ads {
    background-color: #e6f7e9; /* Latar belakang hijau muda */
    border: 1px solid #d4edda;
    padding: 3rem;
    border-radius: 1rem;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.05);
}
.banner-ads h2 {
    color: #28a745;
    font-weight: 700;
    font-size: 2.2rem;
}
.banner-ads p.lead {
    color: #343a40;
}
.banner-ads .btn-dark {
    background-color: #343a40;
    border-color: #343a40;
    font-weight: 600;
}
.banner-ads .btn-dark:hover {
    background-color: #212529;
    border-color: #212529;
}

/* Product Detail Page Styling */
.product-image-gallery img {
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, border-color 0.2s;
}
.product-image-gallery img:hover {
    transform: scale(1.02);
    border-color: #28a745;
}
.main-product-image {
    max-height: 500px;
    object-fit: contain;
    width: 100%;
}
.product-details h1 {
    color: #343a40;
    font-weight: 700;
    font-size: 2.5rem;
}
.product-details .lead.price {
    font-size: 2rem;
    font-weight: 700;
    color: #28a745;
}
.product-details .badge {
    font-size: 0.9rem;
    padding: 0.5em 0.75em;
}
.product-description {
    line-height: 1.7;
    color: #555;
    font-size: 0.95rem;
}

/* Cart Page Styling */
.list-group-item {
    display: flex;
    flex-wrap: wrap; /* Izinkan wrap pada layar kecil */
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.25rem;
    margin-right: 15px;
}

.list-group-item > div:first-child { /* Kontainer gambar dan nama produk */
    display: flex;
    align-items: center;
    flex-grow: 1; /* Izinkan tumbuh */
    margin-bottom: 0; /* Hapus margin bawah default */
}

.list-group-item > div:last-child { /* Kontainer kuantitas, harga, hapus */
    display: flex;
    align-items: center;
    flex-wrap: nowrap; /* Pastikan tidak wrap di sini */
    justify-content: flex-end; /* Dorong ke kanan */
    flex-grow: 1; /* Izinkan tumbuh */
}

.quantity-input {
    width: 60px !important; /* Lebar tetap untuk input kuantitas */
    text-align: center;
}

.input-group-sm .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Admin Panel Styling */
.admin-sidebar {
    background-color: #343a40;
    color: white;
    min-height: 100vh;
    padding-top: 20px;
}
.admin-sidebar .nav-link {
    font-family: 'Poppins', sans-serif; /* Pastikan font Poppins di admin juga */
    color: rgba(255, 255, 255, 0.85);
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background-color: #495057;
    color: #25D366; /* Warna hijau untuk item aktif/hover di admin */
}
.admin-card {
    border-radius: 0.75rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}
.admin-card h1, .admin-card h4, .admin-card h5 {
    font-family: 'Poppins', sans-serif; /* Pastikan font Poppins di admin juga */
    font-weight: 600;
}
.table thead th {
    background-color: #f1f1f1;
    font-weight: 600;
}

/* Floating Cart Button */
.floating-cart-btn {
    position: fixed;
    bottom: 20px;
    right: 20px; /* Posisikan di kanan */
    left: auto; /* Hapus posisi kiri */
    background-color: #28a745; /* Warna hijau */
    color: white;
    border-radius: 50px; /* Bentuk pil */
    padding: 15px 20px;
    font-size: 1rem;
    text-decoration: none;
    display: none; /* Sembunyikan secara default di desktop */
    z-index: 1050; /* Pastikan di atas elemen lain */
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
}

.floating-cart-btn:hover {
    background-color: #218838;
    transform: scale(1.05);
    color: white; /* Pastikan teks tetap putih saat hover */
}

.floating-cart-btn .badge {
    font-size: 0.75rem;
    padding: 0.4em 0.6em;
    position: absolute;
    top: -5px;
    right: -5px;
}


/* Responsive adjustments */
@media (min-width: 768px) { /* Desktop styles */
    .navbar-collapse {
        display: flex !important; /* Pastikan navbar collapse tampil di desktop */
        justify-content: space-between; /* Sebarkan item */
        width: 100%;
    }
    .navbar-nav.mx-auto {
        margin-left: auto !important;
        margin-right: auto !important;
    }
    .navbar-nav:last-child {
        margin-left: auto !important;
    }
    .navbar-toggler {
        display: none; /* Sembunyikan toggler di desktop */
    }
    .bottom-nav {
        display: none !important; /* Sembunyikan bottom nav di desktop */
    }
    .floating-cart-btn {
        display: flex; /* Tampilkan floating cart di desktop */
        right: 20px; /* Posisikan di kanan */
        left: auto; /* Hapus posisi kiri */
        transform: translateX(0); /* Hapus transform X */
    }
}

@media (max-width: 767.98px) { /* Mobile styles */
    .hero-section h1 {
        font-size: 2.5rem;
    }
    .hero-section p {
        font-size: 1rem;
    }
    .navbar-collapse {
        /* Default Bootstrap behavior for collapse */
        width: 100%;
    }
    .navbar-nav.mx-auto,
    .navbar-nav:last-child,
    .navbar .input-group {
        width: 100%; /* Ambil lebar penuh di mobile */
        margin-left: 0 !important;
        margin-right: 0 !important;
        justify-content: center; /* Pusatkan konten */
    }
    .navbar-nav .nav-item {
        margin-right: 0;
        text-align: center;
    }
    .navbar .input-group {
        margin-bottom: 10px;
    }
    
    /* Sembunyikan elemen desktop di mobile */
    .navbar-nav.d-md-flex,
    .form.d-md-flex,
    .navbar-nav.d-md-flex:last-child {
        display: none !important;
    }

    /* Sembunyikan toggler di mobile */
    .navbar-toggler {
        display: none !important; 
    }

    /* Penyesuaian Keranjang di Mobile */
    .list-group-item {
        flex-direction: column; /* Tumpuk item di mobile */
        align-items: flex-start;
    }
    .list-group-item > div:first-child {
        width: 100%; /* Ambil lebar penuh di mobile */
        justify-content: center; /* Pusatkan konten */
        text-align: center;
        margin-bottom: 10px;
    }
    .list-group-item > div:last-child {
        width: 100%; /* Ambil lebar penuh di mobile */
        justify-content: center; /* Pusatkan konten */
        text-align: center;
        margin-top: 10px;
        flex-direction: row; /* Biarkan elemen ini dalam baris */
        flex-wrap: wrap; /* Izinkan wrap jika terlalu sempit */
    }
    .input-group-sm {
        margin-right: 10px !important; /* Beri sedikit margin kanan */
        margin-left: 10px !important; /* Beri sedikit margin kiri */
        margin-bottom: 10px;
        width: auto !important; /* Lebar otomatis */
        max-width: 150px; /* Batasi lebar agar tidak terlalu besar */
    }
    .list-group-item span.fw-bold.me-3 {
        margin-right: 10px !important;
        margin-left: 10px !important;
        margin-bottom: 10px;
    }
    .list-group-item .btn-danger {
        margin-top: 5px;
    }

    /* Navigasi Bawah Mobile */
    .bottom-nav {
        display: flex !important; /* Tampilkan bottom nav di mobile */
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 60px; /* Tinggi navigasi bawah */
        background-color: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom); /* Untuk iPhone X notch */
    }
    .bottom-nav .nav-item-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        font-size: 0.75rem;
        color: #6c757d; /* Warna teks default */
        transition: color 0.2s ease;
        padding: 5px 0;
    }
    .bottom-nav .nav-item-bottom:hover {
        color: #28a745; /* Warna hijau saat hover */
    }
    .bottom-nav .nav-item-bottom i {
        font-size: 1.2rem;
        margin-bottom: 3px;
    }
    .bottom-nav .nav-item-bottom span.badge {
        position: absolute;
        top: 0px;
        right: 5px;
        font-size: 0.6em;
        padding: 0.3em 0.5em;
    }

    /* Sesuaikan padding body agar tidak tertutup bottom nav */
    body {
        padding-bottom: 60px; /* Tinggi bottom-nav */
    }

    /* Sembunyikan floating cart button di mobile */
    .floating-cart-btn {
        display: none !important;
    }
}