/* =========================================
   1. GLOBAL RESET & BODY
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
}

/* =========================================
   2. HEADER & NAVBAR
   ========================================= */
.header {
    background: #222;
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
}

.navbar {
    background: #fff;
    color: #222;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-weight: bold;
    font-size: 1.2rem;
}

.menu {
    display: flex;
    gap: 20px;
    align-items: center;
}

.menu a {
    color: #222;
    text-decoration: none;
    font-weight: 500;
    transition: 0.3s;
}

.menu a:hover {
    color: #ff523b;
}

#menu-toggle, .hamburger {
    display: none;
}

/* --- Wishlist Modal Styling --- */
.wishlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    text-align: left;
}

.wishlist-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 15px;
}

.wishlist-details {
    flex: 1;
}

.wishlist-details h4 {
    font-size: 14px;
    margin: 0;
}

.wishlist-details p {
    color: #ff523b;
    font-weight: bold;
    margin: 5px 0 0;
}

.remove-wishlist-btn {
    background: #ff523b;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

.remove-wishlist-btn:hover {
    background: #333;
}

/* =========================================
   3. HERO SECTION & SEARCH BAR
   ========================================= */
.hero-section {
    height: 400px;
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('https://images.unsplash.com/photo-1441986300917-64674bd600d8?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.cta-button {
    display: inline-block;
    padding: 10px 25px;
    background: white;
    color: black;
    text-decoration: none;
    font-weight: bold;
    border-radius: 25px;
    transition: 0.3s;
    margin-top: 15px;
}

.cta-button:hover {
    background: #ff523b;
    color: white;
}

.search-container {
    margin-top: 20px;
    background: white;
    padding: 5px;
    border-radius: 30px;
    display: flex;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

#search-box {
    border: none;
    outline: none;
    padding: 10px 15px;
    width: 100%;
    border-radius: 30px;
    font-size: 16px;
}

#search-btn {
    background: #ff523b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 16px;
    transition: 0.3s;
}

#search-btn:hover {
    background: #333;
}

/* =========================================
   4. LAYOUT & SIDEBAR (FIXED)
   ========================================= */
.main {
    display: grid;
    grid-template-columns: 240px 1fr; /* 240px for Sidebar, Rest for content */
    gap: 40px;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    align-items: start;
}

input[name="filter"] {
    display: none;
}

.sidebar {
    grid-column: 1; /* Sidebar stays in column 1 */
    grid-row: 1 / span 5; /* Spans down 5 rows so it stays beside everything */
    
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    position: sticky;
    top: 100px;
    height: fit-content;
    border: 1px solid #f0f0f0;
    z-index: 10;
}

.sidebar h3 {
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #222;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.sidebar label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    background-color: white;
}

.sidebar label:hover {
    background-color: #fff0ee;
    color: #ff523b;
    padding-left: 20px;
    font-weight: 600;
}

.sidebar label::after {
    content: '›';
    font-size: 18px;
    transition: 0.3s;
    opacity: 0.5;
}

.sidebar label:hover::after {
    margin-right: -5px;
    opacity: 1;
}

.sub-menu {
    display: none;
    background: #f9f9f9;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
    animation: slideDown 0.3s ease;
}

.sub-menu label {
    font-size: 0.85rem;
    padding: 10px 12px;
    margin: 5px 0;
    background: transparent;
    border-left: 2px solid transparent;
    border-radius: 5px;
}

.sub-menu label:hover {
    background: white;
    color: #ff523b;
    border-left: 2px solid #ff523b;
    padding-left: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

#clothes:checked ~ .sidebar .clothes-menu,
#jewellery:checked ~ .sidebar .jewellery-menu,
#jhumka:checked ~ .sidebar .jewellery-menu {
    display: block;
}

/* =========================================
   5. PRODUCTS GRID (FIXED)
   ========================================= */

