/* ==========================================================================
   Festede AI – Frontend stílusok
   ========================================================================== */

/* --------------------------------------------------------------------------
   Wrapper
   -------------------------------------------------------------------------- */
/* Image cutter konténer - vizuálisan rejtett, de a position:fixed modal átlép rajta */
.festede-ai-cutter-container {
    position: absolute;
    height: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
}

.festede-ai-wrapper {
    margin: 16px 0;
    padding: 20px;
    background: #fff8fc;
    border: 2px solid #e8ddd1;
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.festede-ai-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.festede-ai-title {
    font-size: 18px;
    font-weight: 700;
    color: #2c2c2c;
    margin: 0;
    line-height: 1.3;
}

.festede-ai-badge {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Label + Info gomb
   -------------------------------------------------------------------------- */
.festede-ai-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.festede-ai-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.festede-ai-info-btn:hover {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Tooltip
   -------------------------------------------------------------------------- */
.festede-ai-tooltip {
    display: none;
    position: relative;
    z-index: 10;
    margin-bottom: 12px;
}

.festede-ai-tooltip-content {
    background: #fff;
    border: 1px solid #594196;
    border-radius: 10px;
    padding: 14px 18px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    line-height: 1.6;
    color: #555;
    position: relative;
}

.festede-ai-tooltip-content p {
    margin: 0 0 8px;
}

.festede-ai-tooltip-content ul {
    margin: 0;
    padding-left: 18px;
}

.festede-ai-tooltip-content li {
    margin-bottom: 4px;
}

.festede-ai-tooltip-content em {
    color: #ff97cb;
    font-style: italic;
}

.festede-ai-tooltip-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #999;
    padding: 2px 6px;
    line-height: 1;
}

.festede-ai-tooltip-close:hover {
    color: #333;
}

/* --------------------------------------------------------------------------
   Textarea
   -------------------------------------------------------------------------- */
.festede-ai-input-row {
    position: relative;
    margin-bottom: 12px;
}

#festede-ai-prompt {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #efa9cc;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    min-height: 100px;
    background: #fff;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#festede-ai-prompt:focus {
    outline: none;
    border-color: #B9427E;
    box-shadow: 0 0 0 3px rgba(196, 154, 60, 0.15);
}

#festede-ai-prompt::placeholder {
    color: #aaa;
    font-style: italic;
}

.festede-ai-char-count {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Tájolás gombok
   -------------------------------------------------------------------------- */
.festede-ai-orientation-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.festede-ai-orientation-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    width: 100%;
    margin-bottom: 2px;
}

.festede-ai-orient-btn {
    flex: 1 1 0;
    padding: 10px 12px;
    border: 2px solid #e0d4c8;
    background: #faf6f1;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: border-color 0.18s, background 0.18s, color 0.18s;
    text-align: center;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.festede-ai-orient-btn:hover {
    border-color: #B9427E;
    background: #fef0f5;
}

.festede-ai-orient-btn.active {
    border-color: #B9427E;
    background: linear-gradient(135deg, rgba(185, 66, 126, 0.08), rgba(89, 65, 150, 0.08));
    color: #B9427E;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Generálás gomb
   -------------------------------------------------------------------------- */
.festede-ai-generate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #B9427E 0%, #594196 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-align: center;
    letter-spacing: 0.3px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.festede-ai-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(89, 65, 150, 0.35);
}

.festede-ai-generate-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.festede-ai-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --------------------------------------------------------------------------
   Töltő animáció
   -------------------------------------------------------------------------- */
.festede-ai-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    margin-top: 12px;
}

.festede-ai-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8ddd1;
    border-top-color: #c49a3c;
    border-radius: 50%;
    animation: festede-ai-spin 0.8s linear infinite;
}

@keyframes festede-ai-spin {
    to {
        transform: rotate(360deg);
    }
}

.festede-ai-loading-text {
    margin: 12px 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: #555;
}

.festede-ai-loading-sub {
    margin: 0;
    font-size: 12px;
    color: #999;
}

.festede-ai-dots {
    display: inline;
}

/* --------------------------------------------------------------------------
   Hiba üzenet
   -------------------------------------------------------------------------- */
.festede-ai-error {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fff0f0;
    border: 1px solid #f5c6c6;
    border-radius: 8px;
    color: #c00;
    font-size: 14px;
    line-height: 1.5;
}

