/* ==========================================
   WHATSORDER PUBLIC STOREFRONT
   COMPLETE STYLE.CSS
========================================== */


/* ==========================================
   GLOBAL RESET
========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


html {
    scroll-behavior: smooth;
}


body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f6f7f9;
    color: #222;
    line-height: 1.5;
}


.container {
    width: 92%;
    max-width: 1200px;
    margin: auto;
}


/* ==========================================
   HEADER
========================================== */

.store-header {
    background: #111827;
    color: white;
    padding: 24px 0;
}


.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}


.store-header h1 {
    font-size: 28px;
}


.store-header p {
    opacity: 0.8;
    margin-top: 4px;
}

.store-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}


.track-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    transition: 0.2s ease;
}


.track-order-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}


.cart-button {
    background: #25d366;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 15px;
    white-space: nowrap;
    transition: 0.2s ease;
}


.cart-button:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}


#cartCount {
    background: white;
    color: #111;
    padding: 3px 8px;
    margin-left: 6px;
    border-radius: 20px;
}


/* ==========================================
   SEARCH
========================================== */

.search-section {
    margin: 30px 0;
}


.search-section input {
    width: 100%;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    background: white;
    transition: 0.2s ease;
}


.search-section input:focus {
    border-color: #25d366;
    box-shadow:
        0 0 0 3px rgba(37, 211, 102, 0.10);
}


/* ==========================================
   SECTION HEADING
========================================== */

.section-heading {
    margin-bottom: 20px;
}


.section-heading h2 {
    font-size: 25px;
}


.section-heading p {
    color: #666;
    margin-top: 3px;
}


/* ==========================================
   PRODUCT GRID
========================================== */

.product-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(240px, 280px));

    gap: 22px;

    justify-content: start;

    align-items: stretch;
}


/* ==========================================
   PRODUCT CARD
========================================== */

.product-card {
    background: white;

    border-radius: 14px;

    overflow: hidden;

    box-shadow:
        0 3px 14px rgba(0, 0, 0, 0.07);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;

    width: 100%;

    display: flex;

    flex-direction: column;
}


.product-card:hover {
    transform: translateY(-4px);

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.10);
}


/* ==========================================
   PRODUCT IMAGE
========================================== */

.product-image {
    width: 100%;

    height: 190px;

    object-fit: contain;

    object-position: center;

    background: #f5f5f5;

    display: block;
}


/* ==========================================
   PRODUCT IMAGE PLACEHOLDER
========================================== */

.product-image-placeholder {
    width: 100%;

    height: 190px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #f3f4f6;

    color: #999;

    font-size: 14px;
}


/* ==========================================
   PRODUCT INFORMATION
========================================== */

.product-info {
    padding: 17px;

    display: flex;

    flex-direction: column;

    flex: 1;
}


.product-category {
    color: #777;

    font-size: 12px;

    text-transform: uppercase;

    margin-bottom: 5px;
}


.product-name {
    font-size: 18px;

    margin-bottom: 5px;

    color: #222;
}


.product-description {
    color: #666;

    font-size: 14px;

    margin-top: 5px;

    margin-bottom: 12px;

    min-height: 42px;
}


.product-price {
    font-size: 20px;

    font-weight: bold;

    margin-top: auto;

    margin-bottom: 13px;

    color: #111827;
}


/* ==========================================
   STOCK BADGES
========================================== */

.stock-badge {
    display: inline-block;

    width: fit-content;

    margin: 5px 0 8px;

    padding: 4px 8px;

    border-radius: 20px;

    font-size: 11px;

    font-weight: bold;
}


.in-stock {
    background: #e8f8ee;

    color: #146c38;
}


.low-stock {
    background: #fff4e5;

    color: #9a5a00;
}


.out-stock {
    background: #fdecec;

    color: #b42318;
}


/* ==========================================
   ADD TO CART BUTTON
========================================== */

.add-button {
    width: 100%;

    border: none;

    padding: 12px;

    background: #111827;

    color: white;

    border-radius: 8px;

    cursor: pointer;

    font-weight: bold;

    font-size: 14px;

    transition: 0.2s ease;
}


.add-button:hover:not(:disabled) {
    background: #25d366;

    color: #111;
}


.disabled-button {
    opacity: 0.5;

    cursor: not-allowed;
}


