/* New Render Page Styles - Unified Modal Design */
/* Full Redesign: Mobile-first, progressive disclosure, intuitive UX */

/* ============================================
   HERO UPLOAD ZONE (Empty State)
   ============================================ */

.upload-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    padding: 3rem 2rem;
    text-align: center;
}

.upload-hero-content {
    max-width: 500px;
    width: 100%;
}

.upload-hero-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.1);
    border: 2px solid rgba(0, 212, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #00d4ff;
    transition: all 0.3s ease;
}

.upload-hero-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.upload-hero-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2rem;
}

/* Large drop zone */
.upload-drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 3rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-drop-zone:hover {
    border-color: rgba(0, 212, 255, 0.5);
    background: rgba(0, 212, 255, 0.05);
}

.upload-drop-zone:hover .upload-hero-icon {
    transform: scale(1.1);
    background: rgba(0, 212, 255, 0.15);
}

.upload-drop-zone.drag-over {
    border-color: #00d4ff;
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.02);
}

.upload-drop-zone.drag-over .upload-hero-icon {
    transform: scale(1.15);
    background: rgba(0, 212, 255, 0.2);
}

.upload-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #00d4ff 0%, #0099ff 100%);
    color: #000;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

.upload-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.3);
}

.upload-formats {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ============================================
   WORKSPACE (When images exist)
   ============================================ */

.render-workspace {
    padding: 1rem;
}

/* Top action bar - sticky on scroll */
.render-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.render-top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.render-top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.image-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.image-count-badge i {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Primary action button */
.btn-render-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #00d4ff 0%, #0099ff 100%);
    color: #000;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-render-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.btn-render-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Secondary action buttons */
.btn-render-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-size: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-render-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-render-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-render-secondary i {
    font-size: 0.75rem;
}

/* Icon-only button variant */
.btn-render-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-render-icon:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-render-icon.btn-danger:hover:not(:disabled) {
    background: rgba(220, 53, 69, 0.2);
    border-color: rgba(220, 53, 69, 0.4);
    color: #ff6b7a;
}

/* ============================================
   MOBILE STICKY BOTTOM BAR
   ============================================ */

.mobile-action-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    gap: 0.75rem;
}

.mobile-action-bar .btn-render-primary {
    flex: 1;
    justify-content: center;
    padding: 1rem;
    font-size: 1rem;
}

.mobile-action-bar .btn-render-secondary {
    padding: 1rem;
}

@media (max-width: 768px) {
    .mobile-action-bar {
        display: flex;
    }

    .render-top-bar {
        display: none;
    }

    /* Add padding to bottom of page for mobile bar */
    .render-workspace {
        padding-bottom: 100px;
    }

    .upload-hero {
        min-height: 60vh;
        padding: 2rem 1rem;
    }

    .upload-drop-zone {
        padding: 2rem 1.5rem;
    }

    .upload-hero-title {
        font-size: 1.25rem;
    }

    /* Hide feedback button on mobile - conflicts with action bar */
    #feedback-widget {
        display: none !important;
    }
}

/* Feedback Modal Form Fixes */
#feedbackModal .form-select,
#feedbackModal .form-control {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

#feedbackModal .form-select:focus,
#feedbackModal .form-control:focus {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #00d4ff;
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(0, 212, 255, 0.25);
}

#feedbackModal .form-select option {
    background-color: #1a1a1a;
    color: #ffffff;
}

#feedbackModal .form-label {
    color: rgba(255, 255, 255, 0.9);
}

#feedbackModal ::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Layout fix removed - need to investigate root cause */

/* Remove hover effects that move panels */
.glass-panel:hover {
    transform: none !important;
}

