@import url('https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Instrument+Serif:ital@0;1&display=swap');

/* HTMX Indicators */
.htmx-indicator {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.htmx-request .htmx-indicator {
    display: inline;
    opacity: 1;
}

.htmx-request.htmx-indicator {
    display: inline;
    opacity: 1;
}

/* Processing Overlay */
.processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(4px);
    z-index: 10;
    animation: fadeInOverlay 0.3s ease;
}

/* Form Generation Overlay */
.form-generation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(2px);
    z-index: 50;
    animation: fadeInOverlay 0.3s ease;
}

.form-generation-overlay.active {
    display: flex;
}

.form-generation-content {
    text-align: center;
    color: #374151;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.form-generation-content .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(55, 65, 81, 0.2);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.processing-content {
    text-align: center;
    color: white;
}

.processing-icon {
    margin-bottom: 16px;
}

.processing-text h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.processing-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.8;
}

/* Spinner animation */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* Image pulse animation during processing */
.processing-pulse {
    animation: processingPulse 2s ease-in-out infinite;
}

/* Animations */
@keyframes fadeInOverlay {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes processingPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.02);
    }
}

.btn:active, button:active {
    
    transform: translateY(1px);
}



/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}


/* Page Transition Animations */
@keyframes pageTransitionOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes pageTransitionIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.dark .page-transition-overlay {
    background: rgba(33, 33, 33, 0.9);
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

body.page-transitioning {
    overflow: hidden;
}

/* Page fade in on load */
body {
    animation: pageTransitionIn 0.2s ease;
}
* {
    margin: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: Geist, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #FFFFFF;
    color: #0A0A0A;
    line-height: 1.5;
    font-size: 1rem;
    max-width: 1600px;
    margin: 0 auto;
}
.dark body {
    background: #0A0A0A;
    color: #EFEFEF;
}

.container {
    margin: 0 auto;
    margin-left: 80px; /* Account for narrow sidebar */
    max-width: calc(100% - 80px); /* Use remaining width after sidebar */
    width: 100%;
    transition: all 0.3s ease;
    box-sizing: border-box;
    padding: 1rem;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

.w-full {
    width: 100%;
}
.flex {
    display: flex;
}



        
        .form-group small {
            color: #6b7280;
            font-size: 0.85rem;
            margin-top: 0.25rem;
            display: block;
        }
        
        
        
        
        .create-preset-btn,
        .create-model-btn {
            width: 100%;
            padding: 0.875rem 1rem;
            background: #10b981;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 0.875rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .create-preset-btn:hover,
        .create-model-btn:hover {
            background: #059669;
            transform: translateY(-1px);
        }
        
        /* Modal Styling */
        .modal-content {
            background: #ffffff;
            margin: 5% auto;
            padding: 2rem;
            border-radius: 12px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            max-width: 600px;
            max-height: 90vh;
            overflow-y: auto;
        }
        
        .modal-content h3 {
            font-size: 1.5rem;
            font-weight: 600;
            margin-bottom: 1.5rem;
        }

        .dark .modal-content  {
            background: #0A0A0A;
        }
        
        /* Range Slider Styling */
        .slider {
            width: 100%;
            height: 8px;
            border-radius: 4px;
            background: #e5e7eb;
            outline: none;
            -webkit-appearance: none;
            appearance: none;
        }
        
        .slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #4f46e5;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
        }
        
        .slider::-moz-range-thumb {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: #4f46e5;
            cursor: pointer;
            border: none;
            box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
        }
        
        .slider-container {
            position: relative;
            margin-bottom: 0.5rem;
        }
        
        .slider-value {
            position: absolute;
            top: -2rem;
            right: 0;
            background: #4f46e5;
            color: white;
            padding: 0.25rem 0.5rem;
            border-radius: 4px;
            font-size: 0.875rem;
            font-weight: 500;
        }
        
        .slider-labels {
            display: flex;
            justify-content: space-between;
            font-size: 0.875rem;
            margin-top: 0.5rem;
        }
        
        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 20px;
            padding: 20px 0;
        }
        
        .gallery-item {
            border-radius: 12px;
            overflow: hidden;
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            aspect-ratio: 1 / 1;
            border: 1px solid #E5E5E5;
        }
        .dark .gallery-item {
            border-color: #333333;
        }
        
        .gallery-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }
        
        .gallery-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        
        .processing-placeholder {
            width: 100%;
            min-height: 200px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: transparent;
            background-size: 400% 400%;
            animation: shimmer 2s ease-in-out infinite;
            color: #ffffff;
            border-radius: 8px;
            position: relative;
            aspect-ratio: 1 / 1;
            overflow: hidden;
        }
        .failed-placeholder {
            width: 100%;
            min-height: 200px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            background: #fff;
            background-size: 400% 400%;
            color: #6b7280;
            border-radius: 8px;
            position: relative;
            aspect-ratio: 1 / 1;
            overflow: hidden;
        }
        
        .processing-placeholder::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255, 255, 255, 0.3);
            animation: pulse 1.5s ease-in-out infinite;
        }
        
        @keyframes shimmer {
            0% { background-position: 0% 0%; }
            50% { background-position: 100% 100%; }
            100% { background-position: 0% 0%; }
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 0.4; }
            50% { opacity: 0.8; }
        }
        
        .processing-placeholder .loading-spinner {
            margin-bottom: 1rem;
            width: 40px;
            height: 40px;
            border: 4px solid rgba(255, 255, 255, 0.3);
            border-top: 4px solid #667eea;
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
            z-index: 1;
        }
        
        .processing-placeholder p {
            margin: 0;
            font-weight: 500;
            text-align: center;
        }
        
        .failed-placeholder .failed-icon {
            font-size: 2rem;
            margin-bottom: 0.5rem;
        }
        
        .gallery-item-info {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
            color: white;
            padding: 20px 15px 15px;
            transform: translateY(100%);
            transition: transform 0.3s ease;
        }
        
        .gallery-item:hover .gallery-item-info {
            transform: translateY(0);
        }
        
        .gallery-item-description {
            font-weight: 600;
            color: white;
            line-height: 1.4;
            font-size: 0.95rem;
            text-transform: capitalize;
        }
        
        .gallery-item-date {
            font-size: 0.8rem;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 4px;
        }
        
        .gallery-item-actions {
            display: flex;
            gap: 8px;
        }
        
        .gallery-item-status {
            text-align: center;
            padding: 8px 0;
            color: rgba(255, 255, 255, 0.9);
        }
        
        .gallery-item-overlay {
            position: absolute;
            top: 12px;
            right: 12px;
            display: flex;
            gap: 8px;
            opacity: 0;
            transform: translateY(-10px);
            transition: all 0.3s ease;
        }
        
        .gallery-item:hover .gallery-item-overlay {
            opacity: 1;
            transform: translateY(0);
        }
        
        .gallery-item-overlay .btn {
            padding: 6px 12px;
            font-size: 0.8rem;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            border: none;
            border-radius: 20px;
            font-weight: 500;
            transition: all 0.2s ease;
            backdrop-filter: blur(10px);
        }
        
        .gallery-item-overlay .btn:hover {
            background: rgba(0, 0, 0, 0.9);
            transform: scale(1.05);
        }
        
        
        /* Selected Options Display */
        .selected-options-container {
            background: rgba(59, 130, 246, 0.05);
            border: 1px solid rgba(59, 130, 246, 0.2);
            border-radius: 12px;
            padding: 16px;
        }
        
        .selected-options-title {
            font-size: 0.9rem;
            font-weight: 600;
            color: #374151;
            margin: 0 0 12px 0;
        }
        
        .dark .selected-options-title {
            color: #d1d5db;
        }
        
        .selected-options-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        
        .badge {
            display: inline-flex;
            align-items: center;
            padding: 4px 10px;
            background: rgba(59, 130, 246, 0.1);
            color: #1e40af;
            border: 1px solid rgba(59, 130, 246, 0.3);
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 500;
            white-space: nowrap;
        }
        
        .dark .badge {
            background: rgba(59, 130, 246, 0.2);
            color: #60a5fa;
            border-color: rgba(59, 130, 246, 0.4);
        }
        
        .badge-preset {
            background: rgba(16, 185, 129, 0.1);
            color: #059669;
            border-color: rgba(16, 185, 129, 0.3);
        }
        
        .dark .badge-preset {
            background: rgba(16, 185, 129, 0.2);
            color: #34d399;
            border-color: rgba(16, 185, 129, 0.4);
        }
        
        .badge-model {
            background: rgba(245, 158, 11, 0.1);
            color: #d97706;
            border-color: rgba(245, 158, 11, 0.3);
        }
        
        .dark .badge-model {
            background: rgba(245, 158, 11, 0.2);
            color: #fbbf24;
            border-color: rgba(245, 158, 11, 0.4);
        }

        .pagination {
            margin-top: 40px;
            padding-bottom: 20px;
        }
        
        .pagination .disabled {
            cursor: not-allowed;
        }
        
        .empty-gallery {
            text-align: center;
            grid-column: 1 / -1;
        }
        
        .empty-gallery-image {
            position: relative;
            display: block;
            margin: 0 auto 20px auto;
        }
        
        .empty-gallery-image img {
            display: block;
            max-width: 100%;
            height: auto;
        }
        
        .empty-gallery-image::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 30%;
            background: linear-gradient(to bottom, rgba(255, 255, 255, 1), transparent);
            pointer-events: none;
        }
        .dark .empty-gallery-image::after {
            background: linear-gradient(to bottom, rgba(0, 0, 0, 1), transparent);
        }
        
        .empty-gallery h3 {
            margin-bottom: 10px;
        }
        
        .flash-complete {
            animation: flashComplete 1.5s ease-out;
        }
        
        @keyframes flashComplete {
            0% {
                background-color: #dcfce7;
                transform: scale(1.02);
            }
            50% {
                background-color: #bbf7d0;
                transform: scale(1.02);
            }
            100% {
                background-color: transparent;
                transform: scale(1);
            }
        }
        
        
        @media (max-width: 768px) {
            .gallery-grid {
                grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
                gap: 15px;
            }
            
            .gallery-item-actions {
                flex-direction: column;
            }
            
            .gallery-item-actions .btn {
                flex: none;
            }
            
            .gallery-item-overlay {
                top: 8px;
                right: 8px;
            }
        }



