/**
 * Horde Scout - Premium Dark Theme Styles
 */

/* =============================================================================
   Custom Font Faces
   ============================================================================= */

@font-face {
    font-family: 'Crushyourenemies';
    src: url('../fonts/CrushyourenemiesExtrabold-5Y1v.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* =============================================================================
   CSS Custom Properties (Design Tokens)
   ============================================================================= */

:root {
    /* Colors - Midnight Gold Theme */
    --color-bg-primary: #050505;
    /* Deep Black */
    --color-bg-secondary: #1a1a1a;
    /* Dark Charcoal */
    --color-bg-tertiary: #262626;
    /* Lighter Charcoal */
    --color-bg-elevated: #333333;
    /* Elevated Grey */

    --color-border: #404040;
    --color-border-focus: #d4af37;

    --color-text-primary: #e5e5e5;
    --color-text-secondary: #a3a3a3;
    --color-text-muted: #737373;

    --color-accent-primary: #d4af37;
    /* Metallic Gold */
    --color-accent-secondary: #f59e0b;
    /* Amber Gold */
    --color-accent-success: #10b981;
    --color-accent-warning: #f59e0b;
    --color-accent-danger: #ef4444;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #d4af37 0%, #f59e0b 100%);
    --gradient-glow: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.2);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;
    --radius-xl: 12px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Typography */
    --font-family: 'Inter', sans-serif;
    --font-family-serif: 'Playfair Display', serif;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2.5rem;
}


/* =============================================================================
   Reset & Base Styles
   ============================================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    line-height: 1.5;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-serif);
    font-weight: 700;
}

a {
    color: var(--color-accent-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* =============================================================================
   App Layout
   ============================================================================= */

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    min-height: 100vh;
}

.app-header {
    position: relative;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-xl) var(--spacing-lg);
    background: transparent;
    border-radius: var(--radius-xl);
    border: none;
    overflow: hidden;
}

/* Animated glow effect behind the header */
.header-glow {
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(212, 175, 55, 0.2) 0%, transparent 30%);
    pointer-events: none;
    animation: headerPulse 8s ease-in-out infinite;
}

@keyframes headerPulse {

    0%,
    100% {
        opacity: 0.5;
        transform: translateX(-50%) scale(1);
    }

    50% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1.1);
    }
}

.header-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.logo-image {
    width: 192px;
    height: auto;
    filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.5));
    transition: transform var(--transition-normal), filter var(--transition-normal);
}

.logo:hover .logo-image {
    transform: scale(1.1) rotate(-5deg);
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.8));
}

.logo-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo h1 {
    font-family: 'Crushyourenemies', serif;
    font-size: clamp(1.75rem, 4vw, var(--font-size-2xl));
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    margin: 0;
    transition: filter var(--transition-normal);
}

.logo:hover h1 {
    filter: brightness(1.2);
}

.tagline {
    font-family: var(--font-family);
    font-size: clamp(0.65rem, 1.5vw, var(--font-size-sm));
    font-weight: 400;
    color: var(--color-text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: var(--spacing-xs);
    opacity: 0.8;
}

.form-section-title {
    font-family: var(--font-family-serif);
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--color-text-primary);
}


/* =============================================================================
   User Status Area
   ============================================================================= */

.user-status-container {
    position: static;
    transform: none;
    margin-top: var(--spacing-sm);
}

#user-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 50px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

#user-status:hover {
    border-color: rgba(212, 175, 55, 0.4);
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.15);
}

#user-username {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    padding-right: var(--spacing-sm);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

#user-settings-btn {
    padding: var(--spacing-xs);
    min-width: 32px;
    font-size: 1rem;
    line-height: 1;
    background: transparent;
    border: none;
}

#user-settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

#guest-status {
    padding: var(--spacing-xs);
}

/* Kudos Badge */
.kudos-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a2e;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: var(--spacing-xs);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.kudos-badge i {
    font-size: 0.75rem;
}

.kudos-badge.hidden {
    display: none;
}

/* Responsive header - collapses before account element clips title */

