/* --- Storefront Product Grid --- */

.grid-container {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    padding: 2rem 0;
}

@media (min-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- Product Card Styling --- */

.product-card {
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Keeps image corners rounded */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative; /* For the badge */
    max-width: 100%; /* Prevent cards from being too wide */
    width: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

/* Image Area */
.image-container {
    width: 100%;
    height: 200px;     /* KEEPS THE GRID UNIFORM */
    background-color: #ffffff; /* Change to white so empty space looks intentional */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* THE MAGIC FIX */
}

/* Badges */
.badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 10;
}

.badge.sold {
    background-color: #ef4444; /* red 500 */
    color: white;
}

.badge.coming-soon {
    background-color: #f59e0b; /* amber 500 */
    color: white;
}

.badge.deal {
    background-color: #0b91f5; /* blue */
    color: white;
}

.badge.bfdeals {
    background-color: green;
    color: white;
}

/* Content Area */
.product-details {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.product-specs {
    font-size: 0.875rem;
    color: #0369a1; /* Sky blue to highlight specs */
    font-weight: 600;
    margin-bottom: 1rem;
}

.price-block {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.original-price {
    font-size: 1rem;
    color: #f00b0b;
    text-decoration: line-through;
}

.product-desc {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1; /* Pushes the buttons to the bottom */
}

/* Actions Area */
.product-actions {
    display: grid;
    grid-template-columns: 1fr auto; /* Left side takes space, Right side fits content */
    gap: 1rem;
    align-items: center;
    margin-top: auto;
    width: 100%;
}

.buy-btn {
    /* Forces this button to be on the left */
    justify-self: start; 
    width: auto;
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.secondary-btns {
    display: flex;
    flex-direction: column; /* Stacks buttons vertically */
    gap: 0.5rem; /* Space between stacked buttons */
    align-items: flex-start; /* Aligns them to the right */
    justify-content: center;
}

.icon-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #6b7280;
    font-size: 0.85rem;
    transition: color 0.2s;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.icon-link:hover {
    color: #0369a1;
}

.small-icon {
    width: 18px !important; /* Force the width */
    height: 18px !important; /* Force the height */
    min-width: 18px; /* Prevent shrinking */
    max-width: 18px; /* Prevent growing */
    object-fit: contain; /* Keep aspect ratio inside the box */
    flex-shrink: 0; /* Stop flexbox from resizing it */
}

.image-button {
    /* 1. Make it a block element to accept a width and margin */
    display: block; 

    /* 2. Set a specific width */
    width: 200px; /* Adjust this to the size you need */

    /* 3. THE CENTER TAG: Centers the block element horizontally */
    margin: 0 auto; 

    /* Styling to make it look like a button */
    text-decoration: none;
    transition: transform 0.2s;
}

.image-button:hover {
    transform: scale(1.03);
}

.image-button img {
    /* Ensure the image fills the width of the container */
    width: 100%;
    height: auto;
    display: block;
}

.license-badge {
    display: block; 
    width: 200px; 
    margin: 0 auto; 
    text-decoration: none;
    transition: transform 0.2s; 
}

/* --- Category Headers --- */
.category-header {
    margin: 2rem 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid #0369a1;
}

.category-header h2 {
    color: #0369a1;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.category-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    padding: 0;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- Image Gallery Navigation --- */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 3rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
    line-height: 1;
    padding: 0;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

.gallery-indicator {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
}

/* --- Promo Banners --- */

.promo-banner {
    width: 100%;
    margin: 3rem 0;
    padding: 3rem 2rem;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    position: relative;
}

.promo-banner:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.promo-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.promo-image {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.promo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.promo-content {
    flex: 1;
    text-align: left;
    z-index: 1;
}

.promo-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.promo-subtitle {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    opacity: 0.95;
}

.promo-description {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    opacity: 0.9;
    max-width: 600px;
}

.promo-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-promo {
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    display: inline-block;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-promo-primary {
    background-color: #ffffff;
    color: #1e40af;
}

.btn-promo-primary:hover {
    background-color: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn-promo-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-promo-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Compact Promo Banner Styles */
.promo-banner-compact {
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    flex-direction: row;
    align-items: center;
}

.promo-banner-compact .promo-image {
    width: 80px;
    height: 80px;
}

.promo-banner-compact .promo-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 1.5rem;
}

.promo-banner-compact .promo-title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.promo-banner-compact .promo-subtitle {
    font-size: 1rem;
    margin-bottom: 0;
}

.promo-banner-compact .promo-description {
    display: none;
}

.promo-banner-compact .promo-buttons {
    margin-left: auto;
    flex-shrink: 0;
}

.promo-banner-compact .btn-promo {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

/* Promo Modal Specific Styles */

.modal-content-promo {
    background: #1e40af;
    color: #ffffff;
    padding: 3rem;
    border-radius: 1rem;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    text-align: center;
}

.modal-promo-image {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 0.5rem;
    margin: 0 auto 2rem;
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.promo-modal-description {
    font-size: 1.2rem;
    line-height: 1.8;
    margin: 1.5rem 0;
}

.modal-promo-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.modal-content-promo .btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

.modal-content-promo h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.modal-content-promo h3 {
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 1rem;
}

/* Responsive Design for Promo Banners */

@media (max-width: 768px) {
    .promo-banner {
        flex-direction: column;
        text-align: center;
        padding: 2rem 1.5rem;
    }
    
    .promo-image {
        width: 150px;
        height: 150px;
    }
    
    .promo-title {
        font-size: 2rem;
    }
    
    .promo-subtitle {
        font-size: 1.2rem;
    }
    
    .promo-description {
        font-size: 1rem;
        max-width: 100%;
    }
    
    .promo-buttons {
        justify-content: center;
    }
    
    .modal-content-promo {
        padding: 2rem 1.5rem;
    }
    
    .modal-content-promo h2 {
        font-size: 2rem;
    }
}

/* Gallery Widget Styles */
.gallery-widget-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.gallery-widget-modal {
    background: #1f2937;
    border-radius: 1rem;
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gallery-header {
    padding: 1rem 1.5rem;
    background: #111827;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #374151;
}

.gallery-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.gallery-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.gallery-close:hover {
    background: #374151;
}

.gallery-viewer {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #000;
    min-height: 400px;
}

.gallery-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 100%;
}

.gallery-image-container img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    transition: transform 0.2s ease;
    user-select: none;
}

.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 3rem;
    width: 60px;
    height: 60px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.gallery-nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev-btn {
    left: 1rem;
}

.gallery-next-btn {
    right: 1rem;
}

.gallery-controls {
    padding: 1rem 1.5rem;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid #374151;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.zoom-btn {
    background: #374151;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.zoom-btn:hover {
    background: #4b5563;
}

#zoom-slider {
    width: 150px;
    height: 6px;
    background: #374151;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#zoom-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
}

#zoom-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #3b82f6;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.gallery-indicator {
    color: white;
    font-size: 1rem;
    font-weight: 500;
}

.gallery-thumbnails {
    padding: 1rem;
    background: #111827;
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    border-top: 1px solid #374151;
}

.gallery-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    opacity: 0.6;
}

.gallery-thumbnail:hover {
    opacity: 1;
    transform: scale(1.05);
}

.gallery-thumbnail.active {
    border-color: #3b82f6;
    opacity: 1;
}

.gallery-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-widget-btn {
    display: inline-flex !important;
}

.gallery-widget-btn svg {
    margin-right: 0.5rem;
}

@media (max-width: 768px) {
    .gallery-widget-modal {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .gallery-nav-btn {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    
    .gallery-thumbnails {
        padding: 0.75rem;
    }
    
    .gallery-thumbnail {
        width: 60px;
        height: 60px;
    }
    
    #zoom-slider {
        width: 100px;
    }
}