/* ==========================================
   DATABASE STORE STATES
========================================== */

.store-loading,
.store-error,
.no-products-message {
    grid-column: 1 / -1;

    width: 100%;

    background: white;

    padding: 40px;

    border-radius: 14px;

    text-align: center;

    color: #666;
}


.store-error {
    border: 1px solid #f1c0c0;
}


.store-error h3,
.no-products-message h3 {
    color: #222;

    margin-bottom: 8px;
}


/* ==========================================
   CART SECTION
========================================== */

.cart-section {
    margin-top: 45px;
}


.cart-card,
.checkout-card {
    background: white;

    border-radius: 14px;

    padding: 25px;

    box-shadow:
        0 3px 14px rgba(0, 0, 0, 0.06);
}


.cart-heading {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 20px;

    margin-bottom: 25px;
}


.cart-heading h2 {
    font-size: 24px;
}


.cart-heading p {
    color: #777;
}


.clear-button {
    border: 1px solid #ddd;

    background: white;

    padding: 8px 14px;

    border-radius: 7px;

    cursor: pointer;

    transition: 0.2s ease;
}


.clear-button:hover {
    background: #f4f4f4;
}


/* ==========================================
   CART ITEMS
========================================== */

.cart-item {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 15px;

    border-bottom: 1px solid #eee;

    padding: 15px 0;
}


.cart-product-info {
    flex: 1;
}


.cart-product-info h4 {
    margin-bottom: 4px;
}


.cart-product-info p {
    color: #666;

    font-size: 14px;
}


/* ==========================================
   QUANTITY CONTROL
========================================== */

.quantity-control {
    display: flex;

    align-items: center;

    gap: 8px;
}


.quantity-control button {
    width: 32px;

    height: 32px;

    border: none;

    border-radius: 5px;

    cursor: pointer;

    font-size: 18px;

    background: #f0f0f0;

    transition: 0.2s ease;
}


.quantity-control button:hover {
    background: #ddd;
}


.remove-button {
    border: none;

    background: none;

    cursor: pointer;

    font-size: 18px;

    padding: 5px;
}


/* ==========================================
   EMPTY CART
========================================== */

.empty-cart {
    text-align: center;

    padding: 40px;

    color: #777;
}


/* ==========================================
   CART SUMMARY
========================================== */

.cart-summary {
    border-top: 2px solid #eee;

    margin-top: 15px;

    padding-top: 15px;
}


.cart-summary > div {
    display: flex;

    justify-content: space-between;

    margin: 9px 0;
}


.grand-total {
    font-size: 21px;

    border-top: 1px solid #eee;

    padding-top: 12px;
}


/* ==========================================
   CHECKOUT
========================================== */

.checkout-section {
    margin: 30px 0 60px;
}


.checkout-card h2 {
    font-size: 24px;

    margin-bottom: 3px;
}


.checkout-card > p {
    color: #666;

    margin-bottom: 20px;
}


/* ==========================================
   FORMS
========================================== */

.form-grid {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 18px;
}


.form-group {
    display: flex;

    flex-direction: column;
}


.form-group label {
    font-weight: bold;

    margin-bottom: 6px;
}


.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    padding: 13px;

    border: 1px solid #ddd;

    border-radius: 8px;

    font-size: 15px;

    font-family: inherit;

    outline: none;

    background: white;

    transition: 0.2s ease;
}


.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #25d366;

    box-shadow:
        0 0 0 3px rgba(37, 211, 102, 0.10);
}


.form-group textarea {
    min-height: 80px;

    resize: vertical;
}


.full-width {
    grid-column: 1 / -1;
}


/* ==========================================
   WHATSAPP BUTTON
========================================== */

.whatsapp-button {
    width: 100%;

    margin-top: 25px;

    padding: 16px;

    border: none;

    background: #25d366;

    color: #111;

    border-radius: 9px;

    font-size: 17px;

    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}


.whatsapp-button:hover {
    opacity: 0.92;

    transform: translateY(-1px);
}


/* ==========================================
   FOOTER
========================================== */

footer {
    background: #111827;

    color: white;

    text-align: center;

    padding: 25px;

    margin-top: 30px;
}


footer p {
    opacity: 0.9;
}


/* ==========================================
   TOAST
========================================== */

