/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --glass: rgba(30, 41, 59, 0.7);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --glow: 0 0 15px rgba(79, 70, 229, 0.3);
}

body {
    background-color: var(--dark-bg);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.main-header {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    padding: 2rem 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content h1 {
    font-size: 2rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.filters-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    background: var(--card-bg);
    border-radius: 99px;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: var(--glow);
}

.search-wrapper input {
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 200px;
}

.category-filter select {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-filter select:hover {
    border-color: var(--primary);
}

/* Products Grid/List */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Product Card */
.product-card {
    background: var(--card-bg);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2), var(--glow);
    border-color: var(--primary);
}

.card-image-container {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .card-image {
    transform: scale(1.1);
}

.card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.badge {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    align-self: flex-start;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary);
    margin-top: auto;
}

.gallery-preview {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.gallery-preview img {
    width: 40px;
    height: 40px;
    border-radius: 0.25rem;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.gallery-preview img:hover {
    border-color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 1rem;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s;
    z-index: 10;
}

.close-modal:hover {
    color: var(--secondary);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.modal-gallery {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#modalMainImage {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain; /* Changed from cover to contain to see full product */
    background: #000;
    border-radius: 0.5rem;
}

.thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.thumbnails img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.thumbnails img.active,
.thumbnails img:hover {
    opacity: 1;
    border: 2px solid var(--primary);
}

.modal-details h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-details .price {
    font-size: 2rem;
    color: var(--secondary);
    font-weight: 700;
    margin: 1rem 0;
}

.modal-details p {
    color: var(--text-muted);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@media (max-width: 768px) {
    .modal-body {
        grid-template-columns: 1fr;
    }
    
    .filters-container {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-wrapper {
        width: 100%;
    }
    
    .search-wrapper input {
        width: 100%;
    }
}
