/* Import theme colors */
@import url('theme-color.css');

/* Product Detail Specific Styles */
.product-detail-page {
    background: var(--gradient-primary);
    min-height: 100vh;
    font-family: 'Space Grotesk', sans-serif;
}

.loading-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

/* Custom Loading Spinner */
.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
    animation-delay: 0.2s;
    border-top-color: var(--accent-blue);
    opacity: 0.7;
}

.spinner-ring:nth-child(3) {
    animation-delay: 0.4s;
    border-top-color: var(--accent-blue);
    opacity: 0.4;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Product Gallery Styles */
.main-image-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    min-height: 240px;
    max-height: none;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    padding: 0;
}

.main-image-container:hover {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.main-product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* Navigation buttons positioning */
.image-nav-btn {
    z-index: 10;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(35px, 4vw, 40px);
    height: clamp(35px, 4vw, 40px);
    font-size: clamp(0.75rem, 1.5vw, 0.875rem);
}

.image-nav-btn:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.image-nav-btn-prev {
    margin-left: clamp(0.5rem, 2vw, 1rem);
}

.image-nav-btn-next {
    margin-right: clamp(0.5rem, 2vw, 1rem);
}

@media (max-width: 575.98px) {
    .image-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 0.75rem;
    }

    .image-nav-btn-prev {
        margin-left: 0.5rem;
    }

    .image-nav-btn-next {
        margin-right: 0.5rem;
    }
}

.thumbnail-gallery {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) var(--border-light);
}

.thumbnail-gallery::-webkit-scrollbar {
    height: 6px;
}

.thumbnail-gallery::-webkit-scrollbar-track {
    background: var(--secondary-light);
    border-radius: 3px;
}

.thumbnail-gallery::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 3px;
}

.thumbnail-item {
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.thumbnail-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.thumbnail-item.active {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(77, 106, 146, 0.2);
}

/* Main image clickable to open lightbox */
.main-image-click-wrapper {
    cursor: pointer;
}
.main-image-click-wrapper:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Product Image Lightbox (gallery view + zoom) */
.product-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
}
.product-image-lightbox.lightbox-visible {
    pointer-events: auto;
}
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}
.lightbox-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    pointer-events: none;
}
.lightbox-content > * {
    pointer-events: auto;
}
.lightbox-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
}
.lightbox-image-wrap {
    overflow: auto;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    /* Hide scrollbars; user pans with mouse or touch */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.lightbox-image-wrap::-webkit-scrollbar {
    display: none;
}
.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
    user-select: none;
}
.lightbox-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    transition: background 0.2s, transform 0.2s;
}
.lightbox-btn:hover {
    background: #fff;
    transform: scale(1.05);
}
.lightbox-btn:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}
.lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
}
/* Zoom controls hidden on all screens; pan with mouse/touch in scrollable area */
.lightbox-zoom-controls {
    display: none !important;
}
.lightbox-zoom-value {
    color: #fff;
    font-size: 0.875rem;
    min-width: 3rem;
    text-align: center;
}
.lightbox-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 0.5rem;
    pointer-events: none;
    z-index: 5;
}
.lightbox-nav .lightbox-btn {
    pointer-events: auto;
}
.lightbox-prev { margin-left: 0.25rem; }
.lightbox-next { margin-right: 0.25rem; }

@media (max-width: 575.98px) {
    .lightbox-btn {
        width: 2.5rem;
        height: 2.5rem;
    }
    .lightbox-close {
        top: 0.25rem;
        right: 0.25rem;
    }
}

/* Product Info Styles */
.product-title {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-dark);
    font-size: clamp(1.1rem, 3.5vw, 1.45rem);
    font-weight: 700;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
}

/* Selected variant badge - compact so it doesn't dominate or get overlapped */
.selected-variant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    padding: 0.35rem 0.65rem;
    line-height: 1.35;
    border-radius: 6px;
    max-width: 100%;
    white-space: normal;
}

.selected-variant-badge .fw-semibold {
    font-size: inherit;
}

.main-price {
    font-family: 'Space Grotesk', sans-serif;
    text-shadow: 0 2px 10px var(--shadow-light);
    word-wrap: break-word;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--accent-blue);
}

.price-on-request {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 600;
    color: var(--text-medium);
}

.badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: inline-block;
    max-width: 100%;
}

