* {
    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-y: auto;
    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;
}

.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;
}

.status-panel h3,
.archive-panel h3,
.bank-panel h3,
.sound-panel h3 {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.status-panel h3 span,
.bank-panel h3 span,
.sound-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;
}

/* Archive Select */
.archive-panel {
    margin-bottom: 20px;
}

.archive-panel select {
    width: 100%;
    padding: 10px 12px;
    background: #252540;
    color: #fff;
    border: 1px solid #3d3d5c;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.archive-panel select:focus {
    outline: none;
    border-color: #6366f1;
}

.archive-panel select option:disabled {
    color: #666;
}

/* Bank/Sound Lists */
.bank-panel,
.sound-panel {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #252540;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.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;
}

#bank-list,
#sound-list {
    list-style: none;
    overflow-y: auto;
    max-height: 200px;
    background: #252540;
    border-radius: 8px;
}

#bank-list li,
#sound-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 1px solid #2d2d44;
    transition: background 0.2s;
}

#bank-list li:last-child,
#sound-list li:last-child {
    border-bottom: none;
}

#bank-list li:hover,
#sound-list li:hover {
    background: #2d2d50;
}

#bank-list li.active,
#sound-list li.active {
    background: #6366f1;
    color: #fff;
}

.bank-name,
.sound-index {
    font-weight: 500;
}

.bank-size,
.sound-rate,
.sound-duration {
    font-size: 0.75rem;
    color: #888;
}

#bank-list li.active .bank-size,
#sound-list li.active .sound-rate,
#sound-list li.active .sound-duration {
    color: rgba(255, 255, 255, 0.7);
}

/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f0f1a;
    overflow: hidden;
}

#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;
}

/* Waveform */
#waveform-container {
    flex: 1;
    min-height: 200px;
    background: #1a1a2e;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

#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);
}

#loop-region {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(16, 185, 129, 0.15);
    border-left: 2px dashed #10b981;
    pointer-events: none;
}

/* Playback Controls */
#playback-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #1a1a2e;
    border-radius: 12px;
}

#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;
}

#playback-controls .btn.primary:hover {
    background: #4f46e5;
}

#playback-controls .btn:not(.primary) {
    width: 40px;
    height: 40px;
    background: #3d3d5c;
}

#playback-controls .btn:not(.primary):hover {
    background: #4d4d6c;
}

#time-display {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    color: #888;
    min-width: 160px;
}

#time-display #current-time {
    color: #fff;
}

#time-display .separator {
    margin: 0 4px;
}

.speed-control,
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.speed-control label {
    font-size: 0.8rem;
    color: #666;
}

.speed-control input[type="range"],
.volume-control input[type="range"] {
    width: 80px;
    accent-color: #6366f1;
}

.speed-control span {
    font-size: 0.8rem;
    color: #888;
    min-width: 40px;
}

.volume-control svg {
    color: #666;
}

/* Sound Info */
#sound-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 16px 20px;
    background: #1a1a2e;
    border-radius: 12px;
}

.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;
}

#export-section .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 8px;
}

#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;
}

/* Replace Section */
#replace-section,
#modifications-section {
    padding: 16px 20px;
    background: #1a1a2e;
    border-radius: 12px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-header h3 {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.status-badge {
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 12px;
    background: #3d3d5c;
    color: #888;
}

.status-badge.modified {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.mini-drop-zone {
    border: 2px dashed #3d3d5c;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
}

.mini-drop-zone:hover,
.mini-drop-zone.drag-over {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.mini-drop-zone svg {
    color: #6366f1;
}

.mini-drop-zone span {
    font-size: 0.85rem;
    color: #888;
}

.mini-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

#replace-preview {
    margin-top: 12px;
}

.preview-comparison {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.preview-item {
    flex: 1;
    background: #252540;
    padding: 10px 12px;
    border-radius: 6px;
}

.preview-label {
    display: block;
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.preview-item span:last-child {
    font-size: 0.8rem;
    color: #fff;
}

.preview-arrow {
    color: #6366f1;
    font-size: 1.2rem;
}

.replace-options {
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #888;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

.replace-buttons,
.rebuild-buttons {
    display: flex;
    gap: 8px;
}

.replace-buttons .btn,
.rebuild-buttons .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#modifications-list {
    list-style: none;
    margin: 0 0 12px 0;
    padding: 0;
    max-height: 150px;
    overflow-y: auto;
}

#modifications-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #252540;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

#modifications-list li:last-child {
    margin-bottom: 0;
}

.mod-info {
    color: #fff;
}

.mod-size {
    font-size: 0.75rem;
    color: #888;
}

.mod-size.larger {
    color: #f59e0b;
}

.mod-size.smaller {
    color: #10b981;
}

.mod-remove {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.mod-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Modified sound indicator in list */
#sound-list li.modified {
    border-left: 3px solid #f59e0b;
}

#sound-list li.modified::after {
    content: "modified";
    font-size: 0.65rem;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Credits */
.credits {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #2d2d44;
    font-size: 0.75rem;
    color: #666;
    text-align: center;
}

.credits a {
    color: #888;
    text-decoration: none;
}

.credits a:hover {
    color: #6366f1;
}

.credits a.author {
    color: #6366f1;
    font-weight: 500;
}

/* Scrollbars */
#sidebar::-webkit-scrollbar,
#bank-list::-webkit-scrollbar,
#sound-list::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track,
#bank-list::-webkit-scrollbar-track,
#sound-list::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb,
#bank-list::-webkit-scrollbar-thumb,
#sound-list::-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;
    }

    #sidebar h1 {
        font-size: 1.25rem;
    }

    #bank-list,
    #sound-list {
        max-height: 150px;
    }

    #main-content {
        min-height: 50vh;
    }

    #player-view {
        padding: 20px;
    }

    #playback-controls {
        flex-wrap: wrap;
    }

    .speed-control,
    .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;
    }

    #bank-list,
    #sound-list {
        max-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;
    }

    .speed-control input[type="range"],
    .volume-control input[type="range"] {
        width: 60px;
    }

    #sound-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;
    }

    #bank-list,
    #sound-list {
        max-height: 100px;
    }

    #playback-controls .btn.primary {
        width: 44px;
        height: 44px;
    }

    #playback-controls .btn:not(.primary) {
        width: 36px;
        height: 36px;
    }
}
