/* ============================================
   POPUP IMMERSIVE CREATE - STYLE MAQUETTE
   ============================================ */

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

/* Aspect Ratio Select dans la topbar */
.iai-aspect-ratio-select {
    padding: 10px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #222;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 12px;
}

.iai-aspect-ratio-select:hover {
    border-color: #f2330d;
}

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

/* Container de la popup - commence sous la topbar */
.iai-create-detail-popup {
    position: fixed;
    top: 95px;
    left: 220px;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

.iai-create-detail-popup[style*="display: block"] {
    display: flex !important;
}

/* Backdrop avec blur */
.iai-popup-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(252, 252, 253, 0.90);
    backdrop-filter: blur(8px);
    z-index: 1;
}

/* Container principal - 2 colonnes */
.iai-popup-container {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    gap: 0;
}

/* Colonne gauche - Image (70%) */
.iai-popup-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 40px;
    overflow: auto;
}

/* Bouton fermer */
.iai-popup-close {
    position: absolute;
    top: 24px;
    right: 18px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.iai-popup-close:hover {
    border-color: #222;
    transform: scale(1.05);
}

.iai-popup-close svg {
    color: #222;
}

/* Container de l'image */
.iai-popup-image-container {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iai-popup-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    cursor: grab;
}

.iai-popup-image:active {
    cursor: grabbing;
}

/* Colonne droite - Sidebar (30%) */
.iai-popup-right {
    width: 480px;
    background: #FAF9F8;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
    padding: 24px 6% 24px 24px;
}

/* Header avec actions */
.iai-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.iai-popup-header-title {
    font-size: 13px;
    font-weight: 600;
    color: #343230;
}

.iai-popup-header-actions {
    display: flex;
    gap: 8px;
}

.iai-popup-more-actions-row button,
.iai-more-action-btn {
    padding: 6px 8px;
    gap: 6px;
    background: #F0EDE8;
    border: 1px solid #E5E1DA;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    width: fit-content;
    color: #343230;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
}

.iai-popup-action-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.iai-popup-action-btn:hover {
    background: #f5f5f5;
    border-color: #343230;
}

.iai-popup-action-btn svg {
    color: #343230;
}

.iai-popup-action-btn:hover svg {
    color: #343230;
}

.iai-popup-action-btn.liked {
    background: #ffe8e0;
    border-color: #343230;
}

.iai-popup-action-btn.liked svg {
    color: #343230;
}

/* Sections de contenu */
.iai-popup-section {
    margin-bottom: 10px;
}

.iai-popup-section-title {
    margin-bottom: 15px;
    font-size: 13px;
    font-weight: 600;
    color: #343230;
}

/* Prompt */
.iai-popup-prompt {
    font-size: 12px;
    line-height: 1.6;
    color: #343230;
}

/* Images de référence */
.iai-popup-references {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.iai-popup-reference-thumb {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(0,0,0,0.05);
    transition: all 0.2s;
    position: relative;
}

.iai-popup-reference-thumb img {
    width: 100%;
    height: 100%!important;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.iai-popup-reference-thumb:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
}

.iai-popup-reference-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(60px 60px at 50% 50%, rgba(255,255,255,0.00), rgba(0,0,0,0.22));
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.iai-popup-reference-thumb:hover::after {
    opacity: 1;
}

.iai-reference-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iai-reference-lightbox.hidden {
    display: none;
}

.iai-reference-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(252, 252, 253, 0.70);
    backdrop-filter: blur(8px);
}

.iai-reference-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: min(1100px, 92vw);
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iai-reference-lightbox-image {
    max-width: 100%;
    max-height: calc(92vh - 36px);
    object-fit: contain;
    border-radius: 10px;
}

.iai-reference-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.iai-reference-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: scale(1.04);
}

/* Format */
.iai-popup-format {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: #343230;
}

/* Shortcuts Menu */
.iai-popup-shortcuts-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.iai-shortcut-menu-item {
    overflow: hidden;
    background: white;
    width: fit-content;
    transition: all 0.2s;
}

.iai-shortcut-menu-header {
    display: flex;
    align-items: center;
    width: -webkit-fill-available;
    gap: 12px;
    padding: 7px 16px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    background: #F0EDE8 0% 0% no-repeat padding-box;
    border: 1px solid #E5E1DA;
    border-radius: 3px;
}

.iai-shortcut-menu-header:hover {
    background: #f5f5f5;
}

.iai-shortcut-menu-header svg:first-child {
    color: #343230;
    flex-shrink: 0;
    width: 16px;
    height: auto;
}

.iai-shortcut-menu-header:hover svg:first-child {
    color: #000;
}

.iai-shortcut-menu-header span {
    flex: 1;
    font-size: 12px;
    color: #343230;
    font-weight: 400;
}

.iai-shortcut-menu-header .iai-chevron {
    color: #999;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.iai-shortcut-menu-item.active .iai-chevron {
    transform: rotate(90deg);
}

.iai-shortcut-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.iai-shortcut-menu-item.active .iai-shortcut-submenu {
    max-height: 500px;
}

.iai-shortcut-submenu button:first-child {
    padding-top: 20px;
}
.iai-shortcut-submenu button:last-child {
    padding-bottom: 20px;
}

.iai-shortcut-submenu-item {
    width: 100%;
    padding: 7px 16px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 9px;
}

.iai-shortcut-submenu-item:last-child {
    border-bottom: none;
}

.iai-shortcut-submenu-item:hover {
    background: #fff;
    color: #000;
    padding-left: 16px;
}

/* More Actions Section */

.globalmoreactions {
    margin-top: 30px;
}
.iai-more-action-btn {
    padding: 6px 8px;
    gap: 6px;
    background: #F0EDE8;
    border: 1px solid #E5E1DA;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    width: fit-content;
    color: #343230;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.iai-more-action-btn:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.iai-more-action-btn svg {
    flex-shrink: 0;
    color: #343230;
    width: 18px;
    height: auto;
}

.iai-popup-section.moreaction {
    display: flex;
    gap: 15px;
    align-items: center;
}

.iai-more-action-btn:hover svg {
    color: #000;
}

.iai-more-action-btn span {
    flex: 1;
    text-align: left;
}

/* More Actions Row - Boutons en ligne */
.iai-popup-more-actions-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.iai-more-action-btn-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    padding: 12px 8px;
    background: white;
    border: 1px solid #E8E8E8;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    color: #343230;
    font-weight: 400;
}

.iai-more-action-btn-inline:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.iai-more-action-btn-inline svg {
    flex-shrink: 0;
    color: #343230;
    width: 18px;
    height: auto;
}

.iai-more-action-btn-inline:hover svg {
    color: #000;
}

.iai-more-action-btn-inline span {
    text-align: center;
    line-height: 1.2;
}

/* Responsive */
@media (max-width: 1200px) {
    .iai-popup-right {
        width: 320px;
    }
}

@media (max-width: 768px) {
    .iai-popup-container {
        flex-direction: column;
    }
    
    .iai-popup-left {
        height: 50%;
    }
    
    .iai-popup-right {
        width: 100%;
        height: 50%;
        border-left: none;
        border-top: 1px solid #e8e8e8;
    }
}

/* Animation d'ouverture */
@keyframes popupFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.iai-create-detail-popup[style*="display: block"] {
    animation: popupFadeIn 0.3s ease-out;
}

.iai-create-detail-popup[style*="display: block"] .iai-popup-container {
    animation: popupSlideUp 0.3s ease-out;
}

@keyframes popupSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
