:root {
    --primary-green: #235A33;
    --light-green: #E8F1EB;
    --accent-orange: #EF7F1A;
    --text-dark: #222222;
    --white: #FFFFFF;
    --card-border: #E2E8F0;
    --footer-bg: #143424;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    overflow-x: hidden;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: var(--text-dark);
    background-color: var(--white);
}

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==========================================
   HEADER & NAVIGATION
   ========================================== */
header {
    background-color: var(--white);
    border-bottom: 1px solid #EEE;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

/* Logo Styling */
.logo-container {
    flex-shrink: 0;
}

.logo-img {
    height: 80px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    display: block;
}

.logo-container a {
    text-decoration: none;
    font-weight: 900;
    font-size: 1.3rem;
    color: var(--primary-green);
    letter-spacing: 0.5px;
}

/* Modern Rounded Search Bar */
.search-bar-container {
    display: flex;
    align-items: center;
    flex: 1 1 250px;
    min-width: 200px;
    max-width: 480px;
    background: #F1F5F9;
    border: 1.5px solid #E2E8F0;
    border-radius: 30px;
    padding: 3px 6px 3px 16px;
    transition: all 0.2s ease;
}

.search-bar-container:focus-within {
    border-color: var(--primary-green);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(35, 90, 51, 0.15);
}

.search-input {
    width: 100%;
    min-width: 120px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
    color: var(--text-dark);
}

.search-btn {
    background: var(--primary-green);
    color: white;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s ease;
}

.search-btn:hover {
    background: #1B4527;
}

/* Header Icons & Cart Button */
.header-icons {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.icon-cart {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 55px;
    min-height: 38px;

    background: #F8FAFC;
    border: 1px solid #E2E8F0;

    padding: 8px 12px;

    border-radius: 20px;

    color: var(--primary-green);

    font-size: 1.2em;
    font-weight: bold;

    cursor: pointer;

    transition: all 0.2s ease;
}

.icon-cart:hover {
    background: var(--light-green);
    border-color: var(--primary-green);
    transform: translateY(-1px);
}

.cart-badge {
    display: flex;
    align-items: center;
    justify-content: center;

    min-width: 19px;
    height: 19px;

    background: var(--accent-orange);
    color: white;

    font-size: 0.7rem;
    font-weight: 700;

    border-radius: 50%;

    margin-left: 6px;

    padding: 0 4px;
}

/* Centered Navigation Bar */
.category-nav {
    background-color: var(--primary-green);
    position: sticky;
    top: 66px;
    z-index: 999;
}

.nav-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 0;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.nav-container::-webkit-scrollbar {
    display: none;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
    background-color: var(--accent-orange);
    color: var(--white);
}

@media (max-width: 767px) {
    .nav-container {
        justify-content: flex-start;
    }
}

/* ==========================================
   MAIN CONTENT & PRODUCTS GRID
   ========================================== */
.hero {
    background-color: var(--light-green);
    padding: 25px 0;
    text-align: center;
}

.hero h1 {
    color: var(--primary-green);
    font-size: 1.8em;
    margin-bottom: 5px;
    font-weight: 800;
}

.hero p {
    color: var(--primary-green);
    font-size: 1em;
}

.products-section {
    padding: 30px 0;
}

.products-title {
    color: var(--primary-green);
    margin-bottom: 20px;
    font-size: 1.3em;
}

.product-grid {
    display: grid;
    width: 100%;
    gap: 12px;
}

@media (max-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* Product Cards */
.product-card {
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    background: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
    background-color: #F1F5F9;
}

/* Hide broken browser icon when img src is empty */
img[src=""], img:not([src]) {
    display: none;
}

.product-card h3 {
    font-size: 0.95em;
    color: var(--primary-green);
    margin-bottom: 6px;
    min-height: 2.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card .price-tag {
    font-size: 0.85em;
    margin-bottom: 8px;
    color: #555;
}

.product-card .price-tag strong {
    color: var(--primary-green);
    font-size: 1.05em;
}

.weight-select {
    width: 100%;
    padding: 7px;
    margin-bottom: 10px;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    background-color: #F8FAFC;
    font-size: 0.85em;
    outline: none;
}

.add-to-cart-btn {
    background-color: var(--accent-orange);
    color: var(--white);
    border: none;
    padding: 9px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.8em;
    cursor: pointer;
    width: 100%;
}

.add-to-cart-btn:hover {
    background-color: #D96E10;
}

/* ==========================================
   FOOTER
   ========================================== */
footer {
    background-color: var(--footer-bg);
    color: var(--white);
    padding-top: 30px;
    margin-top: 40px;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding-bottom: 25px;
}

.footer-col h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: var(--accent-orange);
}

.footer-col h4 {
    font-size: 1em;
    margin-bottom: 10px;
    color: var(--white);
}

.footer-col p, .footer-col ul li a {
    font-size: 0.85em;
    line-height: 1.5;
    color: #D1D5DB;
    text-decoration: none;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 6px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    padding: 12px 0;
    font-size: 0.8em;
    color: #9CA3AF;
}

.footer-logo {
    width: 150px;
    height: auto;
    display: block;
    margin-bottom: 15px;
    object-fit: contain;
}
/* =========================
   SHOPPING CART
   ========================= */

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1999;
    display: none;
}

.cart-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90%;
    height: 100vh;
    background: var(--white);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
}

.cart-panel.active {
    right: 0;
}

.cart-overlay.active {
    display: block;
}

/* Cart header */

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #E2E8F0;
}

