/* 
   Frontend Styles - Flipkart Clone 
   Palette: Flipkart Blue (#2874f0), Yellow (#ffe500), White, Light Gray
*/

:root {
    --primary-blue: #2874f0;
    --secondary-yellow: #ffe500;
    --secondary-orange: #fb641b;
    --bg-light: #f1f3f6;
    --text-dark: #212121;
    --text-muted: #878787;
    --white: #ffffff;
    --border-color: #f0f0f0;
    --nav-bg: #2874f0;
    
    /* Dark Mode Variables (Subtle implementation) */
    --dark-bg: #121212;
    --dark-card-bg: #1e1e1e;
    --dark-text: #e0e0e0;
    --dark-border: #333333;
}

/* Global Reset & Typography */
body {
    font-family: Roboto, Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    scroll-behavior: smooth;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body.dark-theme {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header & Navigation */
.main-header {
    background-color: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 1020;
    height: 56px;
    display: flex;
    align-items: center;
}

body.dark-theme .main-header {
    background-color: #172337;
    border-bottom: 1px solid var(--dark-border);
}

.fk-logo-container {
    display: inline-flex;
    align-items: center;
}

.fk-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px; /* Rounded form for the logo */
    background: var(--secondary-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.16);
}

.fk-logo-mark {
    display: block;
    color: var(--primary-blue);
    font-family: Arial, sans-serif;
    font-size: 24px;
    font-style: italic;
    font-weight: 900;
    line-height: 1;
    transform: translateX(1px);
}

.fk-logo-text-new {
    font-family: Arial, sans-serif;
    font-size: 20px;
    font-style: italic;
    font-weight: 800;
    color: var(--white);
    letter-spacing: 0.5px;
}

.fk-explore-plus {
    font-size: 11px;
    font-style: italic;
    color: var(--white);
    margin-top: -2px;
}
.fk-explore-plus span {
    color: var(--secondary-yellow);
    font-weight: 500;
}

/* Header Search */
.search-container {
    width: 100%;
    max-width: 550px;
    position: relative;
    box-shadow: 0 2px 4px 0 rgba(0,0,0,.23);
    border-radius: 2px;
}

.search-bar {
    border-radius: 2px;
    padding: 0 16px;
    border: none;
    height: 36px;
    font-size: 14px;
    width: 100%;
}

.search-bar:focus {
    box-shadow: none;
    outline: none;
}

.search-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 36px;
    width: 44px;
    background-color: var(--white);
    border: none;
    color: var(--primary-blue);
    border-radius: 0 2px 2px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 30px;
}

.login-btn {
    background-color: var(--white);
    color: var(--primary-blue);
    border: 1px solid var(--white);
    font-weight: 500;
    padding: 4px 40px;
    border-radius: 2px;
    height: 32px;
    font-size: 15px;
}

.login-btn:hover {
    color: var(--primary-blue);
}

.header-link {
    color: var(--white);
    font-weight: 500;
    font-size: 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.header-link i {
    margin-right: 8px;
}

.cart-count-badge {
    position: absolute;
    top: -10px;
    right: -14px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ff6161;
    color: #fff;
    border: 1px solid #fff;
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    font-weight: 700;
}

/* Categories Sub-header */
.categories-bar {
    background-color: var(--white);
    box-shadow: 0 1px 1px 0 rgba(0,0,0,.16);
    padding: 12px 0;
    margin-bottom: 8px;
}

body.dark-theme .categories-bar {
    background-color: var(--dark-card-bg);
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.category-item img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.category-item span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
}

body.dark-theme .category-item span { color: var(--dark-text); }

.category-item:hover span {
    color: var(--primary-blue);
}

/* Hero Section */
.hero-slider .carousel-item {
    height: 280px;
    background-color: var(--white);
}

.hero-slider img {
    object-fit: cover;
    height: 100%;
    width: 100%;
}

/* Product Cards */
.product-card {
    background-color: var(--white);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px;
    transition: box-shadow 0.2s;
}

.product-card-link {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.product-card:hover {
    box-shadow: 0 3px 16px 0 rgba(0,0,0,.11);
}

body.dark-theme .product-card {
    background-color: var(--dark-card-bg);
    border: 1px solid var(--dark-border);
}

.product-image-container {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    position: relative;
}

.product-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.wishlist-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    color: #c2c2c2;
    z-index: 2;
    font-size: 18px;
}

.wishlist-btn:hover, .wishlist-btn.active {
    color: #ff4343;
}

.product-title {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-dark);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-theme .product-title { color: var(--dark-text); }

.product-desc {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.add-to-cart-btn {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--primary-blue);
    background: var(--primary-blue);
    color: var(--white);
    font-weight: 600;
    border-radius: 2px;
    padding: 8px 10px;
    margin-top: auto;
    transition: background-color 0.2s, box-shadow 0.2s;
}

.add-to-cart-btn:hover {
    background: #0f5bd8;
    box-shadow: 0 2px 6px rgba(40, 116, 240, 0.28);
}

.home-product-card form {
    width: 100%;
    margin-top: 8px;
}

.home-offer-head {
    gap: 10px;
}

.home-offer-title {
    min-width: 0;
}

.home-offer-title h4 {
    font-size: 20px;
    line-height: 1.2;
}

.home-offer-timer {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 3px;
    background: #fff3cd;
    color: #7a4a00;
    font-size: 12px;
    font-weight: 500;
}

.home-offer-timer::before {
    content: "\f017";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    color: #fb641b;
}

.home-offer-timer b {
    color: #d9480f;
    font-weight: 800;
}

.home-next-category-btn {
    width: 42px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
}

.product-detail-actions form {
    display: flex;
}

.product-detail-actions button {
    width: 100%;
}

.home-add-to-cart {
    font-size: 13px;
}

.fk-rating {
    background-color: #388e3c;
    color: white;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 4px 2px 6px;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
}

.fk-rating i {
    font-size: 10px;
    margin-left: 2px;
}

.product-price {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-dark);
}

