/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #232a3b;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-purple: #a855f7;
    --accent-purple-light: #c084fc;
    --accent-pink: #ec4899;
    --accent-green: #22c55e;
    --border-color: #2d3748;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Open Sans, Helvetica Neue, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.header-content {
    padding: 16px 24px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Main Container - Two Panel Layout */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#left-panel {
    width: 50%;
    padding: 24px;
    overflow-y: auto;
}

#right-panel {
    width: 50%;
    position: relative;
    background-color: var(--bg-secondary);
}

#scene-container {
    width: 100%;
    height: 100%;
}

.loading-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Text Input Section */
.text-input-section {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.text-input-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--accent-purple-light);
}

.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.input-row input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input-row input[type="text"]:focus {
    border-color: var(--accent-purple);
}

.input-row input[type="text"]::placeholder {
    color: var(--text-muted);
}

.input-row button {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

#play-text-btn {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    color: white;
}

#play-text-btn:hover {
    opacity: 0.9;
}

#play-text-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#stop-text-btn {
    background-color: #ef4444;
    color: white;
}

#stop-text-btn:hover {
    background-color: #dc2626;
}

.queue-display,
.current-letter-display {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

#queue-letters {
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 3px;
    color: var(--accent-purple-light);
}

#current-letter {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--accent-green);
}

/* Playback Status */
.playback-status {
    margin-top: 16px;
    padding: 16px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: all 0.3s;
}

.status-indicator.idle {
    background-color: var(--text-muted);
}

.status-indicator.playing {
    background-color: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 1s infinite;
}

.status-indicator.paused {
    background-color: #f59e0b;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#status-text {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.progress-container {
    width: 100%;
    height: 6px;
    background-color: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    border-radius: 3px;
    transition: width 0.05s linear;
}

.time-display {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.animation-name-display {
    font-size: 0.8rem;
    color: var(--text-muted);
}

#animation-name {
    color: var(--accent-purple-light);
    font-weight: 600;
}

/* Animation Chips */
.select-animation-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.animation-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.animation-chip {
    padding: 8px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    text-transform: uppercase;
    font-weight: 500;
}

.animation-chip:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent-purple);
}

.animation-chip.active {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
    border-color: transparent;
}

/* Controls */
.controls {
    margin-bottom: 20px;
}

#stop-button {
    padding: 10px 20px;
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.2s;
}

#stop-button:hover {
    background-color: #dc2626;
}

/* Advanced Settings Dropdown */
.advanced-settings {
    margin-top: 8px;
}

.settings-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 14px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.settings-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.settings-toggle .chevron {
    margin-left: auto;
    transition: transform 0.3s;
}

.settings-toggle.open .chevron {
    transform: rotate(180deg);
}

.settings-content {
    display: none;
    margin-top: 12px;
}

.settings-content.open {
    display: block;
}

/* Blending Controls */
.blending-controls {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 12px;
}

.blending-controls h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.control-group {
    margin-bottom: 16px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.control-group .value-display {
    color: var(--accent-purple-light);
    font-weight: 500;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-purple);
    cursor: pointer;
    transition: all 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-group input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-purple);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.control-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    #left-panel,
    #right-panel {
        width: 100%;
    }

    #right-panel {
        min-height: 400px;
    }
}