/* Adjust body for sidebar - only on mobile */
@media (max-width: 768px) {
    body.sidebar-active {
        overflow: hidden;
    }
}

/* Sidebar Layout */
.sidebar2 {
    position: fixed;
    left: 0;
    top: 0;
    width: 70px;
    height: 100vh;
    background: #FAFAFA;
    border: 1px solid #E5E5E5;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
}
.dark .sidebar2  {
    background: #292929;
    border: 1px solid #383838;
}

.sidebar-logo {
    padding: 1.5rem 0;
    display: flex;
    justify-content: center;
}

.sidebar-logo .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000000;
    text-decoration: none;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
}
.dark .sidebar-logo .logo  {
    color: #ffffff;
}

.logo-icon {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(0);
}
.dark .logo-icon  {
    filter: brightness(0) invert(1);
}

.site-icon {
    width: 40px;
    height: 40px;
}
.site-icon-bg {
    fill: #000;
}
.site-icon-fg {
    fill: #fff;
}



/* Hide text labels on desktop */
.logo-text,
.sidebar-text {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 0;
    margin: 0.25rem 0;
    color: #000000;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    border-left: 3px solid transparent;
    position: relative;
}
.dark .sidebar-link  {
    color: #ffffff;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #000;
    border-left-color: #000;
}
.dark .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #ffffff;
    border-left-color: #fff;
}