/* Render Modal */
.render-modal {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.render-modal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.render-cost-info {
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.btn-generate-all,
.btn-download-all,
.btn-clear-all {
    background: linear-gradient(-75deg, rgba(255,255,255,0.05), rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    position: relative;
    display: inline-block;
    text-align: center;
}

.btn-generate-all:hover:not(:disabled),
.btn-download-all:hover:not(:disabled),
.btn-clear-all:hover:not(:disabled) {
    background: linear-gradient(-75deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1));
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Fullscreen navigation buttons - use header button CSS (studio-btn-nav style) */
.fullscreen-nav-btn {
    position: fixed !important;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(-75deg, rgba(255,255,255,0.05), rgba(255,255,255,0.2), rgba(255,255,255,0.05)) !important;
    border: 1px solid rgba(255,255,255,0.5) !important;
    color: white !important;
    width: 50px;
    height: 50px;
    border-radius: 4px !important;
    cursor: pointer;
    font-size: 24px;
    font-weight: 600;
    font-family: 'Segoe UI', Arial, sans-serif;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.fullscreen-nav-btn.fullscreen-next {
    left: auto;
    right: 20px;
}

.fullscreen-nav-btn:hover:not(:disabled) {
    background: linear-gradient(-75deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1)) !important;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 6px rgba(0, 0, 0, 0.3);
    transform: translateY(-50%);
}

.fullscreen-nav-btn:active:not(:disabled) {
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.06) 100%) !important;
    transform: translateY(calc(-50% + 1px));
}

/* Fullscreen action buttons - use header button CSS (studio-btn-nav class handles styling) */
.fullscreen-action-btn {
    /* Styles are inherited from .studio-btn-nav class */
}

.btn-generate-all:disabled,
.btn-download-all:disabled,
.btn-clear-all:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-generate-all > span,
.btn-download-all > span,
.btn-clear-all > span {
    display: inline;
}

.btn-token-indicator {
    font-size: 10px;
    opacity: 0.8;
    font-weight: 400;
    margin-left: 4px;
    display: inline-block;
}

/* Render Actions (below images) */
.render-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.btn-add-more {
    background: linear-gradient(-75deg, rgba(255,255,255,0.05), rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-more:hover {
    background: linear-gradient(-75deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1));
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Completion Banner */
.completion-banner {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.08) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.completion-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #ffffff;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    font-weight: 500;
}

.completion-banner-content i {
    color: rgba(16, 185, 129, 1);
    font-size: 20px;
}

.completion-banner-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.completion-banner-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 1);
}

.completion-banner-close i {
    font-size: 14px;
}

/* Prismatic Divider */
.rendercad-divider {
    position: relative;
    width: 100%;
    height: 2px;
    overflow: visible;
    margin: 1rem 0;
    display: none; /* Hidden by default, shown when rendering */
    transition: width 0.5s ease-out, margin-left 0.5s ease-out, transform 0.5s ease-out;
}

/* Queued tag */
.queued-tag {
    font-size: 11px !important;
    padding: 2px 6px !important;
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    margin-top: 8px;
}

.rendercad-divider::before {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 1;
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.rendercad-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 1px;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2;
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

/* Image Grid Container */
.image-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Upload Area in Grid */
.upload-area-grid {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    grid-column: 1 / -1; /* Span full width */
    order: -1; /* Always first */
}

.upload-area-grid:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.upload-area-grid.drag-over {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.01);
}

/* Image Card */
.image-card {
    position: relative;
    border: none;
    border-radius: 8px;
    overflow: visible; /* Allow tooltips to show outside card */
    background: #000;
    aspect-ratio: 4/3;
    display: block;
    cursor: pointer;
    transition: cursor 0.2s ease, box-shadow 0.3s ease;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.image-card:hover {
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

/* Shared gradient overlay for both render studio and history - seamless blend */
.image-card::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 50%, rgba(0, 0, 0, 0.4) 80%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
    border-radius: 0 0 8px 8px;
}

/* Hide gradient overlay when rendering or uploading */
.image-card.rendering::before,
.image-card.uploading::before {
    opacity: 0 !important;
}

.image-card:hover::before {
    opacity: 1;
}

/* History info overlay - seamless gradient that blends with ::before */
.history-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    /* Use same gradient stops as ::before for seamless blend */
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.9) 0%, 
        rgba(0, 0, 0, 0.7) 50%, 
        rgba(0, 0, 0, 0.4) 80%, 
        transparent 100%);
    padding: 1rem 0.75rem 0.5rem 0.75rem;
    padding-bottom: 50px; /* Extend to meet bottom gradient seamlessly */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
    border-radius: 0 0 8px 8px;
}

