/**
 * Styles pour la section Product
 * Suit les conventions de interior-ai.css et moodboard-creator.css
 */

/* === BLOQUER LE SCROLL QUAND MODAL OUVERT === */
body.iai-modal-open,
html.iai-modal-open {
    overflow: hidden !important;
    height: 100%;
}

/* === SECTION PRODUCT === */
#section-product {
    position: relative;
    padding: 60px 12% 0 33px;
    position: relative;
}

/* Barre de recherche dans actions-bar */
.iai-product-search {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
}

.iai-preview-item {
    width: 60px;
    height: 60px;
}

.iai-product-search-input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border: 1px solid #343230;
    border-radius: 999px;
    font-size: 11px;
    font-family: inherit;
    transition: all 0.2s;
}

button#iai-open-import-moodboard-sidebar {
    padding: 10px 17px;
    border: 1px solid #343230;
    color: #343230;
}

.iai-product-search-input:focus {
    outline: none;
    border-color: #343230;
}

.iai-product-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #999;
    pointer-events: none;
}

/* Bouton Import Product */
.iai-import-product-btn {
    padding: 6px 17px 6px 7px;
    background: #343230;
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.iai-import-product-btn:hover {
    background: #343230;
    transform: translateY(-1px);
}

.iai-import-product-btn svg {
    width: 25px;
    height: 25px;
}

/* Layout : Grille à gauche, Sidebar à droite */
.iai-product-layout {
    display: grid;
    grid-template-columns: 1fr 204px;
    gap: 32px;
}

/* Content Area (grille à gauche) */
.iai-product-content {
    min-width: 0;
}

/* Sidebar Filtres (à droite) */
.iai-product-sidebar {
    position: fixed;
    top: 140px;
    right: 12%;
    width: 183px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: fit-content;
}

/* Boutons dans la sidebar */
.iai-product-sidebar > .iai-import-product-btn {
    width: fit-content;
    justify-content: center;
}

.iai-product-sidebar > .iai-product-action-btn {
    width: fit-content;
    padding: 9px 20px;
    color: #362B19;
    border: 1px solid #E5E1DA;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #F0EDE8 0% 0% no-repeat padding-box;
    border: 1px solid #E5E1DA;
    border-radius: 30px;
    transition: all 0.2s;
}

.iai-product-sidebar > .iai-product-action-btn:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #362B19;
}

.iai-product-sidebar > .iai-product-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.iai-product-sidebar > .iai-product-action-btn svg {
    width: 16px;
    height: 16px;
}

.iai-product-filters {
    background: white;
    padding: 20px;
    box-shadow: 0px 10px 24px #362B190A;
    border: 1px solid #E5E1DA;
    border-radius: 9px;
    margin-top: 10px;
}

/* Bouton Liked */
.iai-product-filter-liked {
    width: 100%;
    padding: 12px 0;
    background: white;
    border: none;
    border-top: 1px solid #E5E1DA;
    border-bottom: 1px solid #E5E1DA;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    margin-bottom: 16px;
    color: #362B19;
}

.iai-product-filter-liked svg {
    width: 18px;
    height: 18px;
}

.iai-product-filter-liked.active svg {
    fill: currentColor;
}

/* Search dans les filtres */
.iai-product-filters .iai-product-search {
    margin-bottom: 20px;
}

.iai-product-filters h3 {
    margin: 0 0 16px 0;
    font-size: 14px;
    font-weight: 600;
    color: #362B19;
}

.iai-product-filter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.iai-product-filter-item {
    padding: 4px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    color: #7E7975;
    text-align: left;
    width: fit-content;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.iai-product-filter-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.iai-product-filter-item.active {
    font-weight: 500;
    background: #F0EDE8 0% 0% no-repeat padding-box;
    border: 1px solid #E5E1DA;
}

.iai-product-filter-count {
    margin-left: auto;
    font-size: 12px;
    color: #999;
}

/* Styles supplémentaires pour h4 dans sidebar */
.iai-product-filters h4 {
    margin: 16px 0 12px 0;
    font-size: 12px;
    font-weight: 600;
    color: #362B19;
}

/* Grille de produits */
.iai-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
    gap: 40px 10px;
}

/* Card Produit */
.iai-product-card {
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

/* Wrapper Image */
.iai-product-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 133.33%; /* 3:4 aspect ratio (4/3 * 100) */
    background: #f5f5f5;
    border-radius: 3px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    border: 1px solid transparent;
}

/* Bordure noire quand la checkbox est cochée */
.iai-product-image-wrapper:has(.iai-product-select:checked) {
    border: 1px solid #000;
}

/* Checkbox sélection */
.iai-product-select {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
    accent-color: #f2330d;
    appearance: none;
}

/* Bouton Like */
.iai-product-like-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    color: #666;
}

.iai-product-like-btn svg {
    width: 20px;
    height: 20px;
}

.iai-product-like-btn.liked {
    background: rgba(242, 51, 13, 0.15);
    color: rgb(242, 51, 13);
}

.iai-product-like-btn.liked svg {
    fill: rgb(242, 51, 13);
}

.iai-product-like-btn:hover {
    background: rgba(242, 51, 13, 0.15);
    color: rgb(242, 51, 13);
    transform: scale(1.1);
}

/* Image */
.iai-product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

/* Info - EN DESSOUS de la carte */
.iai-product-info {
    padding: 12px 4px 0 4px;
}

.iai-product-title {
    margin: 0 0 4px 0;
    font-weight: 500;
    font-size: 13px;
    text-align: center;
    color: #343230;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iai-product-type {
    display: inline-block;
    padding: 4px 10px;
    background: #f5f5f5;
    border-radius: 999px;
    font-size: 11px;
    color: #343230;
    text-transform: capitalize;
}

