* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: 320px;
    min-width: 320px;
    flex-shrink: 0;
    background: #1a1a2e;
    padding: 20px;
    overflow: hidden;
    border-right: 1px solid #2d2d44;
    display: flex;
    flex-direction: column;
}

#sidebar h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: #fff;
}

.subtitle {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.site-logo {
    display: inline-block;
    margin-bottom: 12px;
}

.site-logo img {
    height: 24px;
    width: auto;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #4a4a6a;
    border-radius: 12px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
    flex-shrink: 0;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone svg {
    color: #6366f1;
    margin-bottom: 10px;
}

.drop-zone p {
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.drop-zone .hint {
    font-size: 0.8rem;
    color: #666;
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Status Panel */
.status-panel {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.status-panel h3,
.pack-panel h3,
.category-panel h3,
.track-panel h3 {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

.status-panel h3 span,
.track-panel h3 span {
    font-size: 0.75rem;
    color: #666;
}

.file-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.85rem;
    border-bottom: 1px solid #2d2d44;
}

.file-label {
    color: #666;
}

.file-status {
    color: #10b981;
}

/* Pack/Category Select */
.pack-panel,
.category-panel {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.pack-panel select,
.category-panel select {
    width: 100%;
    padding: 10px 12px;
    background: #252540;
    color: #fff;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.pack-panel select:focus,
.category-panel select:focus {
    outline: none;
    border-color: #6366f1;
}

.pack-panel select option:disabled,
.category-panel select option:disabled {
    color: #666;
}

/* Track List */
.track-panel {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #252540;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.search-box svg {
    color: #666;
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
}

.search-box input::placeholder {
    color: #666;
}

#track-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    background: #252540;
    border-radius: 8px;
    min-height: 0;
}

#track-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid #2d2d44;
    transition: background 0.2s;
}

#track-list li:last-child {
    border-bottom: none;
}

#track-list li:hover {
    background: #2d2d50;
}

#track-list li.active {
    background: #6366f1;
    color: #fff;
}

.track-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-meta {
    display: flex;
    gap: 8px;
    font-size: 0.7rem;
    color: #888;
}

#track-list li.active .track-meta {
    color: rgba(255, 255, 255, 0.7);
}

.track-id {
    color: #6366f1;
    font-weight: 500;
}

#track-list li.active .track-id {
    color: #fff;
}

.category-badge {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-badge.music { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.category-badge.intro { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.category-badge.outro { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.category-badge.dj_banter { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.category-badge.advert { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.category-badge.cutscene { background: rgba(20, 184, 166, 0.2); color: #2dd4bf; }
.category-badge.unknown { background: rgba(100, 100, 100, 0.2); color: #888; }

#track-list li.active .category-badge {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f0f1a;
    overflow: hidden;
    min-width: 0;
}

#empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #666;
    padding: 40px;
}

#empty-state svg {
    color: #3d3d5c;
    margin-bottom: 20px;
}

#empty-state h2 {
    color: #888;
    font-size: 1.25rem;
    margin-bottom: 10px;
}

#empty-state p {
    font-size: 0.9rem;
    margin-bottom: 8px;
}

#empty-state code {
    background: #252540;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

#empty-state .hint {
    font-size: 0.8rem;
    color: #555;
}

/* Player View */
#player-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    gap: 20px;
    overflow-y: auto;
}

/* Waveform */
#waveform-container {
    min-height: 200px;
    height: 200px;
    background: #1a1a2e;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

#waveform {
    width: 100%;
    height: 100%;
    display: block;
}

#playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: #f59e0b;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

#loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 15, 26, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #888;
    font-size: 0.9rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #3d3d5c;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Playback Controls */
#playback-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #1a1a2e;
    border-radius: 12px;
    flex-shrink: 0;
}

.btn {
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

#playback-controls .btn {
    width: auto;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#playback-controls .btn.primary {
    width: 48px;
    height: 48px;
    background: #6366f1;
    color: #fff;
}

#playback-controls .btn.primary:hover:not(:disabled) {
    background: #4f46e5;
}

#playback-controls .btn.primary:disabled {
    background: #3d3d5c;
    color: #666;
    cursor: not-allowed;
}

#playback-controls .btn:not(.primary) {
    width: 40px;
    height: 40px;
    background: #3d3d5c;
    color: #fff;
}

#playback-controls .btn:not(.primary):hover {
    background: #4d4d6c;
}

#time-display {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    color: #888;
    min-width: 120px;
}

#time-display #current-time {
    color: #fff;
}

#time-display .separator {
    margin: 0 4px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.volume-control svg {
    color: #666;
}

.volume-control input[type="range"] {
    width: 80px;
    accent-color: #6366f1;
}

/* Track Info */
#track-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px 20px;
    background: #1a1a2e;
    border-radius: 12px;
    flex-shrink: 0;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 0.9rem;
    color: #fff;
}

/* Export Section */
#export-section {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