body.dark-theme .product-price { color: var(--white); }

.original-price {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 8px;
}

.discount-text {
    font-size: 13px;
    font-weight: 500;
    color: #388e3c;
    margin-left: 8px;
}

/* Skeleton Loaders */
.skeleton {
    background: #f0f0f0;
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
    background-size: 40px 100%;
    background-repeat: no-repeat;
    background-position: left -40px top 0;
    animation: shine 1s ease infinite;
}

body.dark-theme .skeleton {
    background: #2a2a2a;
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
}

@keyframes shine {
    to { background-position: right -40px top 0; }
}

/* Action Buttons */
.fk-btn-orange {
    background-color: #ff9f00;
    border: none;
    color: white;
    font-weight: 500;
    border-radius: 2px;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.2);
}
.fk-btn-orange:hover { color: white; }

.fk-btn-red {
    background-color: #fb641b;
    border: none;
    color: white;
    font-weight: 500;
    border-radius: 2px;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.2);
}
.fk-btn-red:hover { color: white; }

.cart-place-order-btn,
.checkout-place-order-btn {
    background-color: var(--secondary-orange);
    border-color: var(--secondary-orange);
    color: #fff;
    font-weight: 700;
    border-radius: 2px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.payment-option-list {
    display: grid;
    gap: 10px;
}

.payment-app-option {
    min-height: 72px;
    padding: 12px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 2px;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.payment-app-option.is-selected {
    border-color: var(--primary-blue);
    background: #fbfdff;
    box-shadow: inset 3px 0 0 var(--primary-blue), 0 1px 5px rgba(40, 116, 240, 0.14);
}

.payment-app-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.payment-app-mark {
    width: 18px;
    height: 18px;
    border: 1px solid #c2c2c2;
    border-radius: 50%;
    flex: 0 0 18px;
    position: relative;
}

.payment-app-radio:checked + .payment-app-mark {
    border-color: var(--primary-blue);
    border-width: 2px;
}

.payment-app-radio:checked + .payment-app-mark::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-blue);
    position: absolute;
    top: 3px;
    left: 3px;
}

.payment-app-content {
    min-width: 0;
    flex: 1 1 auto;
}

.payment-app-content strong {
    display: block;
    color: #212121;
    font-size: 14px;
    line-height: 1.3;
}

.payment-app-content small {
    display: block;
    color: #878787;
    font-size: 12px;
    margin-top: 2px;
}

.payment-app-logo {
    width: 82px;
    height: 38px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: 0;
    flex: 0 0 82px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.14);
    overflow: hidden;
}

.payment-app-logo-phonepe {
    background: #5f259f;
    color: #fff;
}

.payment-app-logo-googlepay {
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    font-family: Arial, sans-serif;
}

.payment-app-logo-paytm {
    background: #fff;
    border: 1px solid #d9eef8;
    font-family: Arial, sans-serif;
    font-size: 15px;
    font-weight: 800;
}

.payment-app-logo-phonepe .payment-app-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    color: #5f259f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
}

.payment-app-logo-phonepe .payment-app-name {
    font-size: 11px;
    font-weight: 800;
}

.payment-app-logo-googlepay .payment-app-g {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #4285f4 0 25%, #34a853 25% 50%, #fbbc04 50% 75%, #ea4335 75% 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.payment-app-logo-googlepay .payment-app-name {
    font-size: 15px;
    font-weight: 600;
    color: #3c4043;
}

.payment-app-paytm-dark {
    color: #002970;
}

.payment-app-paytm-light {
    color: #00baf2;
}

.payment-app-amount {
    color: #212121;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.payment-app-amount i {
    color: #c2c2c2;
    font-size: 11px;
}

.cart-place-order-btn:hover,
.checkout-place-order-btn:hover {
    background-color: #e85b17;
    border-color: #e85b17;
    color: #fff;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    z-index: 1025;
    padding: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 6px;
    color: #878787;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    gap: 3px;
    transition: color 0.2s;
}

