/**
 * Fiche Produit WooCommerce - Style Borderliner
 * Thème sombre, minimaliste, urbain
 */

/* ========================================================================
   VARIABLES & RESET
   ======================================================================== */

:root {
    --dark-bg: #161616;
    --card-bg: #191817;
    --border-color: #2A2826;
    --gold: #F2C94C;
    --text-main: #F2F2F2;
    --text-muted: #888888;
}

/* Masquer la scrollbar tout en gardant le scroll fonctionnel */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ========================================================================
   CARROUSEL GALERIE
   ======================================================================== */

.product-gallery-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.product-carousel-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.carousel-main:hover .carousel-btn {
    opacity: 1;
}

.carousel-main {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    height: 100%;
}

.carousel-slide {
    min-width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    height: 100%;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    display: block;
}

/* Boutons de navigation */
.carousel-btn {
    transition: all 300ms ease;
    cursor: pointer;
    z-index: 10;
}

.carousel-btn:hover {
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Dots (pagination) */
.carousel-dot {
    cursor: pointer;
    transition: all 200ms ease;
}

.carousel-dot.active {
    width: 1.5rem;
    background-color: white;
}

/* Miniatures */
.carousel-thumbnail {
    cursor: pointer;
    transition: all 200ms ease;
    opacity: 0.6;
}

.carousel-thumbnail.active,
.carousel-thumbnail:hover {
    opacity: 1;
    border-color: var(--gold) !important;
}

/* Support du swipe tactile (CSS Scroll Snap en fallback) */
@media (max-width: 1023px) {
    .carousel-main {
        scroll-snap-type: x mandatory;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .carousel-slide {
        scroll-snap-align: start;
    }
}

/* ========================================================================
   VARIATIONS / ATTRIBUTS (Boutons stylisés)
   ======================================================================== */

.product-variations-form .variations {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-variations-form .variations .label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    display: block;
}

/* Styliser les sélecteurs natifs */
.product-variations-form select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-main);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 200ms ease;
}

.product-variations-form select:hover {
    border-color: var(--gold);
}

.product-variations-form select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(242, 201, 76, 0.1);
}

/* Custom Variations - Size Buttons */
.size-button {
    min-width: 60px;
    transition: all 200ms ease;
}

.size-button:hover:not(:disabled) {
    border-color: var(--gold);
    transform: translateY(-1px);
}

.size-button.active,
.size-button.active:hover {
    background-color: #f2ede4 !important;
    color: #141414 !important;
    border-color: #f2ede4 !important;
}

.size-button:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

/* Stock Indicator */
.size-status-line {
    min-height: 24px;
}

.stock-dot {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Custom Select Dropdown */
.custom-select-wrapper {
    position: relative;
}

.custom-select-trigger {
    cursor: pointer;
    user-select: none;
}

.custom-select-trigger:hover {
    border-color: var(--gold);
}

.custom-select-dropdown {
    z-index: 20;
}

.custom-select-option {
    cursor: pointer;
    user-select: none;
}

.custom-select-option:hover {
    background-color: var(--dark-bg);
}

.custom-select-option.bg-goldAccent {
    background-color: var(--gold) !important;
    color: var(--dark-bg) !important;
}

/* Hide native WooCommerce selects */
.wc-native-select {
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Boutons Add to Cart */
.product-variations-form .single_add_to_cart_button {
    width: 100%;
    padding: 1rem 2rem;
    background-color: var(--gold);
    color: var(--dark-bg);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 200ms ease;
    margin-top: 1rem;
}

.product-variations-form .single_add_to_cart_button:hover {
    background-color: #f4d471;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 201, 76, 0.3);
}

.product-variations-form .single_add_to_cart_button:active {
    transform: translateY(0);
}

.product-variations-form .single_add_to_cart_button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Message de variation manquante */
.woocommerce-variation-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.woocommerce-variation-price {
    display: none; /* Prix déjà affiché en haut */
}

/* ========================================================================
   ACCORDÉON RÉASSURANCE
   ======================================================================== */

.accordion-trigger {
    background: transparent;
    border: none;
    cursor: pointer;
}

.accordion-trigger:hover {
    color: var(--gold);
}

.accordion-icon {
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-trigger[aria-expanded="true"] .accordion-icon {
    transform: rotate(45deg); /* + devient × */
}

.accordion-content {
    transition: max-height 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-content.open {
    max-height: 500px !important;
}

/* ========================================================================
   SMOOTH SCROLL
   ======================================================================== */

html {
    scroll-behavior: smooth;
}

.smooth-scroll {
    scroll-behavior: smooth;
}

/* ========================================================================
   PRODUITS LIÉS / FEATURED (Scroll horizontal mobile)
   ======================================================================== */

@media (max-width: 1023px) {
    .featured-products-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .featured-products-grid::-webkit-scrollbar {
        display: none;
    }

    .featured-product-card {
        scroll-snap-align: start;
        width: 16rem; /* 64 en rem = 256px */
        flex-shrink: 0;
    }
}

/* ========================================================================
   AJUSTEMENTS TYPOGRAPHIE
   ======================================================================== */

/* Augmenter la taille du texte sur desktop pour meilleure lisibilité */
@media (min-width: 1024px) {
    .product-carousel-container .text-sm,
    .related-product-card .text-sm,
    .featured-product-card .text-sm,
    .product-info-wrapper .text-sm,
    .borderliner-single-product .text-sm {
        font-size: 1.1rem !important;
        line-height: 1.6 !important;
    }
}

/* ========================================================================
   RESPONSIVE TWEAKS
   ======================================================================== */

/* Sticky sidebar sur desktop uniquement */
@media (min-width: 1024px) {
    .product-info-wrapper {
        position: sticky;
        top: 2rem;
        align-self: flex-start;
    }
}

/* Grid produits liés : 2x2 sur mobile, 4 colonnes sur desktop */
.related-products-section .grid {
    display: grid;
}

@media (max-width: 1023px) {
    .related-products-section .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .related-products-section .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================================================
   NOTICES WOOCOMMERCE (Messages d'erreur/succès)
   ======================================================================== */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    border-left: 4px solid;
    font-size: 0.875rem;
}

.woocommerce-message {
    background-color: rgba(34, 197, 94, 0.1);
    border-left-color: #22c55e;
    color: #22c55e;
}

.woocommerce-error {
    background-color: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
    color: #ef4444;
}

.woocommerce-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    color: #3b82f6;
}

/* Bouton dans les notices */
.woocommerce-message a,
.woocommerce-info a {
    color: var(--gold);
    text-decoration: underline;
}

/* ========================================================================
   LOADING STATE
   ======================================================================== */

.variations_form.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
    pointer-events: none;
}

/* ========================================================================
   ACCESSIBILITÉ
   ======================================================================== */

/* Focus visible pour navigation au clavier */
button:focus-visible,
a:focus-visible,
select:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Réduire les animations pour les utilisateurs qui préfèrent */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ========================================================================
   PRINT
   ======================================================================== */

@media print {
    .carousel-btn,
    .carousel-dots,
    .carousel-thumbnails,
    .product-variations-form,
    .accordion-trigger,
    .related-products-section,
    .featured-products-section {
        display: none !important;
    }

    .accordion-content {
        max-height: none !important;
        display: block !important;
    }
}