.cart-header h2 {
    color: var(--primary-green);
    font-size: 1.3rem;
}

.cart-close {
    border: none;
    background: none;
    font-size: 2rem;
    color: #555;
    cursor: pointer;
    line-height: 1;
}

/* Cart items */

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.empty-cart {
    text-align: center;
    color: #777;
    margin-top: 40px;
}

/* Cart item */

.cart-item {
    border-bottom: 1px solid #E2E8F0;
    padding: 15px 0;
}

.cart-item h4 {
    color: var(--primary-green);
    margin-bottom: 5px;
}

.cart-item-info {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
}

.cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-quantity button {
    width: 28px;
    height: 28px;
    border: 1px solid #CBD5E1;
    background: #F8FAFC;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.cart-quantity span {
    min-width: 20px;
    text-align: center;
}

.cart-item-price {
    color: var(--primary-green);
    font-weight: bold;
}

/* Cart footer */

.cart-footer {
    border-top: 1px solid #E2E8F0;
    padding: 18px 20px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1.05rem;
}

.cart-total strong {
    color: var(--primary-green);
}

.checkout-btn {
    width: 100%;
    border: none;
    background: var(--accent-orange);
    color: white;
    padding: 12px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
}

.checkout-btn:hover {
    background: #D96E10;
}

/* =========================
   CHECKOUT
   ========================= */

.checkout-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.55);
    padding: 20px;
    overflow-y: auto;
}

.checkout-overlay.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.checkout-panel {
    width: 100%;
    max-width: 520px;
    background: var(--white);
    border-radius: 12px;
    margin: auto;
    padding: 24px;
}

.checkout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.checkout-header h2 {
    color: var(--primary-green);
}

.checkout-close {
    border: none;
    background: none;
    font-size: 30px;
    cursor: pointer;
    color: #555;
}

#checkout-form label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

#checkout-form input,
#checkout-form select,
#checkout-form textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #CBD5E1;
    border-radius: 7px;
    font: inherit;
    background: #FFFFFF;
}

#checkout-form input:focus,
#checkout-form select:focus,
#checkout-form textarea:focus {
    outline: 2px solid var(--light-green);
    border-color: var(--primary-green);
}

.checkout-summary {
    background: var(--light-green);
    padding: 16px;
    border-radius: 8px;
    margin: 22px 0;
}

.checkout-summary > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.checkout-summary > div:last-child {
    margin-bottom: 0;
}

.checkout-summary strong {
    color: var(--primary-green);
}

.checkout-grand-total {
    border-top: 1px solid #C7D8CB;
    padding-top: 12px;
    font-size: 1.1rem;
    font-weight: bold;
}

.place-order-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 25px;
    background: var(--accent-orange);
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.place-order-btn:hover {
    background: #D96E10;
}

.checkout-note {
    margin-top: 12px;
    text-align: center;
    color: #666;
    font-size: 0.8rem;
}

/* ADD-TO-CART NOTIFICATION */

.cart-notification {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translate(-50%, 20px);
    background: var(--primary-green);
    color: #FFFFFF;
    padding: 13px 22px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    width: max-content;
    max-width: calc(100% - 30px);
    opacity: 0;
    visibility: hidden;
    z-index: 4000;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.cart-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}


/* Product action buttons */

.product-actions {
    display: flex;
    gap: 7px;
    margin-top: 8px;
}

.product-actions button {
    flex: 1;
    min-width: 0;
    padding: 9px 5px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: bold;
    cursor: pointer;
}

.product-actions .add-to-cart-btn {
    background: var(--accent-orange);
    color: #FFFFFF;
    border: none;
}

.product-actions .remove-product-btn {
    background: #FFFFFF;
    color: #B42318;
    border: 1px solid #B42318;
}

.product-actions .remove-product-btn:hover {
    background: #FDECEC;
}

@media (max-width: 480px) {
    .checkout-overlay {
        padding: 10px;
    }

    .checkout-panel {
        padding: 18px;
    }
}
/* ==========================================
   MOBILE HEADER
   ========================================== */