@media (max-width: 1280px) {
    .app-header {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .logo {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .logo-image {
        width: 60px;
    }

    .logo-text {
        align-items: center;
        text-align: center;
    }

    .user-status-container {
        position: static;
        transform: none;
    }
}


/* =============================================================================
   Tab Navigation
   ============================================================================= */

.tab-nav {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-xs);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.tab-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
}

.tab-btn.active {
    color: var(--color-text-primary);
    background: var(--gradient-glow);
    border: 1px solid var(--color-border-focus);
    box-shadow: var(--shadow-glow);
}

.tab-icon {
    font-size: var(--font-size-lg);
}

.tab-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}


/* =============================================================================
   Tab Content
   ============================================================================= */

.tab-content {
    display: none;
    animation: fadeIn var(--transition-normal);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =============================================================================
   Card Component
   ============================================================================= */

.card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    transition: border-color var(--transition-normal);
}

.card:hover {
    border-color: var(--color-bg-elevated);
}

.card-title {
    font-family: var(--font-family-serif);
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--color-text-primary);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.card-header .card-title {
    margin-bottom: 0;
    white-space: nowrap;
    /* Prevent title breaking awkwardly */
}

.header-actions {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    flex-wrap: wrap;
}


/* =============================================================================
   Form Elements
   ============================================================================= */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    transition: all var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

input::placeholder,
textarea::placeholder {
    color: var(--color-text-muted);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}


/* Checkbox styling */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    transition: color var(--transition-fast);
}

.checkbox-label:hover {
    color: var(--color-text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-accent-primary);
}


/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-elevated);
    border-color: var(--color-text-muted);
}

.btn-success {
    background: var(--color-accent-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-danger {
    background: var(--color-accent-danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-size-sm);
}

.btn-xs {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
}

.btn-large {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
}

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--color-accent-danger);
    border-color: var(--color-accent-danger);
    color: white;
}

.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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


/* =============================================================================
   Collapsible Sections
   ============================================================================= */

.collapsible-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-primary);
}

.collapsible-header .card-title {
    margin-bottom: 0;
}

.collapse-icon {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    transition: transform var(--transition-normal);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.collapsible-content.expanded {
    max-height: 1000px;
    margin-top: var(--spacing-md);
}

.collapsible-header[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}


/* =============================================================================
   Generate Tab Layout
   ============================================================================= */

.generate-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
}

@media (max-width: 1200px) {
    .generate-layout {
        grid-template-columns: 1fr;
    }
}

.controls-panel,
.results-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

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


/* =============================================================================
   LoRA Section
   ============================================================================= */

.lora-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.lora-item {
    display: grid;
    grid-template-columns: 1fr 80px 28px;
    gap: var(--spacing-sm);
    align-items: center;
}


/* =============================================================================
   Results Section
   ============================================================================= */

.results-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.generation-status {
    padding: var(--spacing-md);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
}

.status-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
}

.progress-bar {
    height: 6px;
    background: var(--color-bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    width: 0%;
    transition: width var(--transition-normal);
}

.results-gallery {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
    min-height: 300px;
}

.result-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg-tertiary);
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform var(--transition-normal);
}

.result-item:hover {
    transform: scale(1.02);
}

.result-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: var(--spacing-sm);
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
}


/* =============================================================================
   Profiles Tab Layout
   ============================================================================= */

.profiles-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--spacing-xl);
}

@media (max-width: 900px) {
    .profiles-layout {
        grid-template-columns: 1fr;
    }
}

.profile-list-panel,
.profile-editor-panel,
.job-list-panel,
.job-editor-panel {
    min-width: 0;
}

/* =============================================================================
   Jobs Tab Layout
   ============================================================================= */

.jobs-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--spacing-xl);
}

@media (max-width: 900px) {
    .jobs-layout {
        grid-template-columns: 1fr;
    }
}

.job-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    max-height: 60vh;
    overflow-y: auto;
}