.history-card:hover .history-info-overlay {
    opacity: 1;
}

/* Render studio info overlay - same seamless gradient for consistency */
.image-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    /* Use same gradient stops as ::before for seamless blend */
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.9) 0%, 
        rgba(0, 0, 0, 0.7) 50%, 
        rgba(0, 0, 0, 0.4) 80%, 
        transparent 100%);
    padding: 1rem 0.75rem 0.5rem 0.75rem;
    padding-bottom: 50px; /* Extend to meet bottom gradient seamlessly */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 5;
    border-radius: 0 0 8px 8px;
}

.image-card:hover .image-info-overlay {
    opacity: 1;
}

.image-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #000;
    cursor: pointer;
    border-radius: 8px; /* Match parent border radius */
    clip-path: inset(0 round 8px); /* Ensure images stay within rounded corners */
}

/* Remove Button (X at top right) - match theme */
/* Remove button is now in the action bar, styled like history delete button */
.image-remove-btn {
    flex: 1;
    width: auto;
    min-width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 14px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* X button in top-left corner of each image */
.image-remove-btn-topleft {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    padding: 0;
}

.image-card:hover .image-remove-btn-topleft {
    opacity: 1;
}

.image-remove-btn-topleft:hover {
    background: rgba(220, 53, 69, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Image Uploading State */
.image-card.uploading {
    position: relative;
}

.image-card.uploading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0.5;
    z-index: 6;
    pointer-events: none;
}

.image-card.uploading img {
    opacity: 0.6;
}

.image-card.uploading::after {
    content: attr(data-upload-status);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff !important;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 18px;
    font-weight: 600;
    z-index: 10 !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1), 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    opacity: 1 !important;
    filter: none !important;
}

/* Image Darkened State (when rendering) */
.image-card.rendering {
    position: relative;
}

.image-card.rendering::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 6;
    pointer-events: none;
}

.image-card.rendering img {
    opacity: 0.6;
}

.image-card.rendering::after {
    content: attr(data-upload-status);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 18px;
    font-weight: 600;
    z-index: 10;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 1), 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* Prismatic Loading Bar on Image (25% from bottom) */
.image-loading-bar {
    position: absolute;
    bottom: 25%;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 6;
    overflow: hidden;
}

.image-loading-bar-base {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
}

.image-loading-bar-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, transparent 1.5%, cyan 8%, #faff70 20%, pink 32%, #faff70 44%, cyan 50%, #faff70 56%, pink 68%, #faff70 80%, cyan 92%, transparent 98.5%, transparent 100%);
    background-size: 400% 100%;
    background-position: 0% 0%;
    filter: blur(1px);
    opacity: 1;
    animation: prismaticGlowShift 3s linear infinite;
}

@keyframes prismaticGlowShift {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* Small image buttons - shared base styles matching header button style exactly */
.image-toggle-btn,
.image-download-btn,
.image-redo-btn,
.history-action-btn {
    background: linear-gradient(-75deg, rgba(255,255,255,0.05), rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Shared button sizing - ALL buttons use the same flex sizing */
.image-toggle-btn,
.image-download-btn,
.image-redo-btn,
.history-action-btn {
    flex: 1;
    width: auto;
    min-width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 14px;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover states - match header button hover exactly (NO transform) */
.image-toggle-btn:hover:not(:disabled),
.image-download-btn:hover:not(:disabled),
.image-redo-btn:hover:not(:disabled),
.history-action-btn:hover:not(:disabled) {
    background: linear-gradient(-75deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1)) !important;
    border-color: rgba(255,255,255,0.5) !important;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Shared action container for both render studio and history */
.image-actions,
.history-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    /* No background - gradient overlay provides the darkening */
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10;
    border-radius: 0 0 8px 8px;
}

.image-card:hover .image-actions,
.history-card:hover .history-actions {
    opacity: 1;
    visibility: visible;
}

/* Buttons are now controlled by .image-actions container visibility */


/* Generic button tooltip - reusable for all action buttons */
.button-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    color: white;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1001;
}

.button-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Redo button tooltip needs extra space for token tooltip below it */
.image-redo-btn .button-tooltip {
    margin-bottom: 32px; /* Higher up to make room for token tooltip below */
}

/* Download button tooltip - left-align to prevent clipping at left edge */
.image-download-btn .button-tooltip {
    left: 0;
    transform: translateX(0);
}

.image-download-btn .button-tooltip::after {
    left: 16px; /* Arrow at button center (32px button width ÷ 2) */
    transform: translateX(-50%);
}

/* Re-do button token tooltip (hover popup) - positioned below "Re-render" tooltip, closer to button */
.redo-token-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px; /* Closer to button, appears below the main tooltip */
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 10px;
    color: white;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1000; /* Below main tooltip in z-order */
}

.redo-token-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Icons should be white */
.render-modal-header i,
.image-card i {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Admin button should match other buttons */
#admin-link {
    background: linear-gradient(-75deg, rgba(255,255,255,0.05), rgba(255,255,255,0.2), rgba(255,255,255,0.05)) !important;
    border: 1px solid rgba(255,255,255,0.5) !important;
    color: white !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    transition: all 0.2s ease !important;
}

#admin-link:hover {
    background: linear-gradient(-75deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1)) !important;
    border-color: rgba(0, 255, 255, 0.8) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Navbar brand styling */
