/* audiokit/style.css */

:root {
    --primary: var(--sk-primary, #2563eb);
    --primary-hover: var(--sk-primary-600, #1d4ed8);
    --bg-body: var(--sk-bg, #f6f7f9);
    --bg-card: var(--sk-surface, #ffffff);
    --bg-alt: var(--sk-surface-2, #f1f5f9);
    --text-main: var(--sk-text, #1f2937);
    --text-muted: var(--sk-text-muted, #6b7280);
    --text-faint: var(--sk-text-faint, #9aa3b2);
    --border-color: var(--sk-border, #d9dee7);
    --danger: var(--sk-danger, #dc2626);
    --success: var(--sk-success, #16a34a);
}

:root[data-theme="dark"] {
    --primary: var(--sk-primary, #3b82f6);
    --primary-hover: var(--sk-primary-600, #2563eb);
    --bg-body: var(--sk-bg, #0b1120);
    --bg-card: var(--sk-surface, #111a2e);
    --bg-alt: var(--sk-surface-2, #0f1728);
    --text-main: var(--sk-text, #e8edf6);
    --text-muted: var(--sk-text-muted, #94a3b8);
    --text-faint: var(--sk-text-faint, #64748b);
    --border-color: var(--sk-border, #1e293b);
    --danger: var(--sk-danger, #f87171);
    --success: var(--sk-success, #4ade80);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: var(--sk-primary, #3b82f6);
        --primary-hover: var(--sk-primary-600, #2563eb);
        --bg-body: var(--sk-bg, #0b1120);
        --bg-card: var(--sk-surface, #111a2e);
        --bg-alt: var(--sk-surface-2, #0f1728);
        --text-main: var(--sk-text, #e8edf6);
        --text-muted: var(--sk-text-muted, #94a3b8);
        --text-faint: var(--sk-text-faint, #64748b);
        --border-color: var(--sk-border, #1e293b);
        --danger: var(--sk-danger, #f87171);
        --success: var(--sk-success, #4ade80);
    }
}

.audiokit-container {
    max-width: 1440px;
    margin: 32px auto 60px;
    padding: 0 20px;
    box-sizing: border-box;
    color: var(--text-main);
}
@media (min-width: 1800px) {
    .audiokit-container {
        max-width: 1600px;
    }
}

.ak-header {
    text-align: center;
    margin-bottom: 36px;
}

.ak-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ak-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Fallback UI */
.ak-unsupported {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px 24px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.unsupported-icon {
    color: var(--danger);
    margin-bottom: 20px;
}

.ak-unsupported h2 {
    margin-bottom: 15px;
    color: var(--text-main);
}

.ak-unsupported p {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.supported-browsers {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.supported-browsers .browser {
    background: var(--bg-alt);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

/* Dropzone */
.ak-dropzone {
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.ak-dropzone:hover, .ak-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.04);
}

.ak-dropzone svg {
    color: var(--primary);
    margin-bottom: 15px;
}

.ak-dropzone h3 {
    margin-bottom: 5px;
    color: var(--text-main);
}

.ak-dropzone p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Workspace */
.ak-workspace {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-alt);
}

.workspace-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.ak-waveform-container {
    padding: 20px;
    background: #0b1120;
    border-bottom: 1px solid var(--border-color);
}

#waveform {
    width: 100%;
}

#timeline {
    margin-top: 10px;
}

.ak-controls {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 20px;
    flex-wrap: wrap;
    background: var(--bg-card);
}

.ak-controls .time-display {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-main);
    background: var(--bg-alt);
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.zoom-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    color: var(--text-muted);
}

.zoom-control input[type=range] {
    width: 150px;
    accent-color: var(--primary);
}

/* Tool Tabs */
.ak-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-alt);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ak-tabs::-webkit-scrollbar {
    display: none;
}

.ak-tabs .tab {
    flex: 0 0 auto;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ak-tabs .tab:hover {
    color: var(--text-main);
}

.ak-tabs .tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-card);
}

.ak-tab-content {
    padding: 24px;
    background: var(--bg-card);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.tab-desc {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Trim inputs */
.trim-inputs {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.trim-inputs input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    padding: 8px 12px;
}

/* Actions row */
.ak-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.ak-actions select, .ak-actions input[type=range] {
    width: auto;
    max-width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    padding: 8px 12px;
}

.ak-actions input[type=range] {
    accent-color: var(--primary);
}

/* Processing Overlay */
.ak-processing {
    text-align: center;
    padding: 40px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(37, 99, 235, 0.04);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

.progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin: 15px auto;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Output Container */
.ak-output {
    text-align: center;
    padding: 30px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(16, 185, 129, 0.08);
}

.ak-output h3 {
    color: var(--success);
    margin-bottom: 12px;
    font-size: 1.25rem;
}

/* Merge List UI */
.ak-merge-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}
.ak-merge-list li:last-child {
    border-bottom: none;
}
.ak-merge-list-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 15px;
    color: var(--text-main);
    font-size: 0.95rem;
}
.ak-merge-list-actions {
    display: flex;
    gap: 8px;
}
.ak-merge-btn {
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ak-merge-btn:hover {
    background: var(--bg-card);
    color: var(--text-main);
}
.ak-merge-btn-danger:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Responsive Mobile Layout */
@media (max-width: 768px) {
    .audiokit-container {
        margin: 20px auto;
        padding: 0 12px;
    }

    .ak-header {
        margin-bottom: 24px;
    }

    .ak-header h1 {
        font-size: 1.8rem;
    }

    .ak-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 16px;
    }

    .zoom-control {
        margin-left: 0;
        justify-content: space-between;
        width: 100%;
    }

    .zoom-control input[type=range] {
        flex: 1;
    }

    .ak-tabs {
        flex-wrap: nowrap;
    }

    .ak-tabs .tab {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .workspace-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .workspace-header h3 {
        max-width: 100%;
        font-size: 1rem;
    }

    .trim-inputs {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .trim-inputs > div {
        width: 100%;
    }

    .trim-inputs input {
        width: 100% !important;
        box-sizing: border-box;
    }

    .ak-actions {
        flex-direction: column;
        width: 100%;
    }

    .ak-actions select,
    .ak-actions input[type=range] {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }

    .ak-actions .btn {
        width: 100%;
        margin-left: 0 !important;
        min-height: 44px;
    }

    .ak-tab-content {
        padding: 16px;
    }
}