.sidebar-link.active {
    background: rgba(45, 52, 64, 0.08);
    color: #000;
    border-left-color: #000;
    font-weight: 600;
}

.dark .sidebar-link.active {
    background: rgba(45, 52, 64, 0.08);
    color: #fff;
    border-left-color: #fff;
    font-weight: 600;
}

.sidebar-user {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    width: 50px;
    height: 50px;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.7);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #EFEFEF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #2d3440;
    font-size: 0.875rem;
    position: relative;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-chevron {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 2px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-avatar:hover .user-avatar-chevron {
    opacity: 1;
    transform: scale(1);
}

.user-details {
    display: none;
}

.username {
    font-weight: 600;
    color: #2d3440;
    font-size: 0.875rem;
}

.credits-count {
    font-size: 0.75rem;
    color: #6b7684;
    font-weight: 500;
}

.user-menu-arrow {
    display: none;
}

.user-menu-arrow.arrow-down {
    transform: rotate(180deg);
}

/* Mobile header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}

.mobile-logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.mobile-logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3440;
}

/* Dark mode styles for mobile header */
html.dark .mobile-header {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid #383838;
}

html.dark .mobile-logo-text {
    color: #e5e9f0;
}

html.dark .mobile-menu-toggle span {
    background: #e5e9f0;
}

/* Mobile burger menu */
.mobile-menu-toggle {
    display: flex;
    position: relative;
    top: auto;
    left: auto;
    z-index: auto;
    background: transparent;
    backdrop-filter: none;
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: #2d3440;
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle.menu-open span:nth-child(1) {
    transform: rotate(45deg) translateY(6px);
}

.mobile-menu-toggle.menu-open span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.menu-open span:nth-child(3) {
    transform: rotate(-45deg) translateY(-6px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 70px; /* Start after desktop sidebar width */
    width: calc(100vw - 70px); /* Only cover area not covered by sidebar */
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.overlay-active {
    opacity: 1;
}

/* Mobile responsive sidebar */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .sidebar2 {
        transform: translateX(-100%);
        width: 250px;
        top: 60px; /* Account for mobile header height */
        height: calc(100vh - 60px);
    }
    
    .sidebar2.sidebar-open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        top: 60px; /* Account for mobile header height */
        height: calc(100vh - 60px);
        left: 250px; /* Start after the sidebar width */
        width: calc(100vw - 250px); /* Only cover the remaining area */
    }
    
    .sidebar-overlay.overlay-active {
        display: block;
        opacity: 1;
    }
    
    .container {
        margin-left: 0;
        max-width: 100%;
        width: 100%;
        padding-top: 5rem; /* Account for mobile header */
    }
    
    body.sidebar-active .container {
        margin-left: 0;
    }

    /* Show text labels on mobile */
    .logo-text,
    .sidebar-text {
        display: block;
        margin-left: 0.75rem;
    }

    .sidebar-logo {
        padding: 2rem 1.5rem 1.5rem;
        justify-content: flex-start;
        display: none;
    }

    .sidebar-logo .logo {
        flex-direction: row;
        justify-content: flex-start;
    }

    .sidebar-link {
        justify-content: flex-start;
        padding: 0.875rem 1.5rem;
    }

    .sidebar-user {
        padding: 1.5rem;
        align-items: stretch;
    }

    .user-info {
        width: auto;
        height: auto;
        border-radius: 12px;
        padding: 0.75rem;
        justify-content: flex-start;
    }

    .user-details {
        display: flex;
        flex-direction: column;
        flex: 1;
        margin-left: 0.75rem;
    }

    .user-details .username {
        font-weight: 600;
        color: #2d3440;
        font-size: 0.875rem;
    }

    .user-details .credits-count {
        font-size: 0.75rem;
        color: #6b7684;
        font-weight: 500;
    }

    .user-menu-arrow {
        display: block;
        margin-left: 0.5rem;
        font-size: 0.75rem;
        color: #6b7684;
        transition: transform 0.3s ease;
    }

    .user-details-mobile {
        display: block;
    }

    /* Hide tooltips on mobile */
    .tooltip {
        display: none;
    }
}

/* Tooltip styles for desktop */
.tooltip {
    position: fixed;
    background: #1a1a1a;
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1002;
    pointer-events: none;
    max-width: 250px;
    word-wrap: break-word;
    white-space: normal;
}

.tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -6px;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1a1a1a;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

/* Desktop sidebar behavior */
@media (min-width: 769px) {
    .mobile-header {
        display: none;
    }
    
    .sidebar2 {
        transform: translateX(0);
        top: 0;
        height: calc(100vh - 20px);
        border-radius: 20px;
        margin: 10px 0 10px 12px;
    }
    
    .mobile-menu-toggle {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }

    /* Desktop hover effects */
    .sidebar-link:hover,
    .logo:hover,
    .user-info:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .logo:hover {
        border-radius: 8px;
    }

    .user-info:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}



.cardContainer {
    max-width: 1200px;
    margin-bottom: 2rem;
    margin: 0 auto 0 auto;
}

/* Removed hover effects from main cards for cleaner experience */

.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    width: 100%;
    align-items: stretch;
}

.form-col {
    flex: 1;
    width: 50%;
    display: flex;
    flex-direction: column;
}

.form-row .upload-area {
    padding: 1.5rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
}

.form-row .upload-area .upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.form-row .upload-area .upload-text {
    font-size: 0.9rem;
}
.upload-area svg {
    margin: 0 auto;
}




.upload-area {
    display: block;
    border: 2px dashed #383838;
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.upload-area:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-area.has-image {
    padding: 0;
    border: 2px solid #d1d5db;
}

.upload-area.has-image:hover {
    border-color: #4f46e5;
}

label.upload-area {
    margin: 0;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-text {
    font-size: 1.1rem;
}

.upload-preview {
    position: relative;
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(79, 70, 229, 0.8);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 6px;
}

.upload-area:hover .upload-overlay {
    opacity: 1;
}

.upload-overlay-text {
    font-size: 1rem;
    font-weight: 500;
    margin-top: 0.5rem;
}



/* New main grid layout */
.main-grid {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: auto;
    height: auto;
    overflow: visible;
}

.main-grid::after {
    content: "";
    display: table;
    clear: both;
}

.form-section {
    width: 500px;
    float: left;
    animation: fadeInUp 0.6s ease-out 0.1s both;
    height: auto;
    min-height: 0;
    overflow: visible;
    margin-right: 1rem;
}

.recent-section {
    display: block;
    animation: fadeInUp 0.6s ease-out 0.2s both;
    height: auto;
    min-height: 0;
    /* Use overflow hidden to create new block formatting context */
    overflow: hidden;
}

/* Ensure desktop layout above mobile breakpoint */
@media (min-width: 769px) {
    .main-grid {
        display: block;
    }
    .form-section {
        width: 500px;
        float: left;
        margin-right: 1rem;
    }
    .recent-section {
        overflow: hidden;
    }
}

.credits-display {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    color: #2d3440;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.credits-display:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #2d3440;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.show {
    display: block;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes flashGreen {
    0% { background-color: transparent; }
    50% { background-color: rgba(16, 185, 129, 0.3); }
    100% { background-color: transparent; }
}

.flash-complete {
    animation: flashGreen 1.5s ease-in-out;
    border-radius: 8px;
}

/* Preset Selection Styles */

.preset-category {
    border-bottom: 1px solid #383838;
}

.preset-category:last-child {
    border-bottom: none;
    padding-bottom: 40px;
}

.category-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.category-header:hover {
    background: transparent;
}

.category-toggle {
    transition: transform 0.2s;
}

.category-toggle.collapsed {
    transform: rotate(-90deg);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 1rem 0rem;
}

@media (max-width: 768px) {
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.preset-item {
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preset-image-wrapper {
    border-radius: 12px;
    padding: 0;
    transition: all 0.3s ease;
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.preset-item:hover .preset-image-wrapper {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.9);
}

.preset-item.selected .preset-image-wrapper {
    border: 2px solid #EFEFEF;
}


.preset-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 11px;
    display: block;
}

.preset-name {
    font-size: 0.775rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

.preset-search {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.preset-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 1);
}

.create-preset-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s;
}

.create-preset-btn:hover {
    background: #059669;
}

/* Model Selection Styles */
.model-search {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

.model-search:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.model-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    margin-bottom: 1rem;
}

.model-category {
    margin-bottom: 0;
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 1rem;
}

@media (max-width: 768px) {
    .model-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .model-grid {
        grid-template-columns: 1fr;
    }
}

.model-item {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.model-item:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.9);
}

.model-item.selected {
    border-color: rgba(45, 52, 64, 0.4);
    background: rgba(45, 52, 64, 0.08);
    box-shadow: 0 4px 16px rgba(45, 52, 64, 0.15);
}

.model-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.model-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
}

.model-details {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.3;
}

.model-favorite-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
}

.model-item:hover .model-favorite-btn {
    opacity: 1;
}

.model-favorite-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.model-favorite-btn.favorited {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.model-favorite-btn.favorited:hover {
    background: rgba(239, 68, 68, 0.2);
}

.model-delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    color: #ef4444;
}

.model-item:hover .model-delete-btn {
    opacity: 1;
}

.model-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.create-model-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.create-model-btn:hover {
    background: #059669;
}

.user-preset-badge {
    position: absolute;
    top: 8px;
    right: 40px;
    background: rgba(16, 185, 129, 0.9);
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 15;
}

.preset-item:hover .user-preset-badge {
    opacity: 1;
    transform: translateY(0);
}

.preset-favorite-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.875rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    color: #000000;
}