.festede-ai-error p {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Előnézet
   -------------------------------------------------------------------------- */
.festede-ai-preview {
    margin-top: 16px;
    text-align: center;
}

.festede-ai-preview-label {
    font-size: 14px;
    font-weight: 600;
    color: #2d8a4e;
    margin: 0 0 10px;
}

.festede-ai-preview-img-wrapper {
    position: relative;
    display: inline-block;
    margin: 0 auto 12px;
    max-width: 100%;
}

.festede-ai-preview-img {
    display: block;
    max-width: 100%;
    max-height: 340px;
    border-radius: 8px;
    border: 2px solid #ddd4c9;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

/* Vízjel overlay */
.festede-ai-watermark {
    position: absolute;
    inset: 0;
    background-position: center;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
    border-radius: 8px;
    filter: grayscale(1);
    background-repeat: repeat;
    background-size: 100px;
}

/* Lightbox gomb */
.festede-ai-lightbox-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 16px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: background 0.2s;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.festede-ai-lightbox-btn:hover {
    background: rgba(255, 255, 255, 1);
}

/* Módosítom + Törlés akciók */
.festede-ai-preview-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.festede-ai-preview-edit {
    padding: 8px 16px;
    background: #f0f4fa;
    color: #594196;
    border: 2px solid #594196;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.festede-ai-preview-edit:hover {
    background: #e8ecf8;
}

.festede-ai-preview-delete {
    padding: 8px 16px;
    background: #fff0f0;
    color: #c0392b;
    border: 2px solid #c0392b;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    -webkit-appearance: none;
    touch-action: manipulation;
}

.festede-ai-preview-delete:hover {
    background: #ffe6e6;
}

/* Új kép generálása gomb */
.festede-ai-preview-new {
    display: block;
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, #B9427E 0%, #594196 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.festede-ai-preview-new:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(89, 65, 150, 0.35);
}

/* Lightbox overlay */
.festede-ai-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1000001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: zoom-out;
    box-sizing: border-box;
}

.festede-ai-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    cursor: default;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

.festede-ai-lightbox-img-wrapper {
    position: relative;
    display: inline-flex;
    max-width: 90vw;
    max-height: 90vh;
}

.festede-ai-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
    -webkit-appearance: none;
}

.festede-ai-lightbox-close:hover {
    background: #fff;
}

/* --------------------------------------------------------------------------
   Mobil optimalizálás
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .festede-ai-wrapper {
        padding: 14px;
        margin: 12px 0;
    }

    .festede-ai-title {
        font-size: 16px;
    }

    #festede-ai-prompt {
        font-size: 16px;
        /* iOS zoom megelőzése */
    }

    .festede-ai-generate-btn {
        font-size: 15px;
        padding: 12px 20px;
    }

    .festede-ai-orient-btn {
        padding: 8px 8px;
        font-size: 13px;
    }

    .festede-ai-preview-edit,
    .festede-ai-preview-delete {
        padding: 7px 12px;
        font-size: 12px;
    }

    .festede-ai-preview-new {
        font-size: 13px;
        padding: 10px 14px;
    }
}

/* --------------------------------------------------------------------------
   FaceSwap – Forráskép feltöltés terület
   -------------------------------------------------------------------------- */
.festede-ai-upload-area {
    border: 2px dashed #efa9cc;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 14px;
    overflow: hidden;
}

.festede-ai-upload-area:hover,
.festede-ai-upload-area.festede-ai-upload-dragover {
    border-color: #B9427E;
    background: #fef0f5;
}

.festede-ai-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
    text-align: center;
}

.festede-ai-upload-icon {
    font-size: 40px;
    margin-bottom: 10px;
    line-height: 1;
}

.festede-ai-upload-text {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin: 0 0 4px;
}

.festede-ai-upload-hint {
    font-size: 12px;
    color: #999;
    margin: 0;
}

.festede-ai-upload-preview-area {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.festede-ai-upload-preview-area img {
    max-width: 100%;
    max-height: 260px;
    border-radius: 8px;
    border: 2px solid #ddd4c9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    display: block;
}

.festede-ai-upload-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(192, 57, 43, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
    -webkit-appearance: none;
    touch-action: manipulation;
    z-index: 2;
}

.festede-ai-upload-remove:hover {
    background: rgba(192, 57, 43, 1);
}

@media (max-width: 480px) {
    .festede-ai-upload-placeholder {
        padding: 20px 12px;
    }

    .festede-ai-upload-icon {
        font-size: 32px;
    }

    .festede-ai-upload-text {
        font-size: 13px;
    }

    .festede-ai-upload-preview-area img {
        max-height: 200px;
    }
}