@media (max-width: 767px) {

    .header-container {
        gap: 8px;
    }

    .logo-img {
        height: 42px;
        max-width: 100px;
    }

    .search-bar-container {
        min-width: 0;
        flex: 1;
        padding-left: 12px;
    }

    .search-input {
        min-width: 0;
        font-size: 0.8rem;
    }

    .search-btn {
        width: 32px;
        height: 32px;
    }

    .icon-cart {
        min-width: 52px;
        min-height: 38px;
        padding: 7px 9px;
    }

    .cart-badge {
        min-width: 20px;
        height: 20px;
        margin-left: 5px;
        font-size: 0.7rem;
        padding: 0;
    }
}
/* Mobile cart */

@media (max-width: 767px) {

    .cart-panel {
        width: 100%;
        max-width: 100%;
        right: -100%;
    }

    .cart-panel.active {
        right: 0;
    }
}

/* M-Pesa payment section */
#mpesa-payment-box {
    margin-top: 24px;
    padding: 24px;
    background: #F0F7F1;
    border: 1px solid #C9DDCC;
    border-left: 5px solid #235A33;
    border-radius: 14px;
    color: #1B3D23;
    box-shadow: 0 5px 18px rgba(35, 90, 51, 0.08);
    line-height: 1.6;
}

#mpesa-payment-box h3 {
    margin: 0 0 16px;
    color: #235A33;
    font-size: 21px;
    font-weight: 700;
}

#mpesa-payment-box p {
    margin: 10px 0;
    font-size: 15px;
}

#mpesa-payment-box strong {
    color: #235A33;
    font-weight: 700;
}

#mpesa-payment-box input,
#mpesa-payment-box select {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px solid #C9DDCC;
    border-radius: 8px;
    background: #FFFFFF;
    color: #1B3D23;
    font: inherit;
    box-sizing: border-box;
}

#mpesa-payment-box input:focus,
#mpesa-payment-box select:focus {
    outline: none;
    border-color: #235A33;
    box-shadow: 0 0 0 3px rgba(35, 90, 51, 0.12);
}

#mpesa-payment-box button {
    display: inline-block;
    margin-top: 14px;
    padding: 12px 22px;
    border: none;
    border-radius: 8px;
    background: #EF7F1A;
    color: #FFFFFF;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

#mpesa-payment-box button:hover {
    background: #D96C0E;
    transform: translateY(-1px);
}

#mpesa-payment-box button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#mpesa-payment-box button:focus-visible {
    outline: 3px solid rgba(239, 127, 26, 0.35);
    outline-offset: 3px;
}

@media (max-width: 600px) {
    #mpesa-payment-box {
        padding: 18px;
        margin-top: 18px;
    }

    #mpesa-payment-box h3 {
        font-size: 19px;
    }

    #mpesa-payment-box button {
        width: 100%;
    }
}

/* Notify Epic Spice - M-Pesa payment confirmation */
#mpesa-payment-box button,
#mpesa-payment-box input[type="submit"] {
    font-family: inherit;
}

#mpesa-payment-box form {
    margin-top: 18px;
    padding: 18px;
    background: #FFFFFF;
    border: 1px solid #D8E6DA;
    border-radius: 12px;
}

#mpesa-payment-box form label {
    display: block;
    margin: 12px 0 6px;
    color: #235A33;
    font-size: 14px;
    font-weight: 600;
}

#mpesa-payment-box form button,
#mpesa-payment-box button[type="submit"] {
    width: 100%;
    margin-top: 14px;
    padding: 14px 18px;
    background: #235A33;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

#mpesa-payment-box form button:hover,
#mpesa-payment-box button[type="submit"]:hover {
    background: #1B3D23;
}

#mpesa-payment-box .payment-message,
#mpesa-payment-box .mpesa-message,
#mpesa-payment-box #mpesa-message {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

#mpesa-payment-box .payment-message.success,
#mpesa-payment-box .mpesa-message.success,
#mpesa-payment-box #mpesa-message.success {
    background: #E8F5E9;
    color: #235A33;
    border: 1px solid #B8D8BD;
}

#mpesa-payment-box .payment-message.error,
#mpesa-payment-box .mpesa-message.error,
#mpesa-payment-box #mpesa-message.error {
    background: #FFF0ED;
    color: #A52B1D;
    border: 1px solid #F0C4BC;
}

/* Style the Notify Epic Spice link */
#mpesa-payment-box a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
    padding: 13px 20px;
    background: #235A33;
    color: #FFFFFF !important;
    text-decoration: none !important;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    border: 1px solid #235A33;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(35, 90, 51, 0.15);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease,
                box-shadow 0.2s ease;
}

#mpesa-payment-box a:hover {
    background: #EF7F1A;
    border-color: #EF7F1A;
    color: #FFFFFF !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(239, 127, 26, 0.22);
}

#mpesa-payment-box a:focus-visible {
    outline: 3px solid rgba(239, 127, 26, 0.4);
    outline-offset: 3px;
}

@media (max-width: 600px) {
    #mpesa-payment-box a {
        display: flex;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }
}

footer a:hover,
footer a:focus {
  color: #FFD700 !important;
}