.preset-item:hover .preset-favorite-btn {
    opacity: 1;
}

.preset-favorite-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.preset-favorite-btn.favorited {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.preset-favorite-btn.favorited:hover {
    background: rgba(239, 68, 68, 0.2);
}

.preset-delete-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    color: #ef4444;
}

.preset-item:hover .preset-delete-btn {
    opacity: 1;
}

.preset-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Browser Modal Preset Styles */
.preset-item-browser {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.preset-image-wrapper-browser {
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
    border-radius: 12px;
    overflow: hidden;
}

.preset-title-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 2rem;
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    text-align: center;
    line-height: 1.3;
    border-radius: 8px;
    border: 1px solid rgb(255 255 255 / 0.2);
    white-space: nowrap;
}

.preset-item-browser:hover {
    transform: translateY(-2px);
}

.preset-item-browser:hover .preset-image-wrapper-browser {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.preset-item-browser:hover .preset-favorite-btn {
    opacity: 1;
}

.preset-item-browser .preset-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px;
    cursor: pointer;
    font-size: 12px;
    z-index: 20;
    opacity: 0;
    transition: all 0.3s ease;
}

.preset-item-browser:hover .preset-delete-btn {
    opacity: 1;
}

.preset-item-browser .preset-delete-btn:hover {
    background: rgba(220, 53, 69, 1);
    transform: scale(1.1);
}

