@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --xriva-primary: #84a98c;     /* Sage green utama */
    --xriva-dark: #52796f;        /* Hijau gelap untuk teks/header */
    --xriva-light: #cad2c5;       /* Hijau sangat terang untuk background */
    --xriva-bg: #f8f9fa;          /* Background abu-abu sangat muda */
    --xriva-text: #2f3e46;        /* Warna teks utama */
    --xriva-white: #ffffff;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--xriva-bg);
    color: var(--xriva-text);
    -webkit-font-smoothing: antialiased;
}

/* --- NAVBAR MODERN --- */
.navbar-sage {
    background-color: var(--xriva-dark);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding-top: 10px;
    padding-bottom: 10px;
}
.navbar-brand { letter-spacing: 1px; }

/* --- BUTTONS & HOVER EFFECTS --- */
.btn-sage {
    background-color: var(--xriva-primary);
    color: var(--xriva-white);
    border: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}
.btn-sage:hover {
    background-color: var(--xriva-dark);
    color: var(--xriva-white);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(82, 121, 111, 0.3);
}

.btn-outline-sage {
    color: var(--xriva-dark);
    border: 2px solid var(--xriva-primary);
    border-radius: 8px;
    transition: all 0.3s ease;
}
.btn-outline-sage:hover {
    background-color: var(--xriva-primary);
    color: var(--xriva-white);
}

/* --- CARD PRODUK MODERN --- */
.card {
    border-radius: 16px; /* Sudut lebih membulat */
    border: 1px solid rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    overflow: hidden; /* Agar gambar mengikuti sudut membulat */
}

/* --- CARD PRODUK MODERN (REVISI) --- */
.product-card {
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100%; /* Biar tinggi card sama semua */
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* --- KUNCI MENGUNCI GAMBAR BIAR GAK TUMPAH --- */
.product-card .img-wrap {
    position: relative;
    background: #fff;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 220px; /* Tinggi kotak gambar */
    width: 100%; /* Lebar harus 100% dari card */
    overflow: hidden; /* WAJIB: Memotong gambar yang melebihi batas kotak */
}

.product-card .img-wrap a {
    display: block;
    width: 100%;
    height: 100%;
}

.product-card .img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.5s ease;
}

.product-card:hover img {
    transform: scale(1.1);
}

.img-out-of-stock {
    filter: grayscale(100%);
    opacity: 0.6;
}

/* --- DETAIL PRODUK DI CARD --- */
.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-info .category {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.product-info .product-name {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--xriva-text);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8rem; /* Biar nama produk yang panjang gak ngerusak layout */
}

.product-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--xriva-dark);
}

.btn-tambah {
    background-color: var(--xriva-primary);
    color: white;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    text-decoration: none;
    transition: 0.2s;
}

.btn-tambah:hover {
    background-color: var(--xriva-dark);
    color: white;
}

/* --- INPUT FORMS --- */
.form-control, .input-group-text {
    border-radius: 8px;
    border: 1px solid #dee2e6;
}
.form-control:focus {
    border-color: var(--xriva-primary);
    box-shadow: 0 0 0 0.25rem rgba(132, 169, 140, 0.25);
}

/* --- CHATBOT UI ENHANCEMENT --- */
#chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 450px;
    background-color: white;
    border-radius: 20px;
    display: none;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 9999;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

.chatbot-header {
    background-color: var(--xriva-dark);
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #fcfdfc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Bubble Chat Bot */
.bot-message {
    background-color: #e9ecef;
    color: #333;
    padding: 10px 14px;
    border-radius: 15px 15px 15px 5px;
    max-width: 85%;
    font-size: 0.9rem;
    align-self: flex-start;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* Bubble Chat User */
.user-message {
    background-color: var(--xriva-primary);
    color: white;
    padding: 10px 14px;
    border-radius: 15px 15px 5px 15px;
    max-width: 85%;
    font-size: 0.9rem;
    align-self: flex-end;
    font-weight: 500;
}

/* Tombol Saran (Quick Replies) */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
}
.btn-suggestion {
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--xriva-primary);
    background: white;
    color: var(--xriva-dark);
    transition: all 0.2s;
    cursor: pointer;
}
.btn-suggestion:hover {
    background-color: var(--xriva-primary);
    color: white;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 15px;
    outline: none;
}

#chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background-color: var(--xriva-dark);
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 9999;
}

