/* =============================================================
   Vinyl Maker / Turntable Tab — Styles
   ============================================================= */

/* ── Tab Bar ── */
.tab-bar {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 4px;
    backdrop-filter: blur(10px);
}

.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.tab-btn i {
    font-size: 14px;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(128, 128, 128, 0.08);
}

.tab-btn.active {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .tab-btn.active {
    box-shadow: 0 2px 12px rgba(124, 77, 255, 0.25);
}

/* ── Tab Content ── */
.tab-content {
    display: none;
}

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

/* ── Vinyl Maker Container ── */
.vinyl-maker-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

/* ── Preview Stage ── */
.vinyl-preview-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.vinyl-preview-wrapper[data-aspect="1:1"] {
    aspect-ratio: 1 / 1;
}

.vinyl-preview-wrapper[data-aspect="9:16"] {
    aspect-ratio: 9 / 16;
}

.vinyl-preview-wrapper[data-aspect="16:9"] {
    aspect-ratio: 16 / 9;
    max-width: 720px;
}

.vinyl-stage-inner {
    position: absolute;
    inset: 0;
}

.vinyl-preview-wrapper canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.vinyl-overlay-layer {
    position: absolute;
    inset: 0;
    pointer-events: auto;
    user-select: none;
    touch-action: none;
}

/* Vertical guide that flashes on screen while a dragged overlay snaps
   to the horizontal centre. Lives outside .vinyl-overlay-layer so it
   isn't wiped when the selection box re-renders. */
.vinyl-snap-guide {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    margin-left: -0.5px;
    background: rgba(255, 90, 200, 0.85);
    box-shadow: 0 0 6px rgba(255, 90, 200, 0.6);
    pointer-events: none;
    opacity: 0;
    transition: opacity 80ms linear;
    z-index: 10;
}
.vinyl-snap-guide.active {
    opacity: 1;
}

/* ── Placeholder (shown when no track) ── */
.vinyl-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    pointer-events: none;
}

.vinyl-placeholder i {
    font-size: 64px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.vinyl-placeholder p {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.6;
}

.vinyl-placeholder.hidden {
    display: none;
}

/* ── Vinyl Controls ── */
.vinyl-controls {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vinyl-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.vinyl-fx-row {
    gap: 8px;
}

.vinyl-fx-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-right: 2px;
}

.vinyl-fx-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.vinyl-fx-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.vinyl-fx-btn.active {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-bg);
}

.vinyl-duration-label,
.vinyl-bg-label,
.vinyl-artwork-size-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.vinyl-duration-label span,
.vinyl-bg-label span,
.vinyl-artwork-size-label span {
    font-weight: 500;
}

.vinyl-select {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.vinyl-select:focus {
    border-color: var(--player-accent);
}

/* ── Export Progress ── */
.vinyl-export-progress {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vinyl-export-progress.hidden {
    display: none;
}

.vinyl-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.vinyl-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--player-accent);
    border-radius: 3px;
    transition: width 0.15s linear;
}

.vinyl-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

#vinyl-export-stop-btn {
    align-self: center;
    background: #c0392b;
    color: #fff;
    border-color: #a93226;
}

#vinyl-export-stop-btn:hover {
    background: #e74c3c;
    border-color: #c0392b;
}

#vinyl-export-instagram-btn {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    color: #fff;
    border-color: #bc1888;
}

#vinyl-export-instagram-btn:hover {
    filter: brightness(1.1);
}

#vinyl-export-instagram-btn:disabled {
    filter: grayscale(0.6) brightness(0.8);
    cursor: not-allowed;
}

/* ── Track Info Bar ── */
.vinyl-track-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
}

.vinyl-track-info img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.vinyl-track-info span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .tab-btn {
        font-size: 12px;
        padding: 8px 10px;
    }

    .vinyl-preview-wrapper {
        max-width: 100%;
        border-radius: 18px;
    }

    .vinyl-controls {
        max-width: 100%;
    }

    .vinyl-fx-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* ── Artwork Size Slider ── */
.vinyl-artwork-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.vinyl-artwork-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--player-accent);
    border-radius: 50%;
    cursor: pointer;
}

.vinyl-artwork-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--player-accent);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.vinyl-artwork-size-value {
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    display: inline-block;
}

.vinyl-texture-label {
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: center;
}

/* ── Selection chrome (DOM, drawn over canvas) ── */
.vinyl-sel-box {
    position: absolute;
    border: 2px solid #4a9eff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3) inset;
    pointer-events: auto;
    cursor: move;
}

.vinyl-sel-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #4a9eff;
    border-radius: 2px;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.vinyl-sel-handle[data-corner="nw"] { top: -8px;    left: -8px;    cursor: nwse-resize; }
.vinyl-sel-handle[data-corner="ne"] { top: -8px;    right: -8px;   cursor: nesw-resize; }
.vinyl-sel-handle[data-corner="sw"] { bottom: -8px; left: -8px;   cursor: nesw-resize; }
.vinyl-sel-handle[data-corner="se"] { bottom: -8px; right: -8px;  cursor: nwse-resize; }

.vinyl-sel-label {
    position: absolute;
    top: -22px;
    left: 0;
    background: #4a9eff;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    white-space: nowrap;
}

.vinyl-text-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
}

.vinyl-text-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    outline: none;
}

.vinyl-text-input:focus {
    border-color: var(--player-accent);
}

.vinyl-color-input {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    padding: 2px;
    cursor: pointer;
}

.vinyl-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.vinyl-color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.vinyl-color-input::-moz-color-swatch { border: none; border-radius: 4px; }

.vinyl-aspect-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.vinyl-aspect-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}
.vinyl-aspect-btn.active {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border-color: var(--btn-primary-bg);
}

/* ── Fullscreen preview ── */
.vinyl-preview-wrapper:fullscreen,
.vinyl-preview-wrapper:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    border: none;
    background: #0a0a14;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vinyl-preview-wrapper:fullscreen .vinyl-stage-inner,
.vinyl-preview-wrapper:-webkit-full-screen .vinyl-stage-inner {
    position: relative;
    width: auto;
    height: 100%;
    aspect-ratio: 1 / 1;
    inset: auto;
}

.vinyl-preview-wrapper[data-aspect="9:16"]:fullscreen .vinyl-stage-inner,
.vinyl-preview-wrapper[data-aspect="9:16"]:-webkit-full-screen .vinyl-stage-inner {
    aspect-ratio: 9 / 16;
}

.vinyl-preview-wrapper[data-aspect="16:9"]:fullscreen .vinyl-stage-inner,
.vinyl-preview-wrapper[data-aspect="16:9"]:-webkit-full-screen .vinyl-stage-inner {
    aspect-ratio: 16 / 9;
    width: 100%;
    height: auto;
}

.vinyl-preview-wrapper:fullscreen canvas,
.vinyl-preview-wrapper:-webkit-full-screen canvas {
    width: 100%;
    height: 100%;
}
