/* --- DESIGN TOKENS --- */
:root {
    /* Colors */
    --primary-color: #F97316;
    --secondary-color: #FB923C;
    --accent-color: #FDBA74;
    --dark-color: #1F2937;
    --light-color: #F8FAFC;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
    --red-500: #EF4444;
    --red-600: #DC2626;

    /* Typography */
    --font-family-sans: 'Inter', sans-serif;

    /* Sizing & Spacing */
    --generate-button-height: 50px;
}

/* --- BASE & LAYOUT --- */
body {
    font-family: var(--font-family-sans);
    background-color: #FDFBF8;
    color: var(--gray-600);
}

.glass-effect {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gradient-text {
    background: linear-gradient(to right, var(--primary-color), #EA580C);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-gradient {
    background: radial-gradient(circle at 10% 20%, rgb(255, 207, 140) 0%, rgb(255, 143, 82) 90%);
}

/* --- COMPONENTS --- */
.nav-link {
    transition: color 0.3s ease, border-color 0.3s ease;
}
.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-button {
    position: relative;
    transition: all 0.3s ease;
}
.tab-button.active {
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
}
.tab-button:hover:not(.active) {
    color: var(--primary-color);
}

.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.flowchart-step {
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
    cursor: pointer;
}
.flowchart-step.active {
    background-color: #FEEBC8;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}
.flowchart-step:hover:not(.active) {
    background-color: rgba(254, 235, 200, 0.5);
    border-color: #FDBA74;
}

.image-placeholder {
    background-color: var(--light-color);
    border: 2px dashed var(--gray-200);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.image-placeholder.dragover {
    background-color: #FEF3C7;
    border-color: var(--primary-color);
}

/* Button Layout Fixes */
.button-group {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

/* Ensure buttons maintain their styling */
button:disabled,
select:disabled,
input:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    background-color: var(--gray-100);
}

button:not(:disabled):hover {
    transform: translateY(-1px);
}

/* Studio section specific styling */
#studio .space-y-6 > * + * {
    margin-top: 1.5rem;
}

#studio .right-column-spacing {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Reference image panel improvements */
#reference-image-panel-container {
    min-height: 300px;
    height: auto;
}

/* Button sizing consistency */
#analyze-image,
#generate-image {
    min-height: var(--generate-button-height);
    font-weight: 700;
}

#ai-import-btn,
#ai-remove-btn {
    min-height: 48px;
    font-weight: 600;
}

/* Tab content transitions */
.tab-content {
    opacity: 1;
    transition: opacity 0.3s ease;
}
.tab-content.hidden {
    display: none;
}

/* Workflow content transitions */
.workflow-content {
    opacity: 1;
    transition: opacity 0.3s ease;
}
.workflow-content.hidden {
    display: none;
}

/* Provider dropdown improvements */
#studio-provider-display {
    min-width: 200px;
}

/* Model selector improvements */
#analysis-model-selector,
#image-generation-model-selector {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#analysis-model-selector:focus,
#image-generation-model-selector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

/* Custom model container styling */
#analysis-custom-container,
#image-generation-custom-container {
    background-color: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.3s ease;
}

/* Loaders */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.small-loader {
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

/* --- ANIMATIONS --- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse-animation {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
.pulse-animation {
    animation: pulse-animation 2s infinite;
}

@keyframes slide-in-left {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.slide-in-left {
    animation: slide-in-left 0.5s ease-out forwards;
}

@keyframes slide-in-right {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.slide-in-right {
    animation: slide-in-right 0.5s ease-out forwards;
}

@keyframes fade-in-up {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.fade-in-up {
    animation: fade-in-up 0.5s ease-out forwards;
}

/* --- UTILITIES --- */
.provider-header .provider-arrow {
    transition: transform 0.3s ease;
}

#console-output::-webkit-scrollbar {
    width: 8px;
}
#console-output::-webkit-scrollbar-track {
    background: var(--gray-900);
}
#console-output::-webkit-scrollbar-thumb {
    background-color: var(--gray-600);
    border-radius: 4px;
}
#console-output::-webkit-scrollbar-thumb:hover {
    background-color: var(--gray-500);
}

/* Hidden file input styling */
#hidden-file-input {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
        width: 100%;
    }
    
    .button-group button {
        width: 100%;
        justify-content: center;
    }
    
    #studio .grid.lg\\:grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Feature icon styling */
.feature-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}