#export-section .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
}

#export-section .btn.primary {
    background: #6366f1;
    color: #fff;
}

#export-section .btn.primary:hover {
    background: #4f46e5;
}

#export-section .btn:not(.primary) {
    background: #3d3d5c;
    color: #fff;
}

#export-section .btn:not(.primary):hover {
    background: #4d4d6c;
}

/* Edit Section */
#edit-section {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

#edit-section .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
}

.btn.edit-btn {
    background: #f59e0b;
    color: #000;
}

.btn.edit-btn:hover {
    background: #d97706;
}

.btn.danger-btn {
    background: #ef4444;
    color: #fff;
}

.btn.danger-btn:hover {
    background: #dc2626;
}

/* Add Track Button */
.add-track-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px 16px;
    background: #10b981;
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.add-track-btn:hover {
    background: #059669;
}

/* Export Panel */
.export-panel {
    margin-bottom: 20px;
    padding-top: 16px;
    border-top: 1px solid #2d2d44;
    flex-shrink: 0;
}

.export-panel h3 {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modified-badge {
    background: #f59e0b;
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.modified-badge:empty {
    display: none;
}

.export-panel .btn {
    width: 100%;
    margin-bottom: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    background: #3d3d5c;
    color: #fff;
}

.export-panel .btn:hover:not(:disabled) {
    background: #4d4d6c;
}

.export-panel .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.export-panel .btn.export-btn {
    background: #10b981;
}

.export-panel .btn.export-btn:hover:not(:disabled) {
    background: #059669;
}

/* Modified track indicator */
#track-list li.modified {
    border-left: 3px solid #f59e0b;
}

#track-list li.modified .track-name::after {
    content: ' (modified)';
    color: #f59e0b;
    font-size: 0.7rem;
    font-weight: normal;
}

#track-list li.removed {
    opacity: 0.5;
    text-decoration: line-through;
    border-left: 3px solid #ef4444;
}

#track-list li.new {
    border-left: 3px solid #10b981;
}

#track-list li.new .track-name::after {
    content: ' (new)';
    color: #10b981;
    font-size: 0.7rem;
    font-weight: normal;
}

/* Credits */
.credits {
    padding-top: 16px;
    border-top: 1px solid #2d2d44;
    font-size: 0.75rem;
    color: #666;
    text-align: center;
    flex-shrink: 0;
}

.credits a {
    color: #888;
    text-decoration: none;
}

.credits a:hover {
    color: #6366f1;
}

.credits a.author {
    color: #6366f1;
    font-weight: 500;
}

/* Scrollbars */
#sidebar::-webkit-scrollbar,
#track-list::-webkit-scrollbar,
#player-view::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track,
#track-list::-webkit-scrollbar-track,
#player-view::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb,
#track-list::-webkit-scrollbar-thumb,
#player-view::-webkit-scrollbar-thumb {
    background: #3d3d5c;
    border-radius: 3px;
}

/* Responsive - Tablet */
@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    #app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    #sidebar {
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 1px solid #2d2d44;
        padding: 16px;
        overflow: visible;
        height: auto;
    }

    #sidebar h1 {
        font-size: 1.25rem;
    }

    .track-panel {
        min-height: auto;
        overflow: visible;
    }

    #track-list {
        max-height: 200px;
        min-height: 150px;
        overflow-y: auto;
    }

    #main-content {
        min-height: 50vh;
    }

    #player-view {
        padding: 20px;
    }

    #playback-controls {
        flex-wrap: wrap;
    }

    .volume-control {
        margin-left: 0;
    }

    .credits {
        display: none;
    }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
    #sidebar {
        padding: 12px;
    }

    #sidebar h1 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 12px;
    }

    .drop-zone {
        padding: 20px 16px;
        margin-bottom: 12px;
    }

    .drop-zone svg {
        width: 36px;
        height: 36px;
    }

    #track-list {
        max-height: 150px;
        min-height: 120px;
    }

    #player-view {
        padding: 16px;
        gap: 16px;
    }

    #waveform-container {
        min-height: 150px;
    }

    #playback-controls {
        padding: 12px;
        gap: 8px;
    }

    #time-display {
        font-size: 0.8rem;
        min-width: auto;
        flex: 1;
    }

    .volume-control input[type="range"] {
        width: 60px;
    }

    #track-info {
        padding: 12px;
        grid-template-columns: repeat(2, 1fr);
    }

    #export-section {
        flex-direction: column;
    }

    #export-section .btn {
        padding: 12px 16px;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    #sidebar {
        padding: 10px;
    }

    .site-logo img {
        height: 20px;
    }

    .drop-zone {
        padding: 16px 12px;
    }

    #track-list {
        max-height: 120px;
        min-height: 100px;
    }

    #playback-controls .btn.primary {
        width: 44px;
        height: 44px;
    }

    #playback-controls .btn:not(.primary) {
        width: 36px;
        height: 36px;
    }
}