.mob-nav-item i {
    font-size: 18px;
}

.mob-nav-item.active {
    color: var(--primary-blue);
}

.mob-nav-item.active i {
    color: var(--primary-blue);
}

.mob-nav-item .cart-icon-wrap {
    position: relative;
    display: inline-block;
}

.mob-cart-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    background: #ff4343;
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* Add bottom padding on mobile so content doesn't hide behind nav */
@media (max-width: 768px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        padding-bottom: 60px;
    }
}

/* Footer */

footer {
    background-color: #172337;
    color: #ffffff;
    font-size: 12px;
}
footer a { color: #ffffff; }
footer a:hover { text-decoration: underline; }
footer .footer-title { color: #878787; font-size: 12px; text-transform: uppercase; margin-bottom: 12px; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .main-header {
        height: 56px;
        padding: 0;
    }

    .main-header .container {
        min-height: 56px;
        display: flex !important;
        flex-direction: row;
        align-items: center;
        justify-content: space-between !important;
        gap: 8px;
        padding: 0 12px;
        max-width: 100%;
        min-width: 0;
    }

    .main-header .btn[data-bs-target="#mobileMenu"] {
        order: 1;
        width: 40px;
        height: 40px;
        margin: 0 !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 40px;
    }

    .main-header .btn[data-bs-target="#mobileMenu"] i {
        font-size: 22px;
    }

    .main-header a[href="index.php"] {
        order: 2;
        margin: 0 !important;
        align-items: center !important;
        flex: 0 0 auto;
        min-width: 0;
    }

    .fk-logo-badge {
        width: 154px;
        height: 40px;
        align-items: center !important;
    }

    .fk-logo-mark {
        font-size: 26px;
    }

    .fk-logo-text {
        font-size: 11px;
    }

    .search-container { max-width: 100%; display: none; } /* Hide desktop search */
    .mobile-search-container {
        display: block;
        padding: 8px 10px;
        background-color: var(--primary-blue);
        position: sticky;
        top: 56px;
        z-index: 1019;
    }
    .mobile-search-bar {
        width: 100%;
        height: 36px;
        border-radius: 2px;
        border: none;
        padding: 0 46px 0 10px;
        font-size: 14px;
    }
    .header-actions {
        display: flex;
        order: 3;
        gap: 10px;
        margin-left: 0 !important;
        flex: 0 0 auto;
    }
    .header-actions > *:not(a[href="cart.php"]) { display: none !important; }
    .header-actions a[href="cart.php"] span:not(.cart-count-badge) { display: none; }

    .cart-action-footer {
        position: sticky;
        bottom: 0;
        z-index: 10;
        text-align: center !important;
        background: #fff !important;
    }

    .cart-place-order-btn,
    .checkout-place-order-btn {
        width: 100%;
    }

    .checkout-address-actions {
        display: grid;
        gap: 10px;
    }

    .payment-app-option {
        gap: 9px;
        padding: 11px 10px;
    }

    .payment-app-logo {
        width: 74px;
        flex-basis: 74px;
    }

    .payment-app-logo-phonepe .payment-app-name {
        font-size: 10px;
    }

    .payment-app-logo-googlepay .payment-app-name,
    .payment-app-logo-paytm {
        font-size: 14px;
    }

    .payment-app-amount {
        font-size: 12px;
        gap: 5px;
    }
    
    .hero-slider .carousel-item { height: 180px; }
    
    .product-image-container { height: 120px; }
    .product-title { font-size: 12px; }
    .product-price { font-size: 14px; }
    .home-product-card {
        min-height: 270px;
    }
    .home-offer-head {
        align-items: flex-start !important;
    }
    .home-offer-title h4 {
        font-size: 20px;
    }
    .home-offer-timer {
        font-size: 11px;
        padding: 3px 7px;
    }
    .home-add-to-cart {
        min-height: 36px;
        font-size: 12px;
        padding: 7px 6px;
    }
    
    .categories-bar {
        overflow-x: auto;
        overflow-y: hidden;
        white-space: normal;
        padding: 10px 0;
        scrollbar-width: none;
    }

    .categories-bar::-webkit-scrollbar {
        display: none;
    }

    .categories-bar .container {
        max-width: none;
        padding: 0;
    }

    .categories-bar .container > .d-flex {
        justify-content: flex-start !important;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 12px !important;
        scrollbar-width: none;
    }

    .categories-bar .container > .d-flex::-webkit-scrollbar {
        display: none;
    }

    .category-item {
        display: inline-flex;
        min-width: 74px;
        max-width: 74px;
        flex: 0 0 74px;
        gap: 6px;
        text-align: center;
    }

    .category-item img {
        width: 48px;
        height: 48px;
    }

    .category-item span {
        width: 100%;
        min-height: 28px;
        font-size: 11px;
        line-height: 1.2;
        white-space: normal;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}
