/* Fond en damier pour les images avec transparence */
.checkerboard-bg {
    background-image: linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #f8f8f8;
}

/* Empêcher l'image produit principale de s'étirer */
.product-cover img,
#product-images img,
.images-container img,
.product-images img {
    max-height: none !important;
    height: auto !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

/* Layout pour l'affichage fixe de l'image sur desktop */
@media (min-width: 992px) {
    .pc-main-layout-container {
        display: flex;
        align-items: flex-start;
        gap: 25px;
        margin-bottom: 30px;
    }

    #product-composite-image-container {
        flex: 0 0 600px;
        position: sticky !important;
        top: 20px !important;
        z-index: 100;
        margin-bottom: 0 !important;
    }

    #product-page-customization-zones {
        flex: 1;
        min-width: 0;
        margin-top: 0 !important;
    }
}

/* Sur mobile, on garde le mode sticky simple mais efficace */
@media (max-width: 991px) {
    #product-composite-image-container {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000;
        background: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
    }

    #product-composite-image-container .page-preview-header {
        display: none;
        /* Masquer le titre sur mobile pour gagner de la place */
    }

    #product-composite-image-container>div:last-child {
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
    }
}

/* === Block 2 === */
.page-view-tab:hover {
    border-color: #007bff !important;
    background: #f8f9fa !important;
}

.page-view-tab.active {
    border-color: #007bff !important;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.page-view-tab.active .page-view-name {
    color: #0d47a1 !important;
    font-weight: 600 !important;
}

/* Responsive: sur mobile, revenir en disposition horizontale */
@media (max-width: 576px) {
    .page-composite-layout {
        flex-direction: column !important;
    }

    .page-view-tabs-wrapper {
        width: 100% !important;
    }

    .page-view-tabs {
        flex-direction: row !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
}

/* === Block 3 === */
.custom-font-select-container {
    position: relative;
    width: 100%;
}

.custom-font-trigger {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 38px;
    user-select: none;
    transition: border-color 0.2s;
}

.custom-font-trigger:hover {
    border-color: #a0a0a0;
}

.custom-font-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 10000;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    max-height: 350px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.2s, transform 0.2s;
}

.custom-font-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.font-family-group {
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.font-family-header {
    padding: 10px 15px;
    cursor: pointer;
    background: #fdfdfd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: background 0.2s;
}

.font-family-header:hover {
    background: #f0f4f8;
}

.font-family-header.active {
    background: #e8f0fe;
    border-left: 3px solid #4c8bf5;
}

.font-variants-list {
    display: none;
    padding: 4px 0;
    margin: 0;
    list-style: none;
    background: #fff;
    position: fixed;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.15);
    z-index: 100000;
}

.font-variants-list.show {
    display: block;
    animation: slideSide 0.15s ease-out;
}

@keyframes slideSide {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.font-variant-item {
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.font-variant-item:hover {
    background: #f8f9fa;
    color: #4c8bf5;
    border-left-color: #4c8bf5;
}

.font-variant-item.selected {
    background: #eef4ff;
    font-weight: bold;
    border-left-color: #4c8bf5;
}

.font-preview-text {
    font-size: 16px;
    display: block;
    line-height: 1.2;
}

.font-variant-name {
    font-size: 11px;
    color: #999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.font-variant-item:hover .font-variant-name {
    color: #4c8bf5;
}

/* === Outil "Pot de peinture" – Couleur de fond de zone === */
.pc-bg-color-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 6px;
}

.pc-bg-color-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pc-bg-color-group label i {
    font-size: 1.1rem;
    color: #6c757d;
}

.pc-bg-color-picker {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    background: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.pc-bg-color-picker:hover {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.pc-bg-color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
    border-radius: 50%;
}

.pc-bg-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.pc-bg-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}

/* Bouton reset couleur de fond */
.pc-bg-color-reset {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pc-bg-color-reset:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

/* Layer de fond dans le composite overlay */
.pc-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    transition: background-color 0.25s ease;
}