/* ========================================================================
 * image-modal.css — 全站「圖片展開檢視」modal 樣式(v32.1.269 從 customize.css 抽出)
 *
 * 為什麼獨立成一個檔:
 *   這組樣式被多個頁面共用(image-modal.js / main.js / my-designs.js 各自建 modal),
 *   但多數頁面沒有載 customize.css → modal 沒有 position:fixed,
 *   圖片會被當成普通 div  appended 到 body 底部,而不是全屏覆蓋。
 *   → 統一由本檔提供,每個會用到 modal 的頁面都載入。
 * ======================================================================== */

/* AI Image Modal (full screen view) */
.ai-image-modal {

    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: aiImageModalFadeIn 0.25s ease-out;

}

.ai-image-modal.active {

    display: flex;

}

@keyframes aiImageModalFadeIn {

    from { opacity: 0; }
    to { opacity: 1; }

}

.ai-image-modal-overlay {

    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;

}

.ai-image-modal-content {

    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    padding: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;

}

.ai-image-modal-img {

    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    display: block;
    border-radius: 8px;

}

.ai-image-modal-close {

    position: absolute;
    top: -14px;
    right: -14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-color, #b8860b);
    color: white;
    border: 2px solid white;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    z-index: 2;

}

.ai-image-modal-close:hover {

    background: var(--primary-dark, #9a6f08);
    transform: scale(1.1) rotate(90deg);

}

.ai-image-modal-toolbar {

    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    justify-content: center;
    padding-top: 4px;
    border-top: 1px solid var(--border-color, #e0e0e0);

}

.ai-image-modal-download {

    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color, #b8860b);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;

}

.ai-image-modal-download:hover {

    background: var(--bg-light, #f5f5f5);
    transform: translateY(-1px);

}

/* AI image modal title */
.ai-image-modal-title {

    width: 100%;
    text-align: center;
    color: var(--text-dark, #333);
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: -4px;

}

/* Mobile responsive */
@media (max-width: 640px) {
    .ai-image-modal {

        padding: 12px;
    
    }
    .ai-image-modal-content {

        max-width: 95vw;
        max-height: 92vh;
        padding: 10px;
    
    }
    .ai-image-modal-img {

        max-height: 70vh;
    
    }
    .ai-image-modal-close {

        width: 34px;
        height: 34px;
        top: -12px;
        right: -8px;
    
    }
}