/* Header forced to Column 2 */
.products-header {
    grid-column: 2; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.sort-container select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

/* Products forced to Column 2 */
.products {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}

.product {
    background: white;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #eee;
    overflow: hidden;
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 280px;
    background-color: #f4f4f4;
}

.product-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.product-info {
    padding: 15px;
}

.product h4 {
    font-weight: 600;
    margin: 0 0 5px;
    font-size: 1rem;
}

.price {
    color: #ff523b;
    font-weight: bold;
    font-size: 1.1rem;
    margin: 0;
}

.hover-btn {
    position: absolute;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    cursor: pointer;
    border: none;
    outline: none;
}

.wishlist-btn {
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 0;
}

.wishlist-btn.active {
    color: #ff523b;
}

.add-cart-btn {
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 12px;
    background-color: #ff523b;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 14px;
    transform: translateY(100%);
}

.add-cart-btn:hover {
    background-color: #333;
}

.product-image-wrapper:hover img {
    transform: scale(1.05);
}

.product-image-wrapper:hover .hover-btn {
    opacity: 1;
}

.product-image-wrapper:hover .add-cart-btn {
    transform: translateY(0);
}

/* =========================================
   6. FILTERING LOGIC
   ========================================= */
#clothes:checked ~ .products .product:not(.clothes),
#beauty:checked ~ .products .product:not(.beauty),
#footwear:checked ~ .products .product:not(.footwear),
#topwear:checked ~ .products .product:not(.topwear),
#bottomwear:checked ~ .products .product:not(.bottomwear),
#jewellery:checked ~ .products .product:not(.jewellery),
#jhumka:checked ~ .products .product:not(.jhumka),
#studs:checked ~ .products .product:not(.studs),
#ring:checked ~ .products .product:not(.ring),
#cartilage:checked ~ .products .product:not(.cartilage),
#neck:checked ~ .products .product:not(.neck) {
    display: none;
}

/* =========================================
   7. CART SIDEBAR
   ========================================= */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 300px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 5px rgba(0,0,0,0.5);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    background: #222;
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#close-cart {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

#cart-items {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.cart-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    margin-right: 10px;
}

.item-details h4 {
    margin: 0;
    font-size: 14px;
}

.item-details p {
    margin: 5px 0 0;
    color: #666;
}

.cart-footer {
    padding: 15px;
    border-top: 1px solid #ddd;
    background: #f9f9f9;
}

.checkout-btn {
    width: 100%;
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    z-index: 900;
}

.overlay.active {
    display: block;
}

#cart-count {
    background-color: red;
    color: white;
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 12px;
    vertical-align: top;
    margin-left: 5px;
}

/* =========================================
   8. MODALS & FORMS
   ========================================= */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation: fadeIn 0.4s;
    text-align: center;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 10px;
}

.close-modal:hover {
    color: black;
}

.contact-form input, 
.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
}

.contact-form button {
    width: 100%;
    padding: 12px;
    background-color: #ff523b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.3s;
}

.contact-form button:hover {
    background-color: #333;
}

.contact-info-small {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #666;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

/* =========================================
   9. FOOTER
   ========================================= */
.footer-section {
    background-color: #172337;
    color: white;
    font-size: 12px;
    padding-top: 40px;
    margin-top: 50px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0 20px 40px 20px;
}

.footer-column {
    display: flex;
    flex-direction: column;
    margin-right: 20px;
    min-width: 150px;
}

.footer-column h4, .address-box h4 {
    color: #878787;
    font-size: 12px;
    margin-bottom: 10px;
    font-weight: 400;
}

.footer-column a {
    color: white;
    text-decoration: none;
    margin-bottom: 6px;
}

.footer-divider {
    width: 1px;
    background-color: #454d5e;
    margin: 0 20px;
    display: none;
}

@media (min-width: 900px) {
    .footer-divider {
        display: block;
    }
}

.footer-address-section {
    display: flex;
    gap: 30px;
    flex-grow: 1;
}

.social-icons {
    margin-top: 20px;
}

.social-icons a {
    color: white;
    text-decoration: none;
    margin-right: 15px;
    font-weight: bold;
}

.footer-bottom {
    border-top: 1px solid #454d5e;
    padding: 25px 0;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding-left: 20px;
    padding-right: 20px;
}

.bottom-links {
    display: flex;
    gap: 20px;
}

/* =========================================
   10. EXTRAS (ScrollToTop, Mobile, NoResults)
   ========================================= */
#scrollToTop {
    display: none; 
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;
    border: none;
    background-color: #ff523b; 
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: 0.3s;
}

#scrollToTop:hover {
    background-color: #333;
    transform: translateY(-3px);
}

