/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #141416;
    --bg-card-hover: #1a1a1d;
    --bg-input: #0d0d0e;
    
    --border-color: #2a2a2e;
    --border-focus: #3d3d42;
    
    --text-primary: #f0f0f2;
    --text-secondary: #9a9a9f;
    --text-muted: #5a5a5f;
    
    /* fal.ai brand colors */
    --accent: #E93D82;
    --accent-dim: #C4326D;
    --accent-glow: rgba(233, 61, 130, 0.15);
    --accent-bright: #FF4D8D;
    
    /* 3D handle colors - complementary to fal pink */
    --handle-azimuth: #E93D82;
    --handle-elevation: #3DE9B4;
    --handle-distance: #E9B43D;
    
    --error: #ff4d4d;
    --success: #3DE9B4;
    --warning: #E9B43D;
    
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-accent: 0 8px 24px rgba(233, 61, 130, 0.3);
    
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ===== Reset & Base ===== */
*, *::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-display);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    background-image: 
        radial-gradient(ellipse at 0% 0%, rgba(233, 61, 130, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(233, 61, 130, 0.02) 0%, transparent 50%);
}

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

a:hover {
    color: var(--text-primary);
}

/* ===== App Container ===== */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    color: var(--accent);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.logo-text {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.api-key-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.api-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.get-key-link {
    color: var(--accent);
    font-weight: 400;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.get-key-link:hover {
    color: var(--accent-bright);
    text-decoration: underline;
}

.api-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.api-input-wrapper input {
    width: 280px;
    padding: 10px 44px 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    transition: all var(--transition-fast);
}

.api-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.api-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.toggle-key-btn {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.toggle-key-btn:hover {
    color: var(--text-secondary);
}

.eye-icon {
    width: 18px;
    height: 18px;
}

.api-key-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 8px;
    white-space: nowrap;
}

/* ===== Main Content ===== */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* ===== Panels ===== */
.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-panel {
    align-content: flex-start;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color var(--transition-fast);
}

.panel-card:hover {
    border-color: var(--border-focus);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -8px;
    margin-bottom: 12px;
}

.handle-azimuth { color: var(--handle-azimuth); }
.handle-elevation { color: var(--handle-elevation); }
.handle-distance { color: var(--handle-distance); }

/* ===== Upload Zone ===== */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--accent-glow);
}

.upload-zone.has-image {
    border-style: solid;
    border-color: var(--border-focus);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.upload-icon {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.upload-placeholder p {
    font-size: 14px;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 300px;
    animation: fadeIn 0.3s ease-out;
}

.preview-image.hidden,
.hidden {
    display: none !important;
}

.clear-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.clear-btn:hover {
    background: var(--error);
    border-color: var(--error);
}

/* ===== URL Input Section ===== */
.url-input-section {
    margin-top: 12px;
}

.url-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin-bottom: 10px;
}

.url-divider::before,
.url-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.url-divider span {
    padding: 0 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.url-input-wrapper {
    display: flex;
    gap: 8px;
}

.url-input-wrapper input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    transition: all var(--transition-fast);
}

.url-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.load-url-btn {
    padding: 10px 16px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.load-url-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

/* ===== Three.js Container ===== */
.threejs-container {
    width: 100%;
    height: 380px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: linear-gradient(180deg, #0a0a0f 0%, #0d0d12 100%);
    border: 1px solid var(--border-color);
}

/* ===== Sliders ===== */
.slider-group {
    margin-bottom: 20px;
}

.slider-group:last-child {
    margin-bottom: 0;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.slider-header label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.slider-value {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-input);
    border-radius: 3px;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== API Parameters Display ===== */
.prompt-display {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.prompt-display:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.param-display {
    margin-bottom: 6px;
}

.param-display:last-child {
    margin-bottom: 0;
}

.param-name {
    color: var(--text-muted);
}

.param-value {
    color: var(--accent);
    font-weight: 600;
    margin-left: 4px;
}

.param-label {
    color: var(--text-secondary);
    font-size: 11px;
    margin-left: 8px;
}

/* ===== Generate Button ===== */
.generate-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-primary);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover:not(:disabled):not(.generating) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
}

.generate-btn:active:not(:disabled):not(.generating) {
    transform: translateY(0);
}

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

/* Generating state */
.generate-btn.generating {
    background: linear-gradient(135deg, var(--accent-dim) 0%, var(--accent) 100%);
    animation: btnPulse 2s ease-in-out infinite;
    cursor: wait;
}

.generate-btn.generating::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: btnShimmer 1.5s infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(233, 61, 130, 0.3); }
    50% { box-shadow: 0 0 30px rgba(233, 61, 130, 0.5); }
}

@keyframes btnShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Output ===== */
.output-card {
    display: flex;
    flex-direction: column;
}

.output-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    transition: all var(--transition-normal);
}