/* Image cliquable */
.iai-product-image {
    cursor: pointer;
}

/* Actions - Volet blanc en bas (slide up) */
.iai-product-actions-slide {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 38px;
    border-radius: 0 0 3px 3px;
    border: 1px solid #B3B1AE;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 12px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 1px 10px rgba(0, 0, 0, 0.1);
}

.iai-product-image-wrapper:hover .iai-product-actions-slide {
    transform: translateY(0);
}

.iai-product-action-btn-slide {
    position: relative;
    flex: 1;
    padding: 4px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
}

.iai-product-action-btn-slide svg {
    width: 18px;
    height: 18px;
}

.iai-product-action-btn-slide:hover {
    background: transparent;
    border-radius: 3px;
}

.iai-product-action-btn-slide.liked {
    background: transparent;
    color: #343230;
}

.iai-product-action-btn-slide.liked svg {
    fill: #343230;
}

.iai-product-action-btn-slide.danger:hover {
    background: transparent;
}

/* Tooltips personnalisés pour les boutons */
.iai-product-action-btn-slide[data-title]::after {
    content: attr(data-title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #222;
    color: white;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.iai-product-action-btn-slide:hover::after {
    opacity: 1;
}

/* Empty State */
.iai-product-empty {
    text-align: center;
    padding: 80px 20px;
    color: #999;
}

.iai-product-empty svg {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    opacity: 0.3;
}

.iai-product-empty h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #666;
}

.iai-product-empty p {
    margin: 0 0 24px 0;
    font-size: 14px;
}

/* === MODAL IMPORT PRODUCT === */
.iai-import-product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.iai-import-product-modal.active {
    display: flex;
}

.iai-import-product-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.iai-import-product-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.iai-import-product-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.iai-import-product-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.iai-import-product-modal h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
}

.iai-import-product-modal p {
    margin: 0 0 24px 0;
    color: #666;
    font-size: 14px;
}

/* Dropzone */
.iai-import-dropzone {
    border: 2px dashed #e0e0e0;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 24px;
}

.iai-import-dropzone:hover,
.iai-import-dropzone.dragover {
    border-color: #f2330d;
    background: rgba(242, 51, 13, 0.02);
}

.iai-import-dropzone svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: #999;
}

.iai-import-dropzone-text {
    font-size: 16px;
    font-weight: 500;
    color: #222;
    margin: 0 0 4px 0;
}

.iai-import-dropzone-hint {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* Preview Single Product */
.iai-import-preview-single {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
}

.iai-import-preview-image-single {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.iai-import-preview-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Footer Actions */
.iai-import-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.iai-import-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.iai-import-cancel-btn:hover {
    background: #f5f5f5;
}

.iai-import-submit-btn {
    padding: 10px 24px;
    background: #f2330d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.iai-import-submit-btn:hover:not(:disabled) {
    background: #d92d0b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 51, 13, 0.3);
}

.iai-import-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === MODAL EDIT PRODUCT === */
.iai-edit-product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.iai-edit-product-modal.active {
    display: flex;
}

.iai-edit-product-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.iai-edit-product-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.iai-edit-product-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.iai-edit-product-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.iai-edit-product-form {
    padding: 40px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.iai-edit-product-image-container {
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.iai-edit-product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.iai-edit-product-form h2 {
    margin: 0 0 24px 0;
    font-size: 20px;
}

.iai-form-group {
    margin-bottom: 20px;
}

.iai-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #444;
}

.iai-form-group input,
.iai-form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.iai-form-group input:focus,
.iai-form-group select:focus {
    outline: none;
    border-color: #f2330d;
    box-shadow: 0 0 0 3px rgba(242, 51, 13, 0.1);
}

.iai-edit-product-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.iai-edit-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.iai-edit-cancel-btn:hover {
    background: #f5f5f5;
}

.iai-edit-save-btn {
    padding: 10px 24px;
    background: #f2330d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.iai-edit-save-btn:hover {
    background: #d92d0b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 51, 13, 0.3);
}

/* === MODAL CREATE PRODUCT MOODBOARD === */
.iai-product-moodboard-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.iai-product-moodboard-modal.active {
    display: flex;
}

.iai-product-moodboard-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.iai-product-moodboard-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.iai-product-moodboard-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.iai-product-moodboard-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.iai-product-moodboard-modal h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
}

.iai-product-moodboard-modal p {
    margin: 0 0 24px 0;
    color: #666;
    font-size: 14px;
}

.iai-product-moodboard-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.iai-product-moodboard-item {
    position: relative;
    background: #f9f9f9;
    border-radius: 12px;
    overflow: hidden;
}

.iai-product-moodboard-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.iai-product-moodboard-item-title {
    padding: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #222;
    background: white;
}

.iai-product-moodboard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.iai-moodboard-cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.iai-moodboard-cancel-btn:hover {
    background: #f5f5f5;
}

.iai-moodboard-create-btn {
    padding: 10px 24px;
    background: #f2330d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.iai-moodboard-create-btn:hover {
    background: #d92d0b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(242, 51, 13, 0.3);
}

.iai-moodboard-create-btn svg {
    width: 18px;
    height: 18px;
}

/* Loading State */
.iai-product-loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.iai-product-loading svg {
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .iai-product-layout {
        flex-direction: column;
    }
    
    .iai-product-sidebar {
        width: 100%;
    }
    
    .iai-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .iai-product-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .iai-product-search {
        max-width: none;
    }
}