.job-item {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.job-item:hover {
    border-color: var(--color-border-focus);
    background: var(--color-bg-elevated);
}

.job-item.selected {
    border-color: var(--color-accent-primary);
    background: var(--gradient-glow);
    box-shadow: var(--shadow-md);
}

.job-item.disabled {
    opacity: 0.6;
}

.job-toggle {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.job-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.job-name {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

.job-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.job-schedule {
    font-family: monospace;
    background: var(--color-bg-elevated);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.job-status-badge {
    font-size: var(--font-size-xs);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.job-status-badge.paused {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-accent-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.job-status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.job-mini-filmstrip {
    width: 100%;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-shrink: 0;
}

.job-mini-filmstrip::-webkit-scrollbar {
    height: 4px;
}

.job-mini-filmstrip::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

/* Toggle Switch Component */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    transition: all var(--transition-normal);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--color-text-muted);
    border-radius: 50%;
    transition: all var(--transition-normal);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: rgba(212, 175, 55, 0.3);
    border-color: var(--color-accent-primary);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background-color: var(--color-accent-primary);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.toggle-switch:hover .toggle-slider {
    border-color: var(--color-text-muted);
}

.toggle-switch input:checked:hover+.toggle-slider {
    border-color: var(--color-accent-secondary);
}

.profile-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.profile-list-item {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-list-item:hover {
    border-color: var(--color-border-focus);
}

.profile-list-item.active {
    border-color: var(--color-accent-primary);
    background: var(--gradient-glow);
}

.profile-item-name {
    font-weight: 500;
    color: var(--color-text-primary);
}

.profile-item-desc {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}


/* =============================================================================
   Pool Editor
   ============================================================================= */

.pools-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.params-section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

.help-text-inline {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-left: var(--spacing-sm);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.section-header h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
}

.pools-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.help-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-accent-primary);
}

.help-text code {
    background: var(--color-bg-elevated);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    color: var(--color-accent-secondary);
}

.pool-item {
    padding: var(--spacing-md);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.pool-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.pool-header .pool-name {
    flex: 1;
    font-weight: 500;
}

.pool-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.pool-item-row {
    display: grid;
    grid-template-columns: 1fr 80px 1fr 28px;
    gap: var(--spacing-sm);
    align-items: center;
}

@media (max-width: 600px) {
    .pool-item-row {
        grid-template-columns: 1fr 60px 28px;
    }

    .pool-item-row .item-negative {
        display: none;
    }
}

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--color-border);
}

/* =============================================================================
   Image Modal
   ============================================================================= */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--transition-normal);
}

.modal.show {
    display: flex;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 95%;
    max-height: 95%;
}

.modal-content img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-width: 100%;
    max-height: 85vh;
    /* Reduced to make room for buttons */
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.modal-close:hover,
.modal-close:focus {
    color: var(--color-accent-primary);
    text-decoration: none;
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-md);
    backdrop-filter: blur(4px);
}

/* Modal Navigation Buttons */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    z-index: 1002;
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
}

.modal-nav:hover {
    background: rgba(88, 166, 255, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

/* Modal Caption */
.modal-caption {
    margin-top: var(--spacing-sm);
    color: var(--color-text-primary);
    background: rgba(0, 0, 0, 0.7);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    text-align: center;
}

/* Carousel / Results Gallery Updates */
/* Results Layout */
.results-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    /* Adjust based on header/footer */
    gap: var(--spacing-md);
}

/* Stage: Main View */
.results-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 200px;
}

.results-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.stage-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 10px;
}

/* Strip: Scrolling Thumbnails */
.results-strip {
    width: 100%;
    min-width: 0;
    height: 100px;
    flex-shrink: 0;
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding: 4px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
}

.strip-item {
    height: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.strip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.strip-item:hover img {
    opacity: 0.8;
}

.strip-item.active {
    border-color: var(--color-accent-primary);
}

.strip-item.active img {
    opacity: 1;
}

/* Scrollbar for strip */
.results-strip::-webkit-scrollbar {
    height: 6px;
}

.results-strip::-webkit-scrollbar-track {
    background: transparent;
}

.results-strip::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.results-strip::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

.results-gallery::-webkit-scrollbar-thumb {
    background: var(--color-bg-elevated);
    border-radius: 4px;
}

.results-gallery::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}


/* =============================================================================
   Empty States
   ============================================================================= */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    color: var(--color-text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}


/* =============================================================================
   Toast Notifications
   ============================================================================= */

.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    z-index: 1000;
}

.toast {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn var(--transition-normal);
    max-width: 400px;
}

.toast.success {
    border-color: var(--color-accent-success);
}

.toast.error {
    border-color: var(--color-accent-danger);
}

