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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #fcfcfc;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
}

/* --- Navigation Bar (Header) --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-height: 70px;
    transition: all 0.3s ease;
}

.logo img {
    width: 80px;
    display: block;
}

/* --- NAV LINKS (Desktop) --- */
.nav-links {
    display: flex;
    align-items: center;
    margin-left: auto;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-links a {
    text-decoration: none;
    color: #555;
    margin-left: 20px;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #000;
}

/* --- USER ACTIONS --- */
.user-actions {
    display: flex;
    align-items: center;
}

.user-actions img {
    width: 33px;
    position: relative;
    top: 4px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #555;
    margin-left: 15px;
    transition: color 0.3s ease;
}

.icon-btn:hover {
    color: #000;
}

/* --- SEARCH BAR STYLES (The Takeover Logic) --- */
.search-bar-container {
    /* Initially positioned for desktop, centered or to the right */
    flex-grow: 0.5; 
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 400px;
    margin-left: 30px;
    transition: all 0.3s ease;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
    width: 40px; /* Collapsed state */
    overflow: hidden;
    transition: all 0.3s ease;
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    padding: 0;
    opacity: 0; /* Hidden state */
    transition: all 0.3s ease;
    font-size: 14px;
}

.search-bar.active {
    width: 100%;
    max-width: 400px;
    padding: 6px 12px;
}

.search-bar.active input {
    opacity: 1;
    padding-right: 8px;
}

.search-bar .search-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #888;
    padding: 0;
    flex-shrink: 0;
}

/* The Close Button (Hidden by default) */
.close-search-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #555;
    margin-left: 10px;
    line-height: 1;
}

/* --- SEARCH ACTIVE STATE (TAKEOVER) --- */
.navbar.search-active {
    padding: 10px;
    justify-content: center;
}

/* Hide logo, nav links, and other buttons when search is active */
.navbar.search-active .logo,
.navbar.search-active .nav-links,
.navbar.search-active .icon-btn:not(#searchIconBtn):not(#closeSearchBtn):not(#menuToggle) {
    display: none !important;
    opacity: 0;
}

/* Expand the search container */
.navbar.search-active .search-bar-container {
    width: 100%;
    max-width: 800px; /* Use more width for the takeover */
    margin: 0;
    justify-content: center;
}

.navbar.search-active .search-bar {
    width: 100%;
    /* Keep the border/padding style of the active search bar */
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 15px;
    background-color: #fefefe;
}

.navbar.search-active .search-bar input {
    opacity: 1;
}

.navbar.search-active .close-search-btn {
    display: block; /* Show the close button */
}

/* --- Mobile Menu Toggle --- */
.menu-toggle {
    display: none; /* Default hidden on desktop */
}

/* --- MOBILE NAV OVERLAY --- */
.mobile-nav-overlay {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 10px 0;
    position: absolute;
    top: 100%; /* Pushes it below header */
    left: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 999; /* Below the header but above content */
}

.mobile-nav-overlay.active {
    display: flex;
}

.mobile-nav-overlay a {
    text-decoration: none;
    color: #333;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #f9f9f9;
    font-weight: 500;
}


/* --- Main Content Layout --- */
.content-container {
    display: flex;
    padding: 20px 40px;
    align-items: flex-start;
    transition: all 0.3s ease-in-out; /* Smooth transition when sidebar hides */
}

/* Sidebar Toggle Logic: Class applied to .content-container when filters are hidden */
.content-container.sidebar-hidden .sidebar {
    display: none; /* Hide the sidebar completely */
}

/* Product View Wrapper */
.product-view {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}


/* --- Sidebar (Filters) --- */
.sidebar {
    flex: 0 0 250px;
    margin-right: 30px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    transition: all 0.3s ease-in-out;
}

.filter-group { margin-bottom: 20px; }

.filter-header {
    font-size: 15px;
    font-weight: 600;
    color: #000;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-header::after {
    content: '▲';
    font-size: 12px;
    transition: transform 0.3s ease;
}

.filter-header.collapsed::after {
    content: '▼';
    transform: rotate(180deg); /* Use the same icon and rotate it for collapse */
}

.filter-options-container {
    max-height: 400px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding-top: 10px;
}

.filter-options-container.collapsed {
    max-height: 0;
    padding-top: 0;
}

