/**
 * AI Image Shortcode & Chat Styling
 *
 * @package AI_Chat_Interface
 */

/* ===== Image Container (Shortcode) ===== */
.aci-image-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===== Prompt Form ===== */
.aci-image-prompt-form {
    margin-bottom: 15px;
}

.aci-image-prompt-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 10px;
}

.aci-image-prompt-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* ===== Generate Button ===== */
.aci-generate-image-btn {
    width: 100%;
    padding: 12px 20px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.aci-generate-image-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.aci-generate-image-btn:active {
    transform: translateY(0);
}

.aci-generate-image-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== Loading State ===== */
.aci-image-loading {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    font-size: 14px;
}

/* ===== Image Result ===== */
.aci-image-wrapper {
    text-align: center;
    padding: 10px 0;
}

.aci-image-thumbnail {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.aci-image-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== Action Buttons ===== */
.aci-image-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.aci-image-download-btn,
.aci-image-view-btn {
    padding: 8px 16px;
    background: #28a745;
    color: #fff;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s ease;
    display: inline-block;
}

.aci-image-download-btn:hover,
.aci-image-view-btn:hover {
    background: #218838;
    color: #fff;
}

/* ===== Image Meta Info ===== */
.aci-image-prompt-text {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.aci-image-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #999;
}

/* ===== Error State ===== */
.aci-image-error {
    background: #f44336;
    color: #fff;
    padding: 12px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
}

/* ===== Modal/Lightbox ===== */
.aci-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aci-image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.aci-image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1000000;
    animation: aciModalFadeIn 0.2s ease-out;
}

@keyframes aciModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.aci-image-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: block;
}

.aci-image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    font-weight: 300;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    transition: color 0.2s ease;
}

.aci-image-modal-close:hover {
    color: #ccc;
}

/* ===== Chat-integrated Image Messages ===== */
.aci-message-image {
    max-width: 100%;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
}

.aci-message-image .aci-image-thumbnail {
    max-width: 400px;
    margin-bottom: 10px;
    display: block;
}

.aci-message-image .aci-image-download-btn {
    display: inline-block;
    margin-top: 5px;
}

.aci-message-image .aci-image-prompt-text {
    margin-top: 8px;
    margin-bottom: 0;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .aci-image-container {
        margin: 10px;
        padding: 15px;
    }

    .aci-image-modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }

    .aci-image-modal-close {
        top: 10px;
        right: 10px;
        background: rgba(0,0,0,0.5);
        border-radius: 50%;
        width: 36px;
        height: 36px;
        font-size: 28px;
    }

    .aci-message-image .aci-image-thumbnail {
        max-width: 100%;
    }
}
