/* =========================================================
   KRISHNA STORES STYLE
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family:
        Arial,
        "Noto Sans Malayalam",
        sans-serif;
    background: #f7f8fa;
    color: #202124;
    line-height: 1.5;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}


/* =========================================================
   HEADER
   ========================================================= */

.header {
    position: sticky;
    top: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding: 14px 5%;

    background: rgba(255, 255, 255, 0.97);

    border-bottom: 1px solid #e5e7eb;

    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.06);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 46px;
    height: 46px;

    display: grid;
    place-items: center;

    border-radius: 12px;

    background: #111827;
    color: white;

    font-weight: 800;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
}

.brand p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.cart-button {
    border: 0;

    padding: 10px 15px;

    border-radius: 12px;

    background: #111827;
    color: white;

    font-weight: 700;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.cart-button:hover {
    background: #1f2937;
    transform: translateY(-1px);
}

#cartCount {
    display: inline-grid;

    min-width: 22px;
    height: 22px;

    margin-left: 5px;

    place-items: center;

    border-radius: 50%;

    background: white;
    color: #111827;

    font-size: 12px;
}


/* =========================================================
   HERO
   ========================================================= */

.hero {
    padding: 65px 5%;

    background:
        linear-gradient(
            135deg,
            #eef2ff,
            #ffffff
        );
}

.hero h2 {
    margin: 0 0 8px;

    font-size:
        clamp(30px, 5vw, 52px);
}

.hero h3 {
    margin: 0 0 18px;

    font-size:
        clamp(19px, 3vw, 28px);

    font-weight: 600;
}

.hero p {
    max-width: 650px;

    color: #4b5563;
}


/* =========================================================
   SECTIONS
   ========================================================= */

.section {
    width: min(1200px, 90%);

    margin: auto;

    padding: 55px 0;
}

.section-heading {
    display: flex;

    justify-content: space-between;
    align-items: end;

    gap: 20px;

    margin-bottom: 25px;
}

.section h2 {
    margin-bottom: 5px;
}