.toast.warning {
    border-color: var(--color-accent-warning);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* =============================================================================
   Utilities
   ============================================================================= */

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =============================================================================
   Generation Queue
   ============================================================================= */

.generation-queue {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.queue-item {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    animation: fadeIn var(--transition-fast);
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
}

.queue-item-prompt {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    color: var(--color-text-primary);
}

.queue-item-status {
    font-family: monospace;
    color: var(--color-accent-primary);
}

.queue-item-progress {
    height: 4px;
    background: var(--color-bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.queue-item-fill {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width var(--transition-normal);
}

.queue-item.error {
    border-color: var(--color-accent-danger);
}

.queue-item.error .queue-item-status {
    color: var(--color-accent-danger);
}


/* =============================================================================
   Authentication Modal (Premium Styles)
   ============================================================================= */

.auth-content {
    background: rgba(22, 27, 34, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), var(--shadow-glow);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 420px;
    width: 100%;
    margin: 10vh auto;
    position: relative;
    overflow: hidden;
}

/* Close button positioning specific to this modal style */
/* Close button positioning specific to this modal style */
/* Removed empty ruleset to fix lint: .auth-content+.modal-close */

/* Tabs */
.auth-tabs {
    display: flex;
    background: var(--color-bg-tertiary);
    padding: 4px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    position: relative;
    border: 1px solid var(--color-border);
}

.auth-tab {
    flex: 1;
    padding: var(--spacing-sm);
    text-align: center;
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-tab:hover {
    color: var(--color-text-primary);
}

.auth-tab.active {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Forms */
.auth-form {
    display: none;
    /* Hide by default to prevent overlap */
    animation: fadeIn 0.3s ease-out;
}

.auth-form.active {
    display: block;
    /* Show only when active */
}

.auth-form h3 {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Inputs specific tweak */
.auth-form .form-group input {
    background: rgba(13, 17, 23, 0.6);
    border-color: var(--color-border);
    padding: 12px;
}

.auth-form .form-group input:focus {
    background: rgba(13, 17, 23, 0.9);
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

/* Button Full Width */
.btn-full {
    width: 100%;
    margin-top: var(--spacing-sm);
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
}

/* =============================================================================
   Job History Strip
   ============================================================================= */

.history-strip-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    white-space: nowrap;
    /* Custom Scrollbar for this strip */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.history-strip {
    display: flex;
    gap: var(--spacing-sm);
    height: 100px;
    align-items: center;
}

.history-thumb {
    flex: 0 0 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumb:hover {
    border-color: var(--color-accent-primary);
    transform: translateY(-2px);
}

.history-thumb .thumb-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 10px;
    padding: 2px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-thumb:hover .thumb-overlay {
    opacity: 1;
}

/* =============================================================================
   Image Preview Modal
   ============================================================================= */

.image-modal-content {
    background: transparent;
    border: none;
    box-shadow: none;
    max-width: 90vw;
    max-height: 90vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.image-modal-caption {
    margin-top: var(--spacing-md);
    color: var(--color-text-primary);
    background: rgba(0, 0, 0, 0.7);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-full);
}


/* =============================================================================
   Job Execution Logs
   ============================================================================= */

.job-logs-container {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: var(--font-size-xs);
    padding: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.log-entry {
    padding: 2px 0;
    line-height: 1.4;
}

.log-entry.info {
    color: var(--color-text-secondary);
}

.log-entry.success {
    color: var(--color-accent-success);
}

.log-entry.error {
    color: var(--color-accent-danger);
}

.log-entry.warn {
    color: var(--color-accent-warning);
}

.log-time {
    color: var(--color-text-muted);
    margin-right: var(--spacing-sm);
}

.log-empty {
    color: var(--color-text-muted);
    font-style: italic;
    padding: var(--spacing-sm);
    text-align: center;
}

/* =============================================================================
   Mini Filmstrip (Job List Preview)
   ============================================================================= */

.job-mini-filmstrip {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 4px 0;
    height: 48px;
}

.job-mini-filmstrip .strip-item {
    height: 40px;
    width: 40px;
    min-width: 40px;
    aspect-ratio: 1;
    flex-shrink: 0;
}

.job-mini-filmstrip .strip-item img {
    opacity: 0.8;
}

.job-mini-filmstrip .strip-item:hover img {
    opacity: 1;
}

.job-mini-filmstrip::-webkit-scrollbar {
    height: 4px;
}

.job-mini-filmstrip::-webkit-scrollbar-track {
    background: transparent;
}

.job-mini-filmstrip::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}


/* =============================================================================
   User Settings Modal (Age Verification)
   ============================================================================= */

#user-settings-modal .auth-content {
    max-width: 480px;
}

#user-settings-modal h3 {
    font-family: var(--font-family-serif);
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-primary);
    text-align: center;
}

/* Date Input Styling */
#user-settings-modal input[type="date"] {
    color-scheme: dark;
    padding: var(--spacing-md);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    transition: all var(--transition-fast);
}

#user-settings-modal input[type="date"]:focus {
    border-color: var(--color-accent-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

#user-settings-modal input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

#user-settings-modal input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Help Text */
#user-settings-modal .help-text {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--spacing-xs);
    font-style: italic;
}

/* Acknowledgement Checkbox */
#user-settings-modal .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

#user-settings-modal .checkbox-label:hover {
    border-color: var(--color-accent-primary);
}

#user-settings-modal .checkbox-label input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 2px;
}

#user-settings-modal .checkbox-label span {
    line-height: 1.4;
    color: var(--color-text-secondary);
}

/* Status Indicator */
#settings-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    transition: all var(--transition-normal);
}

#settings-status.unlocked {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3);
}

