/* =========================================
   1. General Layout & Typography
   ========================================= */
body {
    background-color: #f4f6f9; /* Slightly cooler gray than default Bootstrap */
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #333;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* Navbar Brand Icon color */
.navbar-brand i {
    color: #ffc107; /* Golden rocket icon */
}

/* =========================================
   2. Upload Area (Drag & Drop)
   ========================================= */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    background-color: #ffffff;
    transition: all 0.3s ease-in-out;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Hover state for drag & drop */
.upload-area:hover, 
.upload-area.dragover {
    border-color: #0d6efd; /* Bootstrap Primary Blue */
    background-color: #f0f7ff; /* Very light blue tint */
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.15);
}

.upload-area i {
    transition: color 0.3s ease;
}

.upload-area:hover i {
    color: #0d6efd !important;
}

/* =========================================
   3. Result Cards (The Feed)
   ========================================= */
.card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Subtle lift effect on hover */
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08) !important;
}

/* Image container within the card */
.card img {
    background-color: #f8f9fa;
    border-right: 1px solid #eee;
}

/* Textareas for captions */
textarea.form-control {
    background-color: #f8f9fa; /* Light grey background */
    border: 1px solid #e9ecef;
    font-size: 0.95rem;
    resize: none; /* Prevent manual resizing breaking layout */
}

textarea.form-control:focus {
    background-color: #fff;
    box-shadow: none;
    border-color: #86b7fe;
}

/* =========================================
   4. Buttons & Interactive Elements
   ========================================= */
/* Submit Button */
#submit-btn {
    padding: 12px 20px;
    font-weight: 600;
    border-radius: 8px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

#submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Copy Buttons */
.copy-btn {
    min-width: 75px; /* Ensures button width doesn't jump when text changes to "Copied" */
    font-weight: 500;
}

/* Loading Spinner Container */
#loading-state {
    background: rgba(255,255,255,0.8);
    border-radius: 12px;
}

/* =========================================
   5. Animations
   ========================================= */
/* Fade In Animation for new results */
.fade-in-animation {
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

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

/* =========================================
   6. Mobile Responsiveness
   ========================================= */
@media (max-width: 768px) {
    /* Stack the image on top for mobile */
    .card .row > div {
        width: 100%; 
    }
    
    .card img {
        border-right: none;
        border-bottom: 1px solid #eee;
        max-height: 250px;
        width: 100%;
        object-fit: contain;
    }

    .display-5 {
        font-size: 2rem; /* Smaller title on mobile */
    }
    
    .upload-area {
        padding: 2rem !important; /* Less padding on mobile */
    }
}


.hover-show {
    transition: opacity 0.2s ease;
}

.card:hover .hover-show {
    opacity: 1 !important;
}

/* Fix modal image on mobile */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* =========================================
   7. Dense Grid & Hover Effects
   ========================================= */

/* Ensure the image container is relative so we can absolute position the overlay */
.img-wrapper {
    position: relative;
    overflow: hidden;
    padding-top: 100%; /* Creates a 1:1 Square aspect ratio */
}

/* The image itself fills the square */
.img-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures image covers the square without stretching */
    transition: transform 0.5s ease;
}

/* The Overlay (Hidden by default) */
.caption-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0));
    color: white;
    padding: 20px 10px 10px 10px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

/* Hover Actions */
.card:hover .caption-overlay {
    opacity: 1;
    transform: translateY(0);
}

.card:hover .img-wrapper img {
    transform: scale(1.05); /* Zoom effect */
}

/* Grid Spacing Tweak */
.row.g-2 {
    margin-right: -5px;
    margin-left: -5px;
}
.row.g-2 > .col, 
.row.g-2 > [class*="col-"] {
    padding-right: 5px;
    padding-left: 5px;
}