/* =========================================================================
   Upload Form — Preact component styles
   Prefix: uf-
   ========================================================================= */

/* Page container */
.uf-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--ctrl-bg, #0a0a0a);
    color: var(--ctrl-text, #e5e5e5);
}

/* Header */
.uf-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    flex-shrink: 0;
}

.uf-back-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--ctrl-text, #e5e5e5);
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.uf-back-btn:active {
    background: var(--ctrl-border, #2a2a2a);
}

.uf-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    flex: 1;
}

/* Step indicator */
.uf-steps {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.uf-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ctrl-border, #2a2a2a);
    transition: background 0.2s, transform 0.2s;
}

.uf-step-dot.active {
    background: var(--ctrl-accent, #4a9eff);
    transform: scale(1.3);
}

.uf-step-dot.done {
    background: var(--ctrl-accent, #4a9eff);
    opacity: 0.5;
}

/* Step content area */
.uf-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
}

/* Step container with transitions */
.uf-step-enter {
    animation: uf-slide-in 0.25s ease-out;
}

@keyframes uf-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- FilePond integration ---- */
.uf-pond-wrap {
    margin-bottom: 4px;
}

.uf-pond-wrap .filepond--root {
    font-family: inherit;
    margin-bottom: 0;
}

.uf-pond-wrap .filepond--panel-root {
    background: var(--ctrl-surface, #141414);
    border: 2px dashed var(--ctrl-border, #2a2a2a);
    border-radius: 16px;
}

.uf-pond-wrap .filepond--drop-label {
    color: var(--ctrl-text-muted, #8a8a8a);
    min-height: 200px;
    padding: 24px;
}

.uf-pond-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    line-height: 1.5;
}

.uf-pond-label i {
    font-size: 2rem;
    color: var(--ctrl-accent, #4a9eff);
    opacity: 0.6;
}

.uf-pond-label small {
    font-size: 0.75rem;
    opacity: 0.5;
}

.uf-pond-wrap .filepond--item-panel {
    background: var(--ctrl-surface, #141414);
    border-radius: 12px;
}

.uf-pond-wrap .filepond--file {
    color: var(--ctrl-text, #e5e5e5);
}

.uf-pond-wrap .filepond--label-action {
    color: var(--ctrl-accent, #4a9eff);
    text-decoration: none;
}

/* File list with per-file track type */
.uf-file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.uf-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ctrl-surface, #141414);
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 10px;
}

.uf-file-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.uf-file-row-name {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uf-file-row-size {
    font-size: 0.7rem;
    color: var(--ctrl-text-muted, #8a8a8a);
}

.uf-type-select {
    flex-shrink: 0;
    padding: 6px 8px;
    background: var(--ctrl-bg, #0a0a0a);
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 8px;
    color: var(--ctrl-text, #e5e5e5);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    max-width: 140px;
}

.uf-type-select:focus {
    border-color: var(--ctrl-accent, #4a9eff);
    outline: none;
}

/* Per-file title row (different songs mode) */
.uf-file-row-titled {
    gap: 8px;
}

.uf-file-row-badge {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.uf-file-title-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    font-size: 0.88rem;
}

/* File info card (kept for non-FilePond fallback) */
.uf-file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--ctrl-surface, #141414);
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 14px;
}

.uf-file-icon {
    font-size: 1.6rem;
    color: var(--ctrl-accent, #4a9eff);
    flex-shrink: 0;
}

.uf-file-info {
    flex: 1;
    min-width: 0;
}

.uf-file-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uf-file-size {
    font-size: 0.75rem;
    color: var(--ctrl-text-muted, #8a8a8a);
    margin-top: 2px;
}

.uf-file-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--ctrl-text-muted, #8a8a8a);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.uf-file-remove:active {
    background: var(--ctrl-border, #2a2a2a);
}

/* ---- Form fields ---- */
.uf-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.uf-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ctrl-text-muted, #8a8a8a);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.uf-label-opt {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.7;
}

.uf-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--ctrl-surface, #141414);
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 10px;
    color: var(--ctrl-text, #e5e5e5);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.uf-input:focus {
    border-color: var(--ctrl-accent, #4a9eff);
}

.uf-input::placeholder {
    color: var(--ctrl-text-dim, #555);
}

.uf-textarea {
    resize: vertical;
    min-height: 60px;
}

/* ---- Link mode tabs ---- */
.uf-tabs {
    display: flex;
    gap: 4px;
    background: var(--ctrl-surface, #141414);
    border-radius: 10px;
    padding: 3px;
}

.uf-tab {
    flex: 1;
    padding: 9px 8px;
    border: none;
    background: none;
    border-radius: 8px;
    color: var(--ctrl-text-muted, #8a8a8a);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: center;
}

.uf-tab.active {
    background: var(--ctrl-border, #2a2a2a);
    color: var(--ctrl-text, #e5e5e5);
    font-weight: 600;
}

/* ---- Search results ---- */
.uf-search-wrap {
    position: relative;
}

.uf-search-wrap .fa-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ctrl-text-dim, #555);
    font-size: 0.85rem;
    pointer-events: none;
}

.uf-search-input {
    width: 100%;
    padding: 12px 14px 12px 36px;
    background: var(--ctrl-surface, #141414);
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 10px;
    color: var(--ctrl-text, #e5e5e5);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.uf-search-input:focus {
    border-color: var(--ctrl-accent, #4a9eff);
}

.uf-results {
    max-height: 240px;
    overflow-y: auto;
    margin-top: 8px;
    border-radius: 10px;
}

.uf-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: inherit;
    font-family: inherit;
}

.uf-result-item:active {
    background: rgba(255, 255, 255, 0.04);
}

.uf-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.uf-result-info {
    flex: 1;
    min-width: 0;
}

.uf-result-title {
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uf-result-sub {
    font-size: 0.75rem;
    color: var(--ctrl-text-muted, #8a8a8a);
    margin-top: 1px;
}

.uf-no-results {
    padding: 16px;
    text-align: center;
    color: var(--ctrl-text-dim, #555);
    font-size: 0.85rem;
}

/* Selected song chip */
.uf-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(74, 158, 255, 0.08);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 10px;
}

.uf-selected-icon {
    color: var(--ctrl-accent, #4a9eff);
    font-size: 1rem;
}

.uf-selected-title {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Track type + visibility buttons ---- */
.uf-btn-group {
    display: flex;
    gap: 6px;
}

.uf-btn-option {
    flex: 1;
    padding: 10px 6px;
    background: var(--ctrl-surface, #141414);
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 10px;
    color: var(--ctrl-text-muted, #8a8a8a);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: center;
}

.uf-btn-option.active {
    background: rgba(74, 158, 255, 0.12);
    border-color: var(--ctrl-accent, #4a9eff);
    color: var(--ctrl-accent, #4a9eff);
    font-weight: 600;
}

.uf-btn-option:active {
    background: var(--ctrl-border, #2a2a2a);
}

.uf-row {
    display: flex;
    gap: 10px;
}

.uf-row > * {
    flex: 1;
}

/* ---- Action buttons ---- */
.uf-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.uf-btn {
    flex: 1;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
    text-align: center;
}

.uf-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.uf-btn-secondary {
    background: var(--ctrl-surface, #141414);
    color: var(--ctrl-text, #e5e5e5);
    border: 1px solid var(--ctrl-border, #2a2a2a);
}

.uf-btn-primary {
    background: var(--ctrl-accent, #4a9eff);
    color: #fff;
}

.uf-btn-primary:active:not(:disabled) {
    opacity: 0.85;
}

/* ---- Upload overlay ---- */
.uf-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10;
    padding: 24px;
    text-align: center;
}

.uf-upload-card {
    width: 100%;
    max-width: 320px;
    padding: 28px 24px;
    background: var(--ctrl-surface, #141414);
    border-radius: 20px;
    border: 1px solid var(--ctrl-border, #2a2a2a);
}

.uf-upload-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.uf-progress-track {
    height: 12px;
    background: var(--ctrl-border, #2a2a2a);
    border-radius: 6px;
    overflow: hidden;
}

.uf-progress-bar {
    height: 100%;
    background: var(--ctrl-accent, #4a9eff);
    border-radius: 6px;
    transition: width 0.2s;
    min-width: 3%;
}

.uf-progress-text {
    font-size: 0.8rem;
    color: var(--ctrl-text-muted, #8a8a8a);
    margin-top: 10px;
}

.uf-cancel-btn {
    margin-top: 16px;
    padding: 8px 20px;
    background: none;
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 8px;
    color: var(--ctrl-text-muted, #8a8a8a);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

.uf-cancel-btn:active {
    background: var(--ctrl-border, #2a2a2a);
}

.uf-error {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(220, 50, 50, 0.1);
    border: 1px solid rgba(220, 50, 50, 0.3);
    border-radius: 8px;
    color: #e55;
    font-size: 0.85rem;
    text-align: left;
}

/* Spacing between form sections */
.uf-sections {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Loading spinner */
.uf-loading {
    padding: 20px;
    text-align: center;
    color: var(--ctrl-text-muted, #8a8a8a);
}

.uf-loading i {
    font-size: 1.2rem;
}

/* Artist suggestions dropdown */
.uf-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 4px;
    max-height: 160px;
    overflow-y: auto;
    background: var(--ctrl-surface, #141414);
    border: 1px solid var(--ctrl-border, #2a2a2a);
    border-radius: 8px;
    z-index: 5;
}

.uf-suggestion {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    color: var(--ctrl-text, #e5e5e5);
    font-size: 0.88rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.uf-suggestion:active {
    background: rgba(255, 255, 255, 0.04);
}