/* --- TEXT & BACKGROUND COLORS (Utility) --- */
.text-sage-dark  { color: var(--xriva-dark)    !important; }
.text-sage       { color: var(--xriva-primary) !important; }
.bg-sage-light   { background-color: var(--xriva-light)   !important; }
.bg-sage-dark    { background-color: var(--xriva-dark)    !important; }
.bg-sage-primary { background-color: var(--xriva-primary) !important; }

/* --- NAVBAR ACTIVE LINK & ANIMATED UNDERLINE --- */
.navbar-sage .nav-link {
    position: relative;
    color: rgba(255,255,255,0.85) !important;
    transition: color 0.25s ease;
}
.navbar-sage .nav-link:hover {
    color: #ffffff !important;
}
.navbar-sage .nav-link.active {
    font-weight: 700;
    color: #ffffff !important;
}

/* Sliding pill indicator — satu-satunya garis */
#nav-slider {
    position: absolute;
    bottom: 0;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: left 0.35s cubic-bezier(0.4,0,0.2,1),
                width 0.35s cubic-bezier(0.4,0,0.2,1),
                opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}
#nav-slider.visible {
    opacity: 1;
}

/* --- BACK TO TOP BUTTON --- */
#backToTop {
    position: fixed;
    bottom: 110px;
    right: 28px;
    z-index: 9998;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--xriva-dark);
    color: #fff;
    border: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
#backToTop.show {
    opacity: 1;
    transform: translateY(0);
}
#backToTop:hover {
    background-color: var(--xriva-primary);
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* --- SKELETON LOADING --- */
.skeleton-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.skeleton-img {
    width: 100%;
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton-line {
    height: 14px;
    border-radius: 8px;
    margin: 10px 16px 6px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.skeleton-line.short { width: 55%; margin-top: 4px; }
.skeleton-line.btn   { height: 36px; border-radius: 8px; margin: 12px 16px; }
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


.stock-warning {
    color: #d63384; /* Warna pink/merah muda untuk peringatan */
    font-weight: 700;
    font-size: 0.85rem;
    animation: blink 1s infinite;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.btn-buy-now {
    background-color: var(--xriva-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    transition: 0.3s;
}

.btn-buy-now:hover {
    background-color: var(--xriva-dark);
    color: white;
    transform: translateY(-2px);
}

/* --- CUSTOM STAR RATING FORM --- */
.star-rating-form {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.15rem;
}
.star-rating-form input[type="radio"] {
    display: none;
}
.star-rating-form label {
    cursor: pointer;
    font-size: 1.5rem;
    color: #e4e5e9;
    transition: color 0.2s;
}
.star-rating-form input[type="radio"]:checked ~ label {
    color: #ffc107;
}
.star-rating-form label:hover,
.star-rating-form label:hover ~ label {
    color: #ffc107;
}

/* --- PAGINATION TEMA SAGE --- */
.pagination .page-link {
    color: var(--xriva-dark);
    border: none;
    margin: 0 4px;
    border-radius: 50px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s;
}
.pagination .page-item.active .page-link {
    background-color: var(--xriva-dark);
    color: white;
    box-shadow: 0 4px 10px rgba(82, 121, 111, 0.3);
}
.pagination .page-link:hover {
    background-color: var(--xriva-primary);
    color: white;
}
.pagination .page-item.disabled .page-link {
    color: #adb5bd;
    background-color: transparent;
}

/* --- MOBILE RESPONSIVE TWEAKS --- */
@media (max-width: 768px) {
    /* Hero Section */
    .hero-section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    .hero-title {
        font-size: 1.8rem !important;
    }
    .hero-subtitle {
        font-size: 0.95rem !important;
        padding: 0 10px;
    }
    .search-input {
        font-size: 0.95rem !important;
    }
    
    /* Category Scroll */
    .kategori-scroll::-webkit-scrollbar {
        display: none; /* Hide scrollbar completely on mobile for app-like feel */
    }
    .kategori-scroll {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    .category-pill {
        padding: 5px 16px;
        font-size: 0.85rem;
    }

    /* Chatbot Toggle */
    #chatbot-toggle {
        width: 50px !important;
        height: 50px !important;
        bottom: 15px !important;
        right: 15px !important;
    }
    #chatbot-toggle i {
        font-size: 1.4rem !important;
    }
    
    /* Product Grid */
    .card-title {
        font-size: 1rem !important;
    }
}
