/* Base Styles */
:root {
    --primary-color: #2196F3;
    --primary-dark: #1565C0;
    --secondary-color: #FFC107;
    --accent-color: #FF4081;
    --text-color: #333;
    --light-text: #666;
    --gray-text: #999;
    --error-color: #F44336;
    --success-color: #4CAF50;
    --background-color: #f5f5f5;
    --card-background: #fff;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--accent-color);
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1rem;
}

/* Header & Navigation */
header {
    background-color: var(--card-background);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    padding: 1rem 0;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    transition: var(--transition);
}

/* Main Content */
main {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 300px); /* Subtract header and footer height */
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.page-header p {
    max-width: 800px;
    margin: 0 auto;
    color: var(--light-text);
}

/* Shop Layout */
.shop-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
}

/* Filters Sidebar */
.filters {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    height: max-content;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.filter-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
}

#clear-filters {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
}

#clear-filters:hover {
    text-decoration: underline;
}

.filter-group {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.filter-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.filter-group h4 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.checkbox-filter {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-filter label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.price-filter {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.price-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.price-input {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.price-input label {
    font-size: 0.85rem;
    color: var(--light-text);
}

.price-input input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

#apply-price {
    padding: 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

#apply-price:hover {
    background-color: var(--primary-dark);
}

select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: white;
}

.mobile-only {
    display: none;
}

#apply-filters {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

#apply-filters:hover {
    background-color: var(--primary-dark);
}

/* Shop Content */
.shop-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.search-bar button {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.search-bar button:hover {
    background-color: var(--primary-dark);
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    position: relative;
    min-height: 400px;
}

.item-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

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

.item-image {
    position: relative;
    height: 200px;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.price-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.original-price {
    font-size: 0.8rem;
    text-decoration: line-through;
    color: #ccc;
}

.current-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.item-details {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.item-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.item-description {
    font-size: 0.9rem;
    color: var(--light-text);
    margin-bottom: 0.75rem;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--gray-text);
    margin-bottom: 1rem;
}

.price-timer {
    background-color: #f9f9f9;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.timer-label {
    font-size: 0.8rem;
    color: var(--light-text);
    margin-bottom: 0.25rem;
}

.countdown {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 1s linear;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.view-btn, .buy-btn {
    flex: 1;
    padding: 0.6rem;
    text-align: center;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.view-btn {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.view-btn:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

.buy-btn {
    background-color: var(--primary-color);
    border: none;
    color: white;
    cursor: pointer;
}

.buy-btn:hover {
    background-color: var(--primary-dark);
}

/* Loading and Error States */
.loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.8);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(33, 150, 243, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-message {
    text-align: center;
    padding: 2rem;
}

.error-message p {
    margin-bottom: 1rem;
    color: var(--error-color);
}

.error-message button {
    padding: 0.5rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--light-text);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-pages {
    display: flex;
    gap: 0.5rem;
}

/* Footer */
footer {
    background-color: #222;
    color: white;
    padding: 3rem 0 1.5rem;
}

.footer-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    color: white;
    margin-bottom: 1rem;
}

.footer-column p {
    color: #ccc;
}

.footer-column ul {
    list-style: none;
}

.footer-column ul li {
    margin-bottom: 0.5rem;
}

.footer-column a {
    color: #ccc;
}

.footer-column a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    color: #ccc;
}

.copyright {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #444;
    font-size: 0.9rem;
    color: #aaa;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .shop-layout {
        grid-template-columns: 220px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav-links {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background-color: white;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        z-index: 100;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }
    
    .nav-links.active {
        max-height: 300px;
    }
    
    .nav-links a {
        display: block;
        padding: 1rem 2rem;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #f5f5f5;
    }
    
    .shop-layout {
        grid-template-columns: 1fr;
    }
    
    .filters {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }
    
    .filters.active {
        transform: translateX(0);
    }
    
    .mobile-only {
        display: block;
    }
    
    #filter-toggle {
        padding: 0.75rem;
    }
    
    .search-bar {
        flex-wrap: wrap;
    }
    
    .search-bar input {
        flex: 1;
        min-width: 0;
    }
    
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
    
    .menu-toggle.active span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}