.preset-use-btn {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.preset-item-browser:hover .preset-use-btn {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Folder Background Gradients */
.folder-background {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.preset-item-browser:nth-child(1) .folder-background { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.preset-item-browser:nth-child(2) .folder-background { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.preset-item-browser:nth-child(3) .folder-background { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.preset-item-browser:nth-child(4) .folder-background { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.preset-item-browser:nth-child(5) .folder-background { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }

.folder-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
    z-index: 1;
}

.folder-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.folder-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1.2;
}

.preset-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #666;
}

/* Smooth transitions for preset browser */
#presetBrowserGrid {
    transition: opacity 0.2s ease-out;
}

#presetBrowserGrid.fade-transition {
    opacity: 0.3;
}

.preset-view-transition {
    animation: fadeInUp 0.2s ease-out;
}

/* Model Browser Styles */
.model-browser-card {
    position: relative;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 120px;
    overflow: visible;
}

.model-browser-card:hover {
    background: #252525;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.model-placeholder-browser {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.model-name-browser {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.model-details-browser {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.model-attributes-browser {
    font-size: 0.8rem;
    color: #aaa;
    font-style: italic;
    line-height: 1.3;
    margin-top: 0.25rem;
}

.model-favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
}

.model-browser-card:hover .model-favorite-btn {
    opacity: 1;
}

.model-favorite-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.model-favorite-btn svg {
    width: 14px;
    height: 14px;
    color: #666;
}

.model-delete-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
}