#settings-status-icon {
    font-size: var(--font-size-lg);
}

#settings-status-text {
    color: var(--color-text-secondary);
    font-weight: 500;
}


/* =============================================================================
   NSFW Gating Styles (Locked State)
   ============================================================================= */

.nsfw-locked {
    position: relative;
    opacity: 0.6;
    cursor: not-allowed !important;
}

.nsfw-locked::after {
    content: "\f023";
    font-family: "Font Awesome 5 Pro";
    font-weight: 900;
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--font-size-sm);
}

.nsfw-locked input {
    cursor: not-allowed !important;
}

/* Tooltip on hover for locked NSFW */
.nsfw-locked[title]:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 4px;
}


/* =============================================================================
   NSFW Blur Overlay Styles
   ============================================================================= */

.nsfw-blur-wrapper {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
}

.nsfw-blurred {
    filter: blur(30px) brightness(0.7);
    transition: filter 0.3s ease;
}

.nsfw-blur-wrapper.revealed .nsfw-blurred {
    filter: none;
}

/* Base overlay style (shared between reveal and hide) */
.nsfw-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* Show overlay on hover ONLY for blurred images (not revealed) */
.nsfw-blur-wrapper:not(.revealed):hover .nsfw-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* For revealed images, show hide button on hover WITHOUT dimming */
.nsfw-blur-wrapper.revealed:hover .nsfw-hide-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Hide overlay style - transparent background (no dimming) */
.nsfw-hide-overlay {
    background: transparent;
}

/* Unified action button style */
.nsfw-action-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--color-accent-danger);
    border-radius: var(--radius-lg);
    color: var(--color-text-primary);
    font-size: var(--font-size-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.nsfw-action-btn:hover {
    background: var(--color-accent-danger);
    color: white;
    transform: scale(1.05);
}

.nsfw-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Strip thumbnail NSFW blur */
.strip-item.nsfw-item img {
    filter: blur(20px) brightness(0.7);
}

.strip-item.nsfw-item.revealed img {
    filter: none;
}

/* Modal NSFW blur */
.modal-image-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.modal-image-wrapper.nsfw-blur-wrapper .nsfw-blurred {
    max-width: 90vw;
    max-height: 80vh;
}


/* =============================================================================
   Animated Image Wall Background
   ============================================================================= */

#image-wall-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.image-wall {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.image-wall-row {
    position: absolute;
    left: 0;
    width: 100%;
    overflow: visible;
}

.image-wall-row-content {
    display: flex;
    flex-wrap: nowrap;
    will-change: transform;
}

.image-wall-tile {
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin: 0px 0px;
    /* 16px total gap between tiles */
    box-shadow: inset 0 0 32px 16px rgba(0, 0, 0, 1);
}

.image-wall-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 5, 0.95);
    pointer-events: none;
    z-index: 1;
}

/* Vignette border effect around the image wall */
.image-wall-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    box-shadow: inset 0 0 96px 96px rgba(0, 0, 0, 0.5);
}