/* Vision Interface Styles
=========================================================
This file contains styles specific to the vision/image handling 
interface of MagicPrompt. It controls the layout and appearance 
of the image upload, preview, and analysis sections.

TABLE OF CONTENTS:
1. Vision Section Layout
2. Image Upload Interface
3. Image Preview
4. Info Section & Captions
5. Action Buttons
6. Loading States
=========================================================== */

/* 1. VISION SECTION LAYOUT 
   Main container for the vision interface */
.magicprompt #vision_section {
    width: 400px; /* Initial width before resize */
    min-width: 300px;
    max-width: calc(100% - 300px);
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

    /* Section content wrapper - Contains all vision components */
    .magicprompt #vision_section .section-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        position: relative;
        height: 100%;
    }

/* Header Section Styling */
.magicprompt .section-header #upload_image_button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

/* 2. IMAGE UPLOAD INTERFACE 
   Drag-and-drop zone and upload controls */

/* Main upload area container */
.magicprompt #image_upload_area {
    position: absolute;
    top: 40px; /* Below header */
    bottom: 250px; /* Above info section */
    left: 0;
    right: 0;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Hidden file input for drag-drop functionality */
.magicprompt #image_input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 0;
}

/* Upload instructions display */
.magicprompt .upload-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    padding: 1rem;
    color: var(--text-color-secondary);
}

.magicprompt .upload-icon {
    font-size: 48px;
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* 3. IMAGE PREVIEW 
   Image display after upload */

.magicprompt #image_preview_container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 1rem;
    display: none; /* Hidden until image upload */
    justify-content: center;
    align-items: center;
    background: var(--background);
    z-index: 2;
}

.magicprompt .preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: none;
    margin: auto;
}

/* 4. INFO SECTION & CAPTIONS 
   Bottom section showing image details and generated captions */

.magicprompt .vision-info-section {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: 250px;
    overflow-y: auto;
}

/* Caption display area */
.magicprompt .caption-container {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    background: var(--background);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.magicprompt .caption-content {
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 0.5rem;
    line-height: 1.5;
    text-align: center;
}

/* 5. ACTION BUTTONS 
   Controls for image manipulation and caption generation */

.magicprompt .vision-actions {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--background);
    padding: 1rem;
    display: none; /* Hidden until image upload */
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
}

    /* Individual action buttons */
    .magicprompt .vision-actions button {
        min-width: 80px;
        padding: 0.25rem 1rem;
        background: var(--background);
        color: var(--text-color);
        border: 1px solid var(--border-color);
        border-radius: 4px;
        cursor: pointer;
    }

        /* Danger button variation (e.g., Clear button) */
        .magicprompt .vision-actions button.danger {
            color: var(--error-color);
            border-color: var(--error-color);
        }

/* 6. LOADING STATES 
   Loading animations for processing states */

.magicprompt .typing-animation {
    display: none;
    padding: 1rem;
    justify-content: center;
    gap: 4px;
}

    .magicprompt .typing-animation.active {
        display: flex;
    }

    /* Loading animation dots */
    .magicprompt .typing-animation .dot {
        width: 8px;
        height: 8px;
        background: var(--emphasis);
        border-radius: 50%;
        animation: bounce 1.4s infinite ease-in-out;
    }

        .magicprompt .typing-animation .dot:nth-child(1) {
            animation-delay: -0.32s;
        }

        .magicprompt .typing-animation .dot:nth-child(2) {
            animation-delay: -0.16s;
        }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}