.model-browser-card:hover .model-delete-btn {
    opacity: 1;
}

.model-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.model-delete-btn svg {
    width: 14px;
    height: 14px;
    color: #ef4444;
}

.model-item-browser {
    position: relative;
}

/* Preset Category Folders */
.preset-category-folder {
    position: relative;
    aspect-ratio: 2 / 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 1rem;
    min-height: 120px;
}

.preset-category-folder:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.preset-category-folder:nth-child(1) { background: linear-gradient( 109.6deg,  rgba(217,67,67,1) 11.2%, rgba(242,106,75,1) 100.6% ); }
.preset-category-folder:nth-child(2) { background: linear-gradient( 109.6deg,  rgba(61,131,97,1) 11.2%, rgba(28,103,88,1) 91.1% ); }
.preset-category-folder:nth-child(3) { background: linear-gradient( 109.9deg,  rgba(251,189,100,1) 1.8%, rgba(255,207,139,1) 95.4% ); }
.preset-category-folder:nth-child(4) { background: linear-gradient( 111.4deg,  rgba(122,192,233,1) 18.8%, rgba(4,161,255,1) 100.2% ); }
.preset-category-folder:nth-child(5) { background: linear-gradient( 179deg,  rgba(255,196,2,1) 9.6%, rgba(243,207,77,1) 50.1% ); }

.folder-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.folder-name {
    font-family: 'Instrument Serif', serif;
    margin-bottom: 0.25rem;
    font-weight: 400;
    font-size: 2rem;
}

.folder-count {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Grid layouts */
.grid-3-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.grid-4-cols {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .grid-3-cols {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-4-cols {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .grid-3-cols {
        grid-template-columns: 1fr;
    }
    .grid-4-cols {
        grid-template-columns: 1fr;
    }
}

/* Preset item actions */
.preset-item-actions {
    padding: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
    position: absolute;
    bottom: 0;
    width: 100%;
}

.preset-item-browser:hover .preset-item-actions {
    opacity: 1;
}

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

.breadcrumb-link {
    cursor: pointer;
    color: #007bff;
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    cursor: pointer;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.back-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.back-btn svg {
    flex-shrink: 0;
}

.hidden {
    display: none;
}

/* Aspect Ratio Button Group */
.aspect-ratio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.aspect-ratio-option {
    position: relative;
}

.aspect-ratio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.aspect-ratio-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    border: 1px solid #3A3A3A;
    border-radius: 16px;
    background: #151515;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 80px;
    justify-content: center;
}

.aspect-ratio-button:hover {
    border-color: #EFEFEF;
}

.aspect-ratio-option input[type="radio"]:checked + .aspect-ratio-button {
    border-color: #EFEFEF;
}

.aspect-ratio-icon {
    font-size: 1.5rem;
    max-width: 50px;
    margin: 0 auto; 
    color: #EFEFEF;
}

.aspect-ratio-option input[type="radio"]:checked + .aspect-ratio-button .aspect-ratio-icon {
    color: #2d3440;
}

.aspect-ratio-label {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
}

.aspect-ratio-option input[type="radio"]:checked + .aspect-ratio-button .aspect-ratio-label {
    color: #EFEFEF;
    font-weight: 600;
}
#aspect-ratio-listbox svg {
    margin-right: 5px;
}
#aspect-ratio-trigger svg {
    margin-right: 5px;
}

/* Loading spinner styles */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .aspect-ratio-group {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .aspect-ratio-button {
        padding: 0.75rem 0.25rem;
        min-height: 70px;
    }
    
    .aspect-ratio-icon {
        font-size: 1.25rem;
    }
    
    .aspect-ratio-label {
        font-size: 0.75rem;
    }
}

.generated-image img {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #10b981;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s;
}

.download-btn:hover {
    background: #059669;
}

@media (max-width: 768px) {
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile layout: form → recent stacked */
    .main-grid {
        display: block !important;
    }
    .form-section {
        width: 100% !important;
        float: none !important;
        margin-right: 0 !important;
    }
    .recent-section {
        margin-left: 0 !important;
        width: 100% !important;
        overflow: visible !important;
    }
}

/* Tooltip Styles */
.tooltip-icon {
    position: relative;
    display: inline-block;
    cursor: help;
    vertical-align: middle;
}

.tooltip-icon svg {
    transition: fill 0.2s ease;
}

.tooltip-icon:hover svg {
    fill: #6b7280;
}

.tooltip-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 200px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tooltip-icon::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
}