.output-container:has(.output-image:not(.hidden)) {
    /* When image is shown, fit to content */
}

.output-container:has(.output-placeholder:not(.hidden)) {
    /* When placeholder is shown, give it some height */
    min-height: 200px;
}

/* Loading state shimmer effect */
.output-container.loading {
    border-color: var(--accent);
}

.output-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(233, 61, 130, 0.1),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Success flash */
.output-container.success {
    animation: successFlash 0.6s ease-out;
}

@keyframes successFlash {
    0% { box-shadow: 0 0 0 0 rgba(61, 233, 180, 0.4); }
    50% { box-shadow: 0 0 30px 10px rgba(61, 233, 180, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(61, 233, 180, 0); }
}

.output-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    transition: opacity var(--transition-normal);
}

.output-placeholder svg {
    width: 64px;
    height: 64px;
    opacity: 0.3;
}

.output-placeholder p {
    font-size: 14px;
}

/* Loading spinner in placeholder */
.output-placeholder.loading svg {
    animation: pulse-icon 1s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
}

.output-image {
    max-width: 100%;
    height: auto;
    display: block;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.download-btn {
    margin-top: 12px;
    padding: 12px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.download-btn svg {
    width: 18px;
    height: 18px;
}

.download-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:not(.hidden) {
    animation: fadeIn 0.3s ease-out;
}

/* ===== Status Message ===== */
.status-message {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

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

.status-message.error {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    animation: slideIn 0.3s ease-out, shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.status-message.success {
    background: rgba(61, 233, 180, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.status-message.info {
    background: rgba(233, 61, 130, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
}

.status-message.info::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== Logs Panel ===== */
.logs-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    user-select: none;
    list-style: none;
}

.logs-header::-webkit-details-marker {
    display: none;
}

.logs-header::before {
    content: '▶';
    margin-right: 8px;
    font-size: 10px;
    transition: transform var(--transition-fast);
}

details[open] .logs-header::before {
    transform: rotate(90deg);
}

.clear-logs-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clear-logs-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
}

.logs-container {
    max-height: 250px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-input);
    border-top: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.6;
}

.log-entry {
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
    word-break: break-all;
    white-space: pre-wrap;
}

.log-entry:last-child {
    margin-bottom: 0;
}

.log-entry.info {
    background: rgba(61, 233, 180, 0.08);
    color: var(--success);
    border-left: 3px solid var(--success);
}

.log-entry.error {
    background: rgba(255, 77, 77, 0.08);
    color: var(--error);
    border-left: 3px solid var(--error);
}

.log-entry.warn {
    background: rgba(255, 170, 0, 0.08);
    color: var(--warning);
    border-left: 3px solid var(--warning);
}

.log-entry.request {
    background: rgba(100, 100, 255, 0.08);
    color: #8888ff;
    border-left: 3px solid #6666ff;
}

.log-entry.response {
    background: rgba(233, 61, 130, 0.08);
    color: var(--accent-bright);
    border-left: 3px solid var(--accent);
}

.log-timestamp {
    color: var(--text-muted);
    margin-right: 8px;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .api-key-section {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .api-input-wrapper input {
        width: 100%;
    }
    
    .threejs-container {
        height: 280px;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-focus);
}

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn svg {
    width: 20px;
    height: 20px;
}

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

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
    color: var(--bg-primary);
    border-color: var(--accent);
    box-shadow: var(--shadow-accent);
}

.tab-btn.active svg {
    stroke: var(--bg-primary);
}

/* ===== Tab Panels ===== */
.tab-panels {
    flex: 1;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ===== Camera Path Layout ===== */
.path-content {
    grid-template-columns: 1fr 1.2fr 1fr;
}

@media (max-width: 1200px) {
    .path-content {
        grid-template-columns: 1fr 1fr;
    }
    .path-content .right-panel {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .path-content {
        grid-template-columns: 1fr;
    }
    .path-content .right-panel {
        grid-column: span 1;
    }
}

.middle-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== Path Controls ===== */
.path-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.secondary-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.secondary-btn svg {
    width: 16px;
    height: 16px;
}

.secondary-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

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

/* ===== Waypoints Card ===== */
.waypoints-card {
    max-height: 300px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.waypoint-count {
    font-size: 12px;
    color: var(--accent);
    font-weight: 400;
}

.waypoints-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.waypoints-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.waypoint-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.waypoint-item:hover {
    border-color: var(--accent);
}

.waypoint-item.generating {
    border-color: var(--accent);
    animation: pulse 1s ease-in-out infinite;
}

.waypoint-item.completed {
    border-color: var(--success);
}

.waypoint-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.waypoint-info {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.waypoint-info span {
    color: var(--accent);
}

.waypoint-actions {
    display: flex;
    gap: 6px;
}

.waypoint-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.waypoint-action-btn svg {
    width: 14px;
    height: 14px;
}

.waypoint-action-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

.waypoint-action-btn.delete:hover {
    background: rgba(255, 77, 77, 0.2);
    color: var(--error);
    border-color: var(--error);
}

/* ===== Progress Container ===== */
.progress-container {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-bright) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== Gallery ===== */
.gallery-card {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

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

.keyframes-gallery {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    overflow-y: auto;
    max-height: 500px;
    padding: 4px;
}

.gallery-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.gallery-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    aspect-ratio: 1;
    transition: all var(--transition-fast);
}

.gallery-item:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}

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

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 10px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.gallery-item-download {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: var(--bg-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    align-self: flex-end;
}

.gallery-item-download svg {
    width: 14px;
    height: 14px;
}

.gallery-item-download:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-accent);
}

.gallery-item-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
}

.gallery-item-loading .spinner {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

/* ===== Video Settings ===== */
.video-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setting-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.setting-group textarea,
.setting-group select {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 13px;
    transition: all var(--transition-fast);
    resize: vertical;
}

.setting-group textarea:focus,
.setting-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.video-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.video-btn:hover:not(:disabled):not(.generating) {
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

/* ===== Videos List ===== */
.videos-card {
    max-height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.videos-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.videos-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    text-align: center;
}

.videos-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.video-item {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.video-item:hover {
    border-color: var(--accent);
}

.video-item video {
    width: 100%;
    display: block;
}

.video-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
}

.video-item-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.video-item-label span {
    color: var(--accent);
}

.video-item-download {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.video-item-download svg {
    width: 14px;
    height: 14px;
}

.video-item-download:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

.video-item-generating {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg-input);
}

.video-item-generating .spinner {
    width: 32px;
    height: 32px;
    color: var(--accent);
}

/* ===== Video Mode Toggle ===== */
.video-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.mode-btn svg {
    width: 20px;
    height: 20px;
}

.mode-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.mode-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
}

.mode-badge {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.mode-btn.active .mode-badge {
    background: var(--accent);
    color: var(--bg-primary);
}

.mode-badge.ai {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.mode-btn.active .mode-badge.ai {
    background: linear-gradient(135deg, #818cf8, #6366f1);
}

/* ===== AI Info Box ===== */
.ai-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.ai-info svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #818cf8;
}

.ai-info span {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== Video Preview ===== */
.video-preview-container {
    position: relative;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.final-video {
    width: 100%;
    display: block;
    border-radius: var(--radius-md);
}

.final-video:not(.hidden) + .videos-empty {
    display: none;
}

#video-canvas {
    position: absolute;
    top: 0;
    left: 0;
}


/* ===== Language Selector ===== */
.lang-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-selector-wrapper label {
    font-size: 18px;
}

.lang-selector {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-selector:hover {
    border-color: var(--accent);
}

.lang-selector:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(233, 61, 130, 0.1);
}
