:root {
    --bg-primary: #0a0b10;
    --bg-secondary: #12131a;
    --bg-glass: rgba(18, 20, 30, 0.65);
    --border-glass: rgba(255, 255, 255, 0.05);
    
    --accent: #ffb830;
    --accent-glow: rgba(255, 184, 48, 0.35);
    --accent-dim: #cca025;
    
    --text-primary: #ffffff;
    --text-secondary: #9499b3;
    --text-muted: #62657a;
    
    --status-idle: #34c759;
    --status-active: #ff3b30;
    --status-paused: #ff9500;
    
    --facade-wall: #1a1b24;
    --facade-window-off: #0b0c10;
    --facade-window-static: #ffb830;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #06070a;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

.stars-bg {
    display: none;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(10, 11, 16, 0.7);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-glass);
    z-index: 10;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #ff5e00);
    border-radius: 8px;
    box-shadow: 0 0 15px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.logo-icon::after {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    background-color: var(--bg-primary);
    border-radius: 3px;
}

.header-logo h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    text-transform: uppercase;
}

.accent-text {
    background: linear-gradient(135deg, var(--accent), #ff8c00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Status Indicator */
.status-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    transition: all 0.3s ease;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
    background-color: currentColor;
}

.status-indicator.idle {
    color: var(--status-idle);
}

.status-indicator.active {
    color: var(--status-active);
    box-shadow: 0 0 10px rgba(255, 59, 48, 0.15);
    background: rgba(255, 59, 48, 0.05);
}

.status-indicator.paused {
    color: var(--status-paused);
    box-shadow: 0 0 10px rgba(255, 149, 0, 0.15);
    background: rgba(255, 149, 0, 0.05);
}

/* App Layout */
.app-layout {
    display: grid;
    grid-template-columns: minmax(360px, 450px) 1fr;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    flex-grow: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.highlight-border {
    position: relative;
    border-color: rgba(255, 184, 48, 0.12);
}

/* Cards general */
.facade-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    height: 100%;
}

.facade-header, .card-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 0.75rem;
}

.facade-header h2, .card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.resolution-badge, .counter-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Facade Simulation Canvas */
.facade-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    border-radius: 12px;
    background: radial-gradient(circle at center, #0f1016 0%, #050608 100%);
    border: 1px solid rgba(255, 255, 255, 0.03);
    width: 100%;
    margin-bottom: 1rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

#facadeCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.facade-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-color.p-color { background-color: var(--accent); }
.legend-color.x-color { background-color: rgba(255, 184, 48, 0.4); }
.legend-color.bg-color { background-color: var(--facade-wall); }

/* Controls Column */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}

.scrollable-card {
    max-height: 250px;
}

.flex-grow {
    flex-grow: 1;
}

/* Now Playing Widget */
.now-playing-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.audio-badge {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    background: rgba(255, 184, 48, 0.05);
}

.track-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.track-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

.track-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.time-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-bar-bg {
    flex-grow: 1;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff7a00);
    border-radius: 3px;
    box-shadow: 0 0 8px var(--accent-glow);
    transition: width 0.1s linear;
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.control-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

#togglePlayBtn {
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    box-shadow: 0 4px 12px rgba(255,255,255,0.15);
}

#togglePlayBtn:hover:not(:disabled) {
    background: #e5e5e5;
    color: var(--bg-primary);
    box-shadow: 0 4px 16px rgba(255,255,255,0.25);
}

.btn-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Volume control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.25rem 0.75rem;
    border-radius: 30px;
}

.volume-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.volume-btn:hover {
    color: var(--text-primary);
}

.volume-slider {
    -webkit-appearance: none;
    width: 70px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: transform 0.1s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all 0.2s ease;
}

.upload-zone:hover {
    border-color: var(--accent);
    background: rgba(255, 184, 48, 0.02);
    box-shadow: inset 0 0 15px rgba(255, 184, 48, 0.02);
}

.upload-zone.dragover {
    border-color: var(--accent);
    background: rgba(255, 184, 48, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.upload-zone:hover .upload-icon {
    color: var(--accent);
}

.upload-svg {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.upload-text {
    text-align: center;
}

.upload-text .primary-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

.upload-text .secondary-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Upload Progress */
.upload-progress-container {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.upload-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background-color: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 5px var(--accent-glow);
    transition: width 0.2s ease;
}

.upload-progress-status {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: right;
}

/* Lists and Items */
.queue-list, .library-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 0.25rem;
}

.empty-state {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 1.5rem 0;
    font-style: italic;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    transition: all 0.2s ease;
}

.item-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.07);
    transform: translateX(2px);
}

.item-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 16px;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-grow: 1;
    min-width: 0;
}

.item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.item-duration {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
}

.audio-icon-small {
    width: 12px;
    height: 12px;
    fill: currentColor;
    color: var(--accent-dim);
}

.item-actions {
    display: flex;
    gap: 0.4rem;
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.action-btn.btn-play:hover {
    background: rgba(52, 199, 89, 0.1);
    color: #34c759;
    border-color: rgba(52, 199, 89, 0.2);
}

.action-btn.btn-delete:hover {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.2);
}

.action-svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 1.5rem 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-glass);
    background: rgba(10, 11, 16, 0.4);
    margin-top: auto;
}

/* Responsive design */
@media (max-width: 950px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .facade-section {
        max-width: 450px;
        margin: 0 auto;
        width: 100%;
    }
}