.description-title {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-dark);
    font-size: clamp(1.1rem, 3vw, 1.3rem);
}

.description-text {
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1.8;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    word-wrap: break-word;
}

.quantity-title {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-dark);
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
}

/* Action Buttons */
.btn-wholesale {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-wholesale:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(77, 106, 146, 0.3);
    color: white;
}

/* Long Descriptions Section */
.long-descriptions-section {
    margin-top: 3rem;
}

.long-descriptions-content {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-medium);
}

.long-descriptions-content h3,
.long-descriptions-content h4 {
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-dark);
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.long-descriptions-content h3 {
    font-size: 1.5rem;
}

.long-descriptions-content h4 {
    font-size: 1.25rem;
}

.long-descriptions-content ul,
.long-descriptions-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.long-descriptions-content li {
    margin-bottom: 0.5rem;
}

/* Promotional Offers Section */
.offers-section {
    margin-bottom: 2rem;
}

.offer-banner {
    position: relative;
    overflow: hidden;
}

.offer-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.offer-options {
    margin-top: 1rem;
    padding-top: 1rem;
}

.offer-option {
    position: relative;
    overflow: hidden;
}

.offer-option:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.offer-option .form-check-input {
    margin-top: 0.25rem;
}

/* Prevent click propagation issues */
.offer-banner * {
    pointer-events: auto;
}

.offer-option * {
    pointer-events: auto;
}

.long-descriptions-content strong {
    color: var(--text-dark);
    font-weight: 600;
}

.long-descriptions-content hr {
    border-color: var(--accent-blue);
    opacity: 0.3;
    margin: 2rem 0;
}

/* Related Products */
.section-title {
    font-family: 'Space Grotesk', sans-serif;
}

.hover-lift:hover {
    transform: translateY(-5px);
    transition: all 0.3s ease;
}

.object-fit-cover {
    object-fit: cover;
}

/* Price Styles - Duplicate removed, using definition above */

/* Responsive */
@media (min-width: 1400px) {
    .main-image-container {
        aspect-ratio: 3 / 2;
    }
}

@media (max-width: 991.98px) {
    .main-image-container {
        aspect-ratio: 4 / 3;
        min-height: 220px;
        max-height: min(42vh, 380px);
    }

    .product-title {
        font-size: clamp(1.05rem, 3.2vw, 1.35rem) !important;
    }
}

@media (max-width: 767.98px) {
    .main-image-container {
        aspect-ratio: 1 / 1;
        min-height: 200px;
        max-height: min(70vw, 300px);
        border-radius: 12px;
    }

    .product-title {
        font-size: clamp(1rem, 3vw, 1.25rem) !important;
    }

    .product-meta .badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .main-image-container {
        aspect-ratio: 1 / 1;
        min-height: 160px;
        max-height: min(62vw, 260px);
        border-radius: 10px;
    }

    .product-title {
        font-size: clamp(0.95rem, 4vw, 1.15rem) !important;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}

/* Zoom compatibility */
@media (min-resolution: 1.5dppx) {
    .main-product-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Product Image Hover Effect */
.product-image-container a:hover img {
    transform: scale(1.05);
}

.product-image-container a {
    text-decoration: none;
}

/* Modern Product Detail Styles */
.modern-product-detail {
    background: var(--primary-light);
    overflow: visible;
    position: relative;
}

/* Ensure container allows sticky positioning */
.modern-product-detail .container-fluid {
    overflow: visible;
    position: relative;
}

.modern-gallery .main-image-container {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.modern-product-info {
    padding: 0;
}

/* Prevent floating WhatsApp from overlapping selected option on small screens */
/* @media (max-width: 575.98px) {
    .modern-product-info {
        padding-left: 2.5rem;
    }
} */

/* Gallery and Content - Normal Scroll (No Sticky) */
@media (min-width: 992px) {
    .modern-product-detail .row {
        align-items: flex-start;
    }

    .sticky-gallery {
        position: relative;
        width: 100%;
        overflow: visible;
    }

    .scrollable-content {
        position: relative;
        width: 100%;
        overflow: visible;
    }
}

/* Mobile: Hide description in gallery */
@media (max-width: 991.98px) {
    .sticky-gallery .description-section {
        display: none !important;
    }
}

/* Modern Variant Options - clear, simple, works on all screens */
.variant-options-section {
    margin-bottom: 1rem;
}

.modern-variant-section {
    font-family: 'Space Grotesk', sans-serif;
    background: #f8fafc;
    padding: 1rem 1.125rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    max-width: 100%;
}

.variant-options-heading {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.variant-options-heading-icon {
    width: 4px;
    height: 1.125rem;
    border-radius: 2px;
    background: var(--accent-blue);
}

.variant-options-sub {
    font-size: 0.8125rem;
    color: var(--text-medium, #64748b);
    margin: 0 0 1rem 0;
}

.variant-attribute-group {
    margin-bottom: 1rem;
}

.variant-attribute-group:last-child {
    margin-bottom: 0;
}

.variant-attribute-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* Options row: wrap on large screens, horizontal scroll on small */
.variant-options-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.125rem 0 0.375rem 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-blue) rgba(0, 0, 0, 0.08);
}

.variant-options-scroll::-webkit-scrollbar {
    height: 5px;
}

.variant-options-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
}

.variant-options-scroll::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 4px;
}

/* Variant option button - single class used in markup */
.variant-option-btn,
.variant-option-btn-modern {
    font-family: 'Space Grotesk', sans-serif;
    padding: 0.5rem 1rem;
    min-height: 2.5rem;
    border: 1.5px solid var(--border-light);
    background: #fff;
    color: var(--text-dark);
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}

.variant-option-btn:hover:not(:disabled),
.variant-option-btn-modern:hover:not(:disabled) {
    border-color: var(--accent-blue);
    background: #eff6ff;
    color: var(--accent-blue);
}

.variant-option-btn.active,
.variant-option-btn-modern.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(77, 106, 146, 0.25);
}