@media (max-width: 768px) {
    .main { grid-template-columns: 1fr; }
    .sidebar { margin-bottom: 20px; }
    .menu {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: white;
        border-top: 1px solid #ddd;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        padding: 0;
    }
    .menu a { padding: 15px 20px; border-bottom: 1px solid #eee; text-align: left; }
    #menu-toggle:checked ~ .menu { display: flex; animation: slideDown 0.3s ease-in-out; }
    .hamburger { display: block; font-size: 28px; cursor: pointer; }
    .footer-container, .footer-address-section, .footer-bottom, .bottom-links { flex-direction: column; gap: 15px; }
}

/* No Results Message - Fixed to Column 2 */
.no-results {
    display: none;
    grid-column: 1 / -1; /* Inside products grid, this means span all PRODUCT columns */
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2rem;
    width: 100%;
}

/* =========================================
   11. PRODUCT MODAL DETAILS
   ========================================= */
.product-modal-content {
    max-width: 700px;
    padding: 0;
    overflow: hidden;
    text-align: left;
}

.modal-body {
    display: flex;
    flex-wrap: wrap;
}

.modal-img-wrapper {
    flex: 1;
    min-width: 300px;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: 400px;
}

.modal-details {
    flex: 1;
    padding: 30px;
    min-width: 300px;
}

.modal-details h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #222;
}

.modal-details .price {
    font-size: 20px;
    margin-bottom: 15px;
}

.divider {
    height: 1px;
    background: #eee;
    margin: 15px 0;
}

#modal-desc {
    color: #666;
    line-height: 1.6;
    font-size: 14px;
    margin-bottom: 20px;
}

.modal-options {
    margin-bottom: 20px;
}

.modal-options select {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
}

#modal-add-btn {
    width: 100%;
    background: #ff523b;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

#modal-add-btn:hover {
    background: #333;
}

#close-product-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    color: #333;
    z-index: 100;
}

/* =========================================
   12. NEW FEATURES (DARK MODE, PROMO, TOAST)
   ========================================= */

/* --- DARK MODE --- */
body.dark-mode {
    background-color: #1a1a1a;
    color: #f1f1f1;
}

body.dark-mode .product, 
body.dark-mode .sidebar, 
body.dark-mode .cart-sidebar,
body.dark-mode .modal-content,
body.dark-mode .navbar,
body.dark-mode .search-container,
body.dark-mode .recent-card,
body.dark-mode .related-item {
    background-color: #2d2d2d;
    color: #f1f1f1;
    border-color: #444;
}

body.dark-mode .menu {
    background-color: #2d2d2d; /* Fix mobile menu dark mode */
}

body.dark-mode .menu a {
    color: #f1f1f1;
    border-color: #444;
}

body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode .price {
    color: #fff;
}

body.dark-mode .sidebar label, 
body.dark-mode .sub-menu label {
    background-color: #2d2d2d;
    color: #ccc;
}

body.dark-mode .sidebar label:hover {
    background-color: #333;
    color: #ff523b;
}

#dark-mode-btn {
    background: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    padding: 5px 10px;
    margin-left: 10px;
    transition: 0.3s;
}

/* --- PROMO CODE --- */
.coupon-section {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.coupon-section input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

#apply-promo {
    background: #333;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
}

#promo-message {
    font-size: 12px;
    margin-bottom: 10px;
    font-weight: bold;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-box {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    z-index: 10000;
}

.toast {
    background: #333;
    color: #fff;
    padding: 12px 20px;
    margin: 5px 0;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(100%);
    animation: slideIn 0.5s forwards, fadeOut 0.5s forwards 3s;
}

.toast.success { border-left: 5px solid #4CAF50; }
.toast.error { border-left: 5px solid #ff523b; }

@keyframes slideIn { to { transform: translateX(0); } }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }

/* --- RECENTLY VIEWED & RELATED --- */
/* Fixed to Column 2 */
.recently-viewed-section {
    grid-column: 2;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

#recent-items-container, #related-items-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 0;
}

.recent-card, .related-item {
    min-width: 150px;
    cursor: pointer;
    text-align: center;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    padding: 10px;
    transition: 0.3s;
    background: white;
}

.recent-card:hover, .related-item:hover { transform: translateY(-5px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.recent-card img, .related-item img { width: 100%; height: 120px; object-fit: cover; border-radius: 5px; }
.recent-card h5, .related-item p { margin: 10px 0 5px; font-size: 14px; }
.recent-card p { color: #ff523b; font-weight: bold; font-size: 12px; }

/* Sort Header */
.products-header {
    grid-column: 2; /* Forced to Column 2 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.sort-container select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

/* --- UPDATED RECENT CARD STYLES --- */
.recent-card {
    position: relative; /* This is crucial for placing the X button */
    min-width: 150px;
    cursor: pointer;
    text-align: center;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    padding: 10px;
    transition: 0.3s;
    background: white;
}

/* The "Cut" Button */
.remove-recent-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff523b;
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 14px;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: 0.2s;
}

.remove-recent-btn:hover {
    background: #333;
    transform: scale(1.1);
}

/* Show button only when hovering over the card */
.recent-card:hover .remove-recent-btn {
    display: flex;
}