/* TimeCycle Editor Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a14;
    --bg-secondary: #12121f;
    --bg-tertiary: #1a1a2e;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --border: #2a2a4a;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

/* Sidebar */
#sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.site-logo {
    display: inline-block;
    margin-bottom: 8px;
}

.site-logo img {
    height: 24px;
    width: auto;
}

h1 {
    font-size: 18px;
    background: linear-gradient(135deg, var(--accent), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Config Section */
.config-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.config-section > label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: 600;
}

.input-field {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
}

select.input-field {
    cursor: pointer;
}

/* File Buttons */
.file-buttons {
    display: flex;
    gap: 8px;
}

.file-buttons .btn {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--accent);
    color: #000;
}

.btn-icon.playing {
    background: var(--accent);
    color: #000;
}

/* Time Controls */
.time-controls {
    margin-bottom: 12px;
}

.time-slot-dropdown {
    width: 100%;
}

.time-preview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.time-preview-row > label {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.time-slider-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.time-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.time-display {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: var(--accent);
    min-width: 40px;
}

/* Parameter Groups */
.params-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 16px;
}

.param-group {
    border-bottom: 1px solid var(--border);
}

.param-group-header {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.1s;
}

.param-group-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.collapse-icon {
    width: 16px;
    font-family: monospace;
    color: var(--accent);
}

.param-group-body {
    padding: 8px 16px 16px;
}

.param-group.collapsed .param-group-body {
    display: none;
}

/* Color Row */
.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.color-row > label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
}

.color-picker {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.rgb-values {
    display: flex;
    gap: 4px;
    flex: 1;
}

.rgb-values.rgba {
    gap: 3px;
}

.rgb-input {
    width: 100%;
    min-width: 0;
    padding: 6px 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 11px;
    font-family: 'SF Mono', Monaco, monospace;
    text-align: center;
}

.rgb-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Hide number input spinners */
.rgb-input::-webkit-outer-spin-button,
.rgb-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.rgb-input[type=number] {
    -moz-appearance: textfield;
}

/* Slider Row */
.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.slider-row > label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
}

.param-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.param-value {
    width: 60px;
    padding: 6px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 11px;
    font-family: 'SF Mono', Monaco, monospace;
    text-align: center;
}

.param-value:focus {
    outline: none;
    border-color: var(--accent);
}

.param-value::-webkit-outer-spin-button,
.param-value::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.param-value[type=number] {
    -moz-appearance: textfield;
}

/* Credits */
.credits {
    padding: 12px 16px;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.credits a {
    color: var(--accent);
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline;
}

/* Main Area */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-primary);
}

/* Toolbar */
#toolbar {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(18, 18, 31, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}

.toolbar-group {
    display: flex;
    gap: 4px;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent);
    color: #000;
}

.tool-btn svg {
    width: 18px;
    height: 18px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.toolbar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.toolbar-info .separator {
    color: var(--text-secondary);
}

/* Preview Container */
#preview-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#preview-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Info Bar */
#info-bar {
    position: absolute;
    bottom: 16px;
    left: 16px;
    background: rgba(18, 18, 31, 0.9);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    z-index: 100;
}

#info-bar .separator {
    color: var(--border);
}

#status-text {
    color: var(--accent);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
    #app {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    #main {
        min-height: 50vh;
    }

    .params-container {
        max-height: 200px;
    }
}

/* Notification Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-primary);
    z-index: 1000;
    animation: toast-in 0.3s ease;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
