.product-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    transition: opacity 0.2s ease;
    opacity: 1;
}

.dialog-content {
    position: relative;
    background: var(--background, #111111);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 1200px;
    z-index: 1002;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.close-button-top-right {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--card-bg);
    border: none;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    z-index: 1003;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.close-button-top-right:hover {
    background: var(--section-bg);
    transform: scale(1.1);
}

.dialog-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    max-height: calc(90vh - 3rem);
    background: var(--background, #111111);
    color: var(--text-color, #ffffff);
}

.product-main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.product-image-section {
    background: var(--card-bg, #1a1a1a);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    max-height: 80vh;
    position: relative;
    overflow: hidden; /* Contain zoom effects */
}

/* Container for main image to contain zoom effects */
.main-image-container {
    position: relative;
    overflow: hidden;
    flex: 1;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.dialog-image {
    width: 100%;
    height: auto;
    max-height: calc(80vh - 120px); /* Account for thumbnails height */
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.mockup-gallery {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.75rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
    background: var(--section-bg, #242424);
    border-radius: 0 0 8px 8px;
    pointer-events: all;
    z-index: 10; /* Ensure gallery stays above zoom */
}

.mockup-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    cursor: pointer;
    object-fit: cover;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    background: var(--card-bg, #1a1a1a);
    pointer-events: auto;
}

.mockup-thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mockup-thumbnail.active {
    border-color: #b71111;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(183, 17, 17, 0.3);
}

.product-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--card-bg, #1a1a1a);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Light mode styles */
@media (prefers-color-scheme: light) {
    .dialog-content {
        --background: #ffffff;
        --card-bg: #f5f5f5;
        --section-bg: #ffffff;
        --text-color: #1a1a1a;
        --border-color: #e0e0e0;
        --shadow-color: rgba(0, 0, 0, 0.1);
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    }

    .dialog-body {
        --background: #ffffff;
        --text-color: #1a1a1a;
    }

    .product-details,
    .product-image-section {
        border-color: var(--border-color);
    }

    .product-description {
        border-color: var(--border-color);
    }

    .product-description-main,
    .product-features,
    .product-note {
        border-color: var(--border-color);
    }

    .color-button,
    .size-button {
        border-color: var(--border-color);
    }

    .size-button:not(:disabled):hover {
        border-color: #b71111;
        color: #b71111;
        background: #fff;
    }

    .size-button:disabled {
        background: #f0f0f0;
        color: #999;
    }
}

.product-description {
    width: 100%;
    background: var(--card-bg, #1a1a1a);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.product-description h3,
.product-description h4 {
    color: var(--text-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.product-description p {
    color: var(--text-color);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.product-description-main {
    background: var(--section-bg, #242424);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.product-features,
.product-note {
    background: var(--section-bg, #242424);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.product-description-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    margin-top: 0.75rem;
}

.product-description-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 1024px) {
    .product-description-content {
        grid-template-columns: 1fr;
    }

    .product-description-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dialog-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .dialog-body {
        padding: 1rem;
    }

    .product-main-content {
        grid-template-columns: 1fr;
    }

    .product-description-content {
        grid-template-columns: 1fr;
    }

    .product-description-details {
        grid-template-columns: 1fr;
    }
}

.color-selector,
.size-selector {
    margin-top: 1rem;
}

.color-grid,
.size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-button,
.size-button {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--background);
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
    color: var(--text-color);
}

.size-button {
    border: 2px solid var(--text-color);
    opacity: 1;
    min-width: 50px;
    font-weight: bold;
    transition: all 0.2s ease;
    padding: 0.75rem 1rem;
    position: relative;
    overflow: visible;  /* Changed from hidden to visible */
}

.size-button:not(:disabled):hover {
    border-color: #b71111;
    color: #b71111;
    background: transparent;
    box-shadow: 0 2px 8px rgba(183, 17, 17, 0.2);
}

.size-button.active {
    background: var(--text-color);
    color: var(--background);
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.size-button.active::after {
    content: '✓';
    position: absolute;
    top: -6px;  /* Adjusted position */
    right: -6px;  /* Adjusted position */
    background: #b71111;  /* Company red */
    color: white;
    width: 18px;  /* Slightly smaller for better proportions */
    height: 18px;  /* Slightly smaller for better proportions */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;  /* Slightly smaller for better fit */
    border: 1.5px solid #b71111;  /* Company red */
    box-shadow: 0 2px 4px rgba(183, 17, 17, 0.3);  /* Adjusted shadow color */
}

.color-button:hover:not(:disabled),
.size-button:hover:not(:disabled) {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.color-button.active,
.size-button.active {
    opacity: 1;
    border-color: var(--text-color);
    background: var(--section-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--shadow-color);
}

.size-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: var(--border-color);
}

.color-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

/* Color-specific styles */
.color-button[data-color="Black"] .color-swatch {
    background-color: #000000;
}

.color-button[data-color="Military Green"] .color-swatch {
    background-color: #4B5320;
}

.color-button[data-color="Carbon Grey"] .color-swatch {
    background-color: #515151;
}

.color-button[data-color="Bone"] .color-swatch {
    background-color: #E3DAC9;
}

.color-name {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}