.filter-item {
    display: block; margin-bottom: 8px; font-size: 13px; color: #555; cursor: pointer;
    user-select: none;
}
.filter-item input[type="checkbox"] { margin-right: 8px; accent-color: #000; }

/* --- Color Swatches --- */
.color-options { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }

.color-swatch {
    width: 28px; height: 28px; border-radius: 50%; border: 1px solid #ccc; cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-swatch:hover, .color-swatch.selected {
    transform: scale(1.1);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.color-swatch.selected {
    border: 3px solid #000;
}


/* --- Filter & Sort Controls Styling (Pill style) --- */

/* NEW: Wrapper for Filter Toggle and Sort Controls */
.product-controls-row {
    display: flex;
    /* Aligns filter toggle to left, sort to right */
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 20px;
    padding-right: 10px;
    flex-wrap: wrap; 
    gap: 10px 30px; /* Vertical and horizontal gap */
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 15px; /* Space between 'Sort By' label and pills */
    font-size: 14px;
    color: #555;
    /* Ensure sort options group stays on the right on desktop */
    margin-left: auto;
}

.sort-controls > label {
    font-weight: 600;
    color: #333;
    padding-top: 6px; 
}

.sort-options {
    display: flex;
    gap: 10px; /* Spacing between pills */
    flex-wrap: wrap;
}

/* Hide the actual radio buttons */
.sort-options input[type="radio"] {
    display: none;
}

.sort-pill {
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 20px; /* Pill shape */
    background-color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    
    /* Ensure all pills are styled as buttons */
    box-sizing: border-box; 
    text-align: center;
}

.sort-pill:hover {
    border-color: #aaa;
    background-color: #f5f5f5;
    color: #333;
}

/* Style for the selected sort pill */
.sort-options input[type="radio"]:checked + .sort-pill {
    background-color: #000;
    color: #fff;
    border-color: #000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* NEW: Filter Toggle Specific Styles */
.filter-toggle-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    color: #000;
    border-color: #000;
    background-color: #fff;
    flex-shrink: 0;
}

.filter-toggle-pill .icon-toggle {
    font-size: 10px;
    line-height: 1;
    transition: transform 0.3s ease;
    font-weight: 700;
}

/* Rotate the icon when filters are hidden (for 'Show Filters' state) */
.filter-toggle-pill[aria-expanded="false"] .icon-toggle {
    /* From X to a rotated X or a plus sign */
    transform: rotate(45deg); 
}


/* --- Art Gallery Grid --- */
.art-gallery {
    flex-grow: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
    gap: 25px;
}

.art-card {
    /* ... (rest of .art-card styles unchanged) ... */
    background-color: #fff;
    border-radius: 0px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.art-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-image-container {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.art-card:hover .card-image {
    transform: scale(1.05);
}

.overlay-icons {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.art-card:hover .overlay-icons {
    opacity: 1;
}

.overlay-icons .icon {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 15px;
    color: #555;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.overlay-icons .icon:hover {
    background-color: #000;
    color: #fff;
}

.card-info {
    padding: 10px 12px 12px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 2px;
    color: #000;
}

.artist {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
    font-weight: 400;
}

.price {
    font-size: 14px;
    font-weight: 700;
    color: #000;
    margin-top: 5px;
}
.product-grid {
    width: 100%;
}


/* --- Footer --- */
footer {
    background-color: #1a1a1a;
    color: #ccc;
    padding: 40px 40px 10px;
    margin-top: 40px;
}
footer .align {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}
footer .sec-1 {
    flex: 1 1 200px;
    margin-bottom: 20px;
}
footer .sec-1 .logo img {
    width: 100px;
    margin-bottom: 10px;
}
footer .sec-1 .pera {
    font-size: 13px;
    line-height: 1.5;
}
footer ul {
    list-style: none;
    padding: 0;
}
footer li {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 15px;
    color: #fff;
}
footer a {
    text-decoration: none;
    color: #ccc;
    font-weight: 400;
    font-size: 13px;
    display: flex;
    align-items: center;
}
footer a:hover {
    color: #fff;
}

.copy {
    text-align: center;
    border-top: 1px solid #333;
    padding-top: 10px;
    margin-top: 20px;
    font-size: 12px;
    color: #888;
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .navbar {
        padding: 15px 20px;
    }
    .sidebar {
        flex: 0 0 200px;
        margin-right: 20px;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: nowrap; /* Keep header elements in a single row */
        justify-content: space-between;
        padding: 10px 15px;
    }

    /* Hide desktop nav links and show menu toggle */
    .nav-links {
        display: none;
    }
    .menu-toggle {
        display: block; 
        margin-left: 10px;
    }
    
    /* Modify search bar for mobile default state */
    .search-bar-container {
        /* Ensure search bar stays small and on the right */
        flex-grow: 0;
        margin-left: 0;
        max-width: 40px; /* Only visible icon */
    }
    .search-bar {
        width: 40px;
        padding: 6px;
    }

    /* Adjust takeover for mobile */
    .navbar.search-active {
        padding: 10px; /* Reset padding for full width takeover */
    }
    .navbar.search-active .search-bar-container {
        /* Take full width minus the close button */
        max-width: calc(100% - 40px);
    }
    
    .content-container {
        flex-direction: column;
        padding: 15px;
    }
    
    /* Sidebar is full width on mobile, and is toggled via display: none */
    .sidebar {
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
        position: static; /* Remove sticky on mobile */
        max-height: 400px;
    }

    /* Mobile Sort & Filter Controls */
    .product-controls-row {
        /* Allow the Filter toggle to be on one row, and the Sort controls to wrap below */
        justify-content: flex-start; 
        gap: 10px;
    }
    
    .sort-controls {
        /* Ensure sort controls stack below the filter toggle */
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%; /* Take full width on a new line */
        margin-left: 0; /* Reset auto margin */
    }
    
    .sort-options {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .sort-controls > label {
        align-self: flex-start;
        padding: 0;
    }

    .art-gallery {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 15px;
    }
    footer .align {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .art-gallery {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    .card-image-container {
        height: 160px;
    }
}