.section-heading p {
    margin: 3px 0;

    color: #6b7280;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.primary-btn {
    border: 0;

    background: #111827;
    color: white;

    padding: 13px 20px;

    border-radius: 10px;

    font-weight: 700;

    transition:
        transform 0.15s ease,
        opacity 0.15s ease,
        background 0.15s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    border: 1px solid #d1d5db;

    background: white;
    color: #111827;

    padding: 12px 20px;

    border-radius: 10px;

    font-weight: 700;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.secondary-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.whatsapp-btn {
    border: 0;

    background: #25d366;
    color: white;

    padding: 13px 20px;

    border-radius: 10px;

    font-weight: 700;

    margin: 10px;

    transition:
        transform 0.15s ease,
        background 0.15s ease;
}

.whatsapp-btn:hover {
    background: #20bd5a;
    transform: translateY(-1px);
}

.full-btn {
    width: 100%;
}


/* =========================================================
   CATEGORY
   ========================================================= */

.category-grid {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 15px;
}

.category-card {
    display: flex;

    flex-direction: column;

    gap: 5px;

    align-items: center;

    padding: 25px 15px;

    border: 1px solid #e5e7eb;

    border-radius: 16px;

    background: white;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.category-card:hover {
    transform: translateY(-3px);

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.08);

    border-color: #d1d5db;
}

.category-card strong {
    font-size: 17px;
}

.category-card span {
    color: #6b7280;

    font-size: 14px;
}


/* =========================================================
   SEARCH
   ========================================================= */

.search-input {
    width: min(320px, 100%);

    padding: 13px 15px;

    border: 1px solid #d1d5db;

    border-radius: 10px;

    outline: none;

    background: white;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.search-input:focus {
    border-color: #111827;

    box-shadow:
        0 0 0 3px rgba(17, 24, 39, 0.08);
}


/* =========================================================
   FILTERS
   ========================================================= */

.filter-row {
    display: flex;

    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 25px;
}

.filter-btn {
    border: 1px solid #d1d5db;

    background: white;

    padding: 9px 13px;

    border-radius: 9px;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
}

.filter-btn:hover {
    border-color: #111827;
}

.filter-btn.active {
    background: #111827;

    color: white;

    border-color: #111827;
}


/* =========================================================
   PRODUCTS
   EXACTLY 2 PRODUCTS PER ROW
   ========================================================= */

.products-grid {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 18px;

    width: 100%;
}

.product-card {
    width: 100%;

    min-width: 0;

    overflow: hidden;

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 16px;

    box-shadow:
        0 3px 12px rgba(0, 0, 0, 0.04);

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.product-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.08);
}

.product-image-wrapper {
    width: 100%;

    aspect-ratio: 1 / 1;

    background: #f3f4f6;

    overflow: hidden;
}

.product-image {
    width: 100%;

    height: 100%;

    object-fit: cover;

    display: block;
}

.product-content {
    padding: 15px;
}

.category-label {
    color: #6b7280;

    font-size: 12px;

    text-transform: uppercase;

    margin-bottom: 5px;
}

.product-content h3 {
    margin: 0;

    font-size: 18px;

    line-height: 1.3;
}

.malayalam-product-name {
    margin-top: 2px;

    font-size: 15px;

    color: #4b5563;

    font-family:
        "Noto Sans Malayalam",
        Arial,
        sans-serif;
}

.unit-select {
    width: 100%;

    margin-top: 12px;

    padding: 9px;

    border: 1px solid #d1d5db;

    border-radius: 8px;

    background: white;

    outline: none;
}

.unit-select:focus {
    border-color: #111827;
}

.product-bottom {
    margin-top: 13px;
}


/* =========================================================
   ADD TO CART BUTTON
   ========================================================= */

.add-btn {
    width: 100%;

    border: 1px solid #111827;

    background: #111827;

    color: white;

    padding: 11px 10px;

    border-radius: 9px;

    font-weight: 700;

    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease;
}

.add-btn:hover {
    background: #1f2937;
}

.add-btn:active {
    transform: scale(0.98);
}


/* AFTER PRODUCT IS ADDED */

.add-btn.added {
    background: #e5e7eb;

    color: #374151;

    border-color: #d1d5db;

    cursor: default;
}

.add-btn.added:hover {
    background: #e5e7eb;

    color: #374151;

    border-color: #d1d5db;

    transform: none;
}

.selected-info {
    margin-top: 8px;

    font-size: 12px;

    color: #6b7280;

    text-align: center;
}


/* =========================================================
   CART
   ========================================================= */

.cart-section {
    background: #f9fafb;
}

.cart-item {
    display: grid;

    grid-template-columns:
        1fr auto auto auto;

    align-items: center;

    gap: 15px;

    padding: 15px;

    margin-bottom: 10px;

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 12px;
}

.cart-item-info {
    display: flex;

    flex-direction: column;
}

.malayalam-small {
    color: #6b7280;

    font-size: 14px;

    font-family:
        "Noto Sans Malayalam",
        Arial,
        sans-serif;
}

.quantity-control {
    display: flex;

    align-items: center;

    gap: 10px;
}

.quantity-control button {
    width: 32px;

    height: 32px;

    border: 1px solid #d1d5db;

    background: white;

    border-radius: 8px;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.quantity-control button:hover {
    background: #f3f4f6;

    border-color: #9ca3af;
}

.remove-btn {
    border: 0;

    background: transparent;

    color: #dc2626;

    font-size: 13px;

    padding: 6px 8px;
}

.remove-btn:hover {
    text-decoration: underline;
}

.cart-summary {
    margin-top: 20px;

    padding: 20px;

    background: white;

    border: 1px solid #e5e7eb;

    border-radius: 14px;
}

.cart-summary > div {
    display: flex;

    justify-content: space-between;

    margin-bottom: 10px;
}


/* =========================================================
   CHECKOUT
   ========================================================= */

.checkout-section {
    max-width: 700px;
}

.checkout-section form {
    display: grid;

    gap: 17px;
}

.checkout-section label {
    display: grid;

    gap: 7px;

    font-weight: 700;
}

.checkout-section input,
.checkout-section select {
    width: 100%;

    padding: 13px;

    border: 1px solid #d1d5db;

    border-radius: 10px;

    background: white;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.checkout-section input:focus,
.checkout-section select:focus {
    border-color: #111827;

    box-shadow:
        0 0 0 3px rgba(17, 24, 39, 0.08);
}

.checkout-note {
    padding: 15px;

    background: #f3f4f6;

    border-radius: 10px;

    color: #4b5563;
}


/* =========================================================
   CONFIRMATION
   ========================================================= */

.confirmation {
    text-align: center;

    max-width: 700px;
}

.success-icon {
    width: 70px;

    height: 70px;

    margin: auto;

    display: grid;

    place-items: center;

    border-radius: 50%;

    background: #dcfce7;

    color: #166534;

    font-size: 35px;

    font-weight: 900;
}

.order-number {
    display: inline-block;

    margin: 10px 0 20px;

    padding: 12px 20px;

    background: #111827;

    color: white;

    border-radius: 10px;

    font-size: 22px;

    font-weight: 800;

    letter-spacing: 1px;
}


/* =========================================================
   LOADING / EMPTY / ERROR
   ========================================================= */

.loading,
.empty-box,
.error-box {
    padding: 30px;

    text-align: center;

    background: white;

    border-radius: 12px;

    border: 1px solid #e5e7eb;
}

.error-box {
    color: #991b1b;

    background: #fef2f2;
}


/* =========================================================
   HIDDEN
   ========================================================= */

.hidden {
    display: none !important;
}


/* =========================================================
   FOOTER
   ========================================================= */

footer {
    padding: 35px 5%;

    text-align: center;

    background: #111827;

    color: white;
}

footer p {
    color: #d1d5db;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .section {
        width: 92%;
    }

    .category-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

    /*
       PRODUCTS STAY 2 PER ROW
    */

    .products-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 14px;
    }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 650px) {

    .header {
        padding: 10px 4%;
    }

    .brand {
        gap: 8px;
    }

    .brand-icon {
        width: 40px;

        height: 40px;

        border-radius: 10px;
    }

    .brand h1 {
        font-size: 17px;
    }

    .brand p {
        font-size: 12px;
    }

    .cart-button {
        padding: 8px 10px;

        font-size: 12px;
    }

    .hero {
        padding: 45px 5%;
    }

    .hero h2 {
        font-size: 32px;
    }

    .hero h3 {
        font-size: 20px;
    }

    .section {
        width: 92%;

        padding: 40px 0;
    }

    .section-heading {
        align-items: stretch;

        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }


    /* =====================================================
       ALWAYS 2 PRODUCTS PER ROW
       ===================================================== */

    .products-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 10px;
    }

    .product-card {
        width: 100%;
    }

    .product-content {
        padding: 10px;
    }

    .category-label {
        font-size: 10px;
    }

    .product-content h3 {
        font-size: 15px;

        line-height: 1.25;
    }

    .malayalam-product-name {
        font-size: 13px;

        line-height: 1.3;
    }

    .unit-select {
        margin-top: 9px;

        padding: 8px;

        font-size: 12px;
    }

    .product-bottom {
        margin-top: 9px;
    }

    .add-btn {
        font-size: 12px;

        padding: 9px 5px;

        border-radius: 8px;
    }

    .selected-info {
        font-size: 11px;
    }


    /* =====================================================
       CATEGORY
       ===================================================== */

    .category-grid {
        grid-template-columns:
            repeat(2, 1fr);

        gap: 10px;
    }

    .category-card {
        padding: 20px 10px;
    }

    .category-card strong {
        font-size: 15px;
    }

    .category-card span {
        font-size: 12px;
    }


    /* =====================================================
       CART
       ===================================================== */

    .cart-item {
        grid-template-columns: 1fr;

        gap: 10px;
    }

    .quantity-control {
        justify-content: center;
    }

    .remove-btn {
        justify-self: center;
    }


    /* =====================================================
       CHECKOUT
       ===================================================== */

    .checkout-section {
        width: 100%;
    }

    .checkout-section input,
    .checkout-section select {
        padding: 12px;
    }


    /* =====================================================
       CONFIRMATION
       ===================================================== */

    .order-number {
        font-size: 18px;

        padding: 10px 15px;
    }
}


/* =========================================================
   SMALL MOBILE
   IMPORTANT: STILL 2 PRODUCTS PER ROW
   ========================================================= */

@media (max-width: 400px) {

    .products-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 8px;
    }

    .product-content {
        padding: 8px;
    }

    .product-content h3 {
        font-size: 14px;
    }

    .malayalam-product-name {
        font-size: 12px;
    }

    .add-btn {
        font-size: 11px;

        padding: 8px 3px;
    }

    .category-grid {
        grid-template-columns:
            1fr 1fr;
    }
}