.variant-option-btn:disabled,
.variant-option-btn-modern:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.variant-option-btn.incompatible,
.variant-option-btn-modern.incompatible {
    border-color: #f59e0b;
}

.variant-option-btn.unavailable,
.variant-option-btn-modern.unavailable {
    opacity: 0.5;
}

.variant-option-text {
    display: inline-block;
}

.variant-option-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.variant-option-loading .fa-spinner {
    font-size: 0.875rem;
}

/* Modern Quantity Controls */
.modern-quantity-section .quantity-controls {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quantity-btn:hover:not(:disabled) {
    background: var(--accent-blue) !important;
    color: white !important;
}

.quantity-input:focus {
    outline: none;
    box-shadow: none;
}

@media (max-width: 991.98px) {
    .modern-product-detail {
        padding-bottom: 140px !important;
    }
}

@media (max-width: 576px) {
    .modern-product-detail {
        padding-bottom: 130px !important;
    }

    .sticky-add-to-cart {
        bottom: 55px;
    }
}

/* Modern Price Section */
.modern-price-section {
    background: var(--gradient-card);
    padding: 0.875rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

/* Responsive improvements */
@media (max-width: 767.98px) {
    .modern-variant-section {
        padding: 0.875rem 1rem;
    }

    .variant-options-heading {
        font-size: 0.875rem;
    }

    .variant-options-sub {
        font-size: 0.75rem;
    }

    .variant-attribute-label {
        font-size: 0.75rem;
    }

    .variant-option-btn,
    .variant-option-btn-modern {
        padding: 0.45rem 0.875rem;
        min-height: 2.25rem;
        font-size: 0.8125rem;
    }

    .modern-price-section {
        padding: 0.875rem;
    }

    .current-price span {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 575.98px) {
    .modern-product-detail {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .modern-variant-section {
        padding: 0.75rem 0.875rem;
    }

    .variant-options-heading {
        font-size: 0.8125rem;
    }

    .variant-options-sub {
        font-size: 0.6875rem;
        margin-bottom: 0.75rem;
    }

    .variant-attribute-group {
        margin-bottom: 0.875rem;
    }

    .variant-attribute-label {
        font-size: 0.6875rem;
    }

    /* On very small screens, don't wrap so horizontal scroll is clear */
    .variant-options-scroll {
        flex-wrap: nowrap;
    }

    .variant-option-btn,
    .variant-option-btn-modern {
        padding: 0.4rem 0.75rem;
        min-height: 2.25rem;
        font-size: 0.75rem;
    }

    .modern-price-section {
        padding: 0.75rem;
    }

    .current-price span {
        font-size: 1.35rem !important;
    }
}