.navbar-brand {
    font-family: 'Proxima Nova Thin', 'Inter', sans-serif !important;
    font-weight: 300 !important;
    font-size: 24px !important;
    letter-spacing: -0.01em !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
}

.navbar-brand:hover {
    color: white !important;
}

.navbar-brand img {
    margin-right: 0.5rem;
    vertical-align: middle;
}

.navbar-brand span {
    display: inline-flex;
    align-items: baseline;
    position: relative;
    line-height: 1;
}

/* Scrollbar - exclude history page */
.image-grid-container:not(#history-grid-container)::-webkit-scrollbar {
    width: 8px;
}

.image-grid-container:not(#history-grid-container)::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.image-grid-container:not(#history-grid-container)::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 4px;
}

.image-grid-container:not(#history-grid-container)::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.7);
}

/* History page scrollbar - modern grey style */
#history-grid-wrapper::-webkit-scrollbar {
    width: 16px !important;
    height: 16px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

#history-grid-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3) !important;
    border-radius: 4px !important;
    -webkit-border-radius: 4px !important;
}

#history-grid-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3) !important;
    border-radius: 4px !important;
    -webkit-border-radius: 4px !important;
}

#history-grid-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5) !important;
}

#history-grid-wrapper {
    scrollbar-width: auto !important;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.3) !important;
}

/* Responsive */
@media (max-width: 768px) {
    .image-grid-container {
        grid-template-columns: 1fr;
    }

    .render-actions {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .render-actions > div {
        flex-direction: column;
        width: 100%;
    }

    .btn-generate-all,
    .btn-download-all,
    .btn-clear-all,
    .btn-add-more {
        width: 100%;
    }

    .completion-banner {
        padding: 0.875rem 1rem;
        margin: 0.75rem 0;
    }

    .completion-banner-content {
        font-size: 14px;
        gap: 0.75rem;
    }

    .completion-banner-content i {
        font-size: 18px;
    }

    /* Hide "RenderCAD" text on small screens to prevent overlap with page title */
    .navbar-brand .brand-text {
        display: none;
    }
}

/* Shared card styles for both render studio and history */
.history-card {
    position: relative;
}

.history-date {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.25rem;
}

.history-deletion {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* History actions now shares styles with image-actions above */


/* Delete button uses EXACT same CSS as header buttons - no red styling */
.history-action-btn-danger {
    background: linear-gradient(-75deg, rgba(255,255,255,0.05), rgba(255,255,255,0.2), rgba(255,255,255,0.05)) !important;
    border-color: rgba(255,255,255,0.5) !important;
    color: white !important;
}

.history-action-btn-danger:hover:not(:disabled) {
    background: linear-gradient(-75deg, rgba(255,255,255,0.1), rgba(255,255,255,0.3), rgba(255,255,255,0.1)) !important;
    border-color: rgba(255,255,255,0.5) !important;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05),
                inset 0 -1px 1px rgba(255, 255, 255, 0.5),
                0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