.tooltip-icon:hover::after,
.tooltip-icon:hover::before {
    opacity: 1;
    visibility: visible;
}
.help-icon {
    position: relative;
    display: inline-block;
    cursor: pointer;
    vertical-align: middle;
}

.help-icon svg {
    transition: fill 0.2s ease;
}

.help-icon:hover svg {
    fill: #6b7280;
}

/* Responsive tooltip adjustments */
@media (max-width: 768px) {
    .tooltip-icon::after {
        width: 180px;
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
    }
}

/* News page styles */
.news-list {
    margin-top: 2rem;
}

.news-item {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.news-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.news-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #0A0A0A;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.news-date {
    color: #6B7280;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.news-content {
    color: #374151;
    line-height: 1.6;
    font-size: 1rem;
}

.news-content p {
    margin-bottom: 1rem;
}

.news-content p:last-child {
    margin-bottom: 0;
}

/* Dark mode styles for news */
.dark .news-item {
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.3);
}

.dark .news-title {
    color: #F9FAFB;
}

.dark .news-date {
    color: #9CA3AF;
}

.dark .news-content {
    color: #D1D5DB;
}


/* Floating Edit Bar Styles */
        .floating-edit-bar {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.7);
            backdrop-filter: blur(12px);
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.8);
            padding: 16px 20px;
            max-width: 600px;
            width: 90%;
            z-index: 1000;
        }
        .dark .floating-edit-bar {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(64, 64, 64, 0.7);
            backdrop-filter: blur(12px);
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(96, 96, 96, 0.8);
            padding: 16px 20px;
            max-width: 600px;
            width: 90%;
            z-index: 1000;
        }
        .floating-edit-bar input {
            background: #fff;
        }
        .dark .floating-edit-bar input {
            background: #212121;
        }
        .floating-form-content {
            display: flex;
            gap: 12px;
            align-items: flex-start;
        }

        .floating-cost {
            text-align: center;
            margin: 8px 0 0 0;
            font-size: 12px;
            font-weight: 500;
        }

        .floating-save-controls {
            position: absolute;
            top: -50px;
        }

        /* Floating Tools Bar for view.php */
        .floating-tools-bar {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(255, 255, 255, 0.7);
            backdrop-filter: blur(12px);
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.8);
            padding: 12px 20px;
            max-width: 800px;
            width: 90%;
            z-index: 1000;
        }

        .dark .floating-tools-bar {
            background: rgba(64, 64, 64, 0.7);
            border: 1px solid rgba(96, 96, 96, 0.8);
        }

        .floating-tools-content {
            display: flex;
            gap: 10px;
            align-items: center;
            justify-content: center;
            flex-wrap: wrap;
        }

        .floating-tools-content .floating-btn-outline {
            padding: 8px 12px;
            font-size: 14px;
            white-space: nowrap;
            display: flex;
            align-items: center;
            gap: 6px;
            border-radius: 8px;
            min-height: 36px;
        }

        .floating-tools-content .floating-btn-outline svg {
            flex-shrink: 0;
        }

 /* Responsive adjustments */
        @media (max-width: 768px) {
            .floating-edit-bar {
                bottom: 10px;
                width: 95%;
                padding: 12px 16px;
            }

            .floating-form-content {
                flex-direction: column;
                gap: 8px;
            }

            .floating-input {
                width: 100%;
            }

            .floating-btn,
            .floating-btn-outline {
                width: 100%;
                justify-content: center;
            }

            /* Mobile responsive for floating tools bar */
            .floating-tools-bar {
                bottom: 10px;
                width: 95%;
                padding: 10px 12px;
            }

            .floating-tools-content {
                gap: 6px;
                flex-direction: row;
                justify-content: center;
                flex-wrap: wrap;
            }

            .floating-tools-content .floating-btn-outline {
                padding: 8px 6px;
                font-size: 11px;
                min-height: 50px;
                gap: 2px;
                flex-direction: column;
                text-align: center;
                line-height: 1.2;
                justify-content: center;
                flex: 1;
                max-width: 80px;
            }

            .floating-tools-content .floating-btn-outline span {
                display: block;
                font-size: 10px;
                margin-top: 2px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
        }

/* Radio Card Styling */
.radio-card {
    position: relative;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.dark .radio-card {
    border-color: #434343;
}


.radio-card:hover {
    border-color: #E5E5E5;
    background-color: #FAFAFA;
}
.dark .radio-card:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.1);
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card input[type="radio"]:checked ~ .radio-content,
.radio-card:has(input[type="radio"]:checked) {
    border-color: #00A63E;
    background-color: #EFFDF4;
}
.dark .radio-card input[type="radio"]:checked ~ .radio-content, .dark
.radio-card:has(input[type="radio"]:checked) {
    border-color: #0F532B;
    background-color: #032E16;
}

.radio-content {
    text-align: center;
}

.radio-card .f5 {
    margin-bottom: 4px;
}

.radio-card .f6 {
    font-size: 0.875rem;
    color: #A1A1A1;
}

.gap-3 {
    gap: 12px;
}

/* Disabled checkbox styling */
.label:has(input[type="checkbox"]:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

/* HTMX Generation Status Styles */
.generating-status {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.status-icon {
    font-size: 2rem;
    margin-right: 1rem;
    animation: bounce 2s infinite;
}

.status-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.status-text p {
    margin: 0 0 1rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    border-radius: 4px;
    animation: progress-animate 2s ease-in-out infinite;
}

.generation-complete {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #bbf7d0;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.success-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.generation-complete h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #059669;
}

.generated-image img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.image-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

@keyframes progress-animate {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Gallery Item Generating State */
.generating-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    backdrop-filter: blur(50px);
}

.generating-placeholder .loading-spinner {
    margin-bottom: 0.5rem;
}

.generating-placeholder p {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
}
.gen-placeholder {
    animation: skeleton-pulse 2s ease-in-out infinite;
}
@keyframes skeleton-pulse {
            0%, 100% {
                opacity: 0.4;
                transform: rotate(-10deg);
            }
            50% {
                opacity: 0.6;
                transform: rotate(10deg);
            }
        }

/* Error Container Styling */
.error-container {
    margin-bottom: 1rem;
}

.alert {
    margin-bottom: 10px;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-error p {
    margin: 0;
}

.alert-error .btn {
    margin-top: 0.5rem;
}

/* Enhanced Modal Styling */
.modal-info {
    padding: 1rem;
    max-width: 500px;
}

.modal-info h3 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-meta {
    margin-bottom: 1rem;
}

.modal-meta p {
    margin: 0.5rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.modal-meta strong {
    color: #374151;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: fit-content;
}

/* IDEA PAGE */

.idea-img-container {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.idea-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* from index */

.crop-wrapper {
        user-select: none;
    }
    
    .crop-container {
        position: relative;
        overflow: hidden;
    }
    
    .crop-handle {
        border-radius: 50%;
        border: 1px solid #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    
    .aspect-ratio-btn.active,
    .orientation-btn.active {
        background: var(--color-primary);
        color: white;
    }
    
    #scale-slider {
        -webkit-appearance: none;
        appearance: none;
        height: 4px;
        border-radius: 2px;
        background: #ddd;
        outline: none;
    }
    
    #scale-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--color-primary);
        cursor: pointer;
    }
    
    #scale-slider::-moz-range-thumb {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--color-primary);
        cursor: pointer;
        border: none;
    }
    
    /* Mobile Responsive Styles */
    @media (max-width: 768px) {
        .crop-wrapper {
            max-width: calc(100vw - 20px) !important;
        }
        
        .crop-container {
            height: min(400px, 60vh) !important;
        }
        
        #crop-modal article {
            max-width: calc(100vw - 20px);
            margin: 10px;
            max-height: calc(100vh - 40px);
            overflow-y: auto;
        }
        
        .crop-info {
            font-size: 0.85rem;
        }
    }
    
    @media (max-width: 480px) {
        .crop-wrapper {
            max-width: calc(100vw - 10px) !important;
        }
        
        .crop-container {
            height: min(300px, 50vh) !important;
        }
        
        #crop-modal article {
            max-width: calc(100vw - 10px);
            margin: 5px;
            padding: 15px;
        }
        
        .crop-controls {
            flex-direction: column;
            gap: 10px;
        }
        
        .crop-controls button {
            width: 100%;
            padding: 12px;
        }
    }
    
    /* Product selector styles */
    .product-selector-divider {
        text-align: center;
        margin: 1rem 0;
        position: relative;
        color: #6c757d;
        font-size: 0.9rem;
    }
    
    .product-selector-divider::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 1px;
        background: #dee2e6;
        z-index: 1;
    }
    
    .product-selector-divider span {
        background: white;
        padding: 0 1rem;
        position: relative;
        z-index: 2;
    }
    .dark .product-selector-divider span {
        background: #171717;
    }