.toast {
    visibility: hidden;

    opacity: 0;

    position: fixed;

    bottom: 25px;

    left: 50%;

    transform:
        translateX(-50%)
        translateY(10px);

    background: #111;

    color: white;

    padding: 12px 20px;

    border-radius: 8px;

    z-index: 1000;

    max-width: 90%;

    text-align: center;

    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        visibility 0.25s ease;
}


.toast.show {
    visibility: visible;

    opacity: 1;

    transform:
        translateX(-50%)
        translateY(0);
}


/* ==========================================
   TABLET RESPONSIVENESS
========================================== */

@media (max-width: 900px) {

    .product-grid {
        grid-template-columns:
            repeat(auto-fill, minmax(220px, 1fr));
    }

}

    .store-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }


    .track-order-button {
        padding: 10px 12px;
        font-size: 13px;
    }

/* ==========================================
   MOBILE RESPONSIVENESS
========================================== */

@media (max-width: 700px) {

    .container {
        width: 94%;
    }


    .header-content {
        align-items: flex-start;
    }


    .store-header {
        padding: 18px 0;
    }


    .store-header h1 {
        font-size: 22px;
    }


    .store-header p {
        font-size: 13px;
    }


    .cart-button {
        padding: 10px 12px;

        font-size: 13px;
    }


    .form-grid {
        grid-template-columns: 1fr;
    }


    .full-width {
        grid-column: auto;
    }


    .cart-item {
        flex-wrap: wrap;
    }


    .cart-heading {
        align-items: flex-start;
    }

}


/* ==========================================
   SMALL MOBILE PRODUCT GRID
========================================== */

@media (max-width: 600px) {

    .product-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 12px;
    }


    .product-card {
        border-radius: 11px;
    }


    .product-image,
    .product-image-placeholder {
        height: 145px;
    }


    .product-info {
        padding: 12px;
    }


    .product-category {
        font-size: 10px;
    }


    .product-name {
        font-size: 15px;
    }


    .product-description {
        font-size: 12px;

        min-height: 36px;
    }


    .product-price {
        font-size: 17px;

        margin-bottom: 10px;
    }


    .stock-badge {
        font-size: 10px;

        padding: 3px 7px;
    }


    .add-button {
        padding: 10px 6px;

        font-size: 12px;
    }

}


/* ==========================================
   VERY SMALL MOBILE
========================================== */

@media (max-width: 380px) {

    .product-grid {
        grid-template-columns: 1fr;
    }


    .product-image,
    .product-image-placeholder {
        height: 180px;
    }

}

/* ==========================================
   WHATSORDER PLATFORM BRANDING
========================================== */

.whatsorder-powered-by {
    padding: 22px 15px 30px;
    text-align: center;
    color: #6b7280;
    font-size: 12px;
}


.whatsorder-powered-by strong {
    margin-left: 4px;
    color: #16a34a;
}

/* ==========================================
   MANUAL BANK TRANSFER
========================================== */

.bank-transfer-details {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding: 18px;
    border: 1px solid #dbe3ea;
    border-radius: 12px;
    background: #f8fafc;
}


.bank-transfer-heading {
    margin-bottom: 16px;
}


.bank-transfer-heading strong {
    display: block;
    margin-bottom: 5px;
    color: #111827;
    font-size: 15px;
}


.bank-transfer-heading span {
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}


.bank-transfer-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 11px 0;
    border-bottom: 1px solid #e5e7eb;
}


.bank-transfer-row span {
    color: #64748b;
    font-size: 13px;
}


.bank-transfer-row strong {
    color: #111827;
    font-size: 14px;
    text-align: right;
    overflow-wrap: anywhere;
}


.bank-transfer-copy-button {
    width: 100%;
    margin-top: 14px;
    padding: 11px 14px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    background: #ffffff;
    color: #111827;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}


.bank-transfer-copy-button:hover {
    background: #f1f5f9;
}


.bank-transfer-instructions {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 9px;
    background: #ecfdf5;
    color: #166534;
    font-size: 13px;
    line-height: 1.6;
}


@media (max-width: 650px) {

    .bank-transfer-row {
        display: block;
    }


    .bank-transfer-row span {
        display: block;
        margin-bottom: 4px;
    }


    .bank-transfer-row strong {
        display: block;
        text-align: left;
    }

}


.hidden {
    display: none !important;
}