:root {
    --color-bg: #f5f6fa;
    --color-primary: #0dcaf0;
    --color-success: #198754;
    --color-muted: #adb5bd;
    --radius: 12px;
}

body {
    font-family: system-ui, sans-serif;
    background: var(--color-bg);
    margin: 30px;
}

label {
    margin-top: 10px;
}

#sf_li_label,
#sf_id_label {
    display: block;
}

textarea,
input,
select {
    margin-top: 5px;
}

input#length::placeholder {
    font-size: .9em;
}

.hidden {
    display: none;
}

.resultBox {
    background: #eee;
    padding: 10px;
    border: 1px solid #ccc;
    white-space: pre-wrap;
    margin-top: 20px;
}


/* TAB SECTION */
header {
    display: flex;
    gap: 1rem;
    background-color: #222;
    color: white;
    padding: 0.5rem 1rem;
}

header .tab {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.3rem;
}

header .tab.active {
    background-color: #555;
}

.view {
    display: none;
    margin-top: 1rem;
}

.view.active {
    display: block;
}


/* STATUS MESSAGE SECTION */
.status-msg {
    margin-top: .8em;
    font-size: .9em;
    font-weight: 500;
}

/* red */
.status-msg.error {
    color: #dc3545;
}

/* green */
.status-msg.success {
    color: #198754;
}


/* TRACKING PROGRESS SECTION */
.progress-tracking-section {
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 2em;
    width: 100%;
    max-width: 480px;
    animation: fadeIn 0.4s ease;
}

.card h2 {
    margin: 0 0 1em;
    color: #333;
}

progress {
    width: 100%;
    height: 10px;
    appearance: none;
    border-radius: 6px;
    margin-bottom: 1.5em;
}

progress::-webkit-progress-bar {
    background: #e9ecef;
    border-radius: 6px;
}

progress::-webkit-progress-value {
    background: var(--color-primary);
    border-radius: 6px;
    transition: width 0.3s ease;
}

.steps {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7em;
    padding: 0.7em 1em;
    border-radius: var(--radius);
    background: #f1f3f5;
    transition: background 0.3s, color 0.3s;
}

.step.done {
    background: #d1e7dd;
    color: var(--color-success);
}

.step.active {
    background: #cff4fc;
    color: #055160;
    font-weight: 600;
    position: relative;
}

.step.upcoming {
    background: #e9ecef;
    color: var(--color-muted);
}

.step-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.8em;
    padding: 0.25em 0.6em;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.8rem;
    background: rgba(148, 163, 184, 0.15);
    color: #475569;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.step.done .step-counter {
    background: rgba(22, 163, 74, 0.2);
    color: #166534;
}

.step.active .step-counter {
    background: rgba(37, 99, 235, 0.25);
    color: #1d4ed8;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.2);
}

.step.upcoming .step-counter {
    background: rgba(148, 163, 184, 0.15);
    color: #475569;
}

.icon {
    width: 1.2em;
    height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.progress-spinner {
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    width: 1em;
    height: 1em;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.done-message {
    text-align: center;
    margin-top: 1.5em;
    color: var(--color-success);
    font-weight: 600;
    display: none;
}

.done-message.show {
    display: block;
    animation: fadeIn 0.6s ease;
}

.error-box {
    display: none;
    background: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
    padding: .6em .9em;
    margin-bottom: 1em;
    border-radius: .4em;
    animation: fadeIn 0.4s ease;
}

.error-box.show {
    display: block;
}

.result-link {
    display: none;
    text-align: center;
    margin-top: 1em;
}

.result-link a {
    background: var(--color-success);
    color: white;
    padding: 0.6em 1.4em;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s ease;
}

.result-link a:hover {
    background: #146c43;
}

.result-link.show {
    display: block;
    animation: fadeIn 0.6s ease;
}


/* SHARE URL SECTION */
.share-section {
    display: none;
    margin-top: 20px;
    text-align: center;
}

.share-container {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

#shareURL {
    border: none;
    padding: 10px 14px;
    font-size: 15px;
    width: 300px;
    background-color: #f9f9f9;
    color: #333;
}

#shareURL:focus {
    outline: none;
    background-color: #fff;
}

#copyBtn {
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#copyBtn:hover {
    background-color: #0056b3;
}

.copy-msg {
    margin-top: 6px;
    font-size: 14px;
    color: #28a745;
    transition: opacity 0.3s ease;
}


/* AUDIO PLAYER SECTION */
.spinner-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #4F4A85;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.audio-player-ready {
    opacity: 1 !important;
    transition: opacity 0.4s ease;
}


/* METADATA SECTION */
.audio-meta-card {
    font-family: system-ui, sans-serif;
    max-width: 650px;
    margin: 2rem auto;
    padding: 1.8rem;
    border-radius: 12px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.audio-meta-card h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #2b2b2b;
}

.audio-meta-card .author {
    color: #6c757d;
    margin-top: 0.3rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    color: #495057;
    font-size: 0.9rem;
}

.tags {
    margin-top: 1rem;
}

.tags span {
    display: inline-block;
    background-color: #dee2e6;
    color: #343a40;
    padding: 0.3rem 0.6rem;
    margin: 0.2rem;
    border-radius: 5px;
    font-size: 0.85rem;
}

.meta-section.access h3 {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* ACCESS LEVEL STYLES WITHIN METADATA SECTION */
.access p {
    padding: 0.5rem;
    border-left-width: 4px;
    border-left-style: solid;
}

.access-free p {
    background-color: #e8f5e9;
    border-left-color: #43a047;
}

.access-restricted p {
    background-color: #fffde7;
    border-left-color: #f9a825;
}

.access-confidential p {
    background-color: #ffebee;
    border-left-color: #e53935;
}

.access-copyrighted p {
    background-color: #e3f2fd;
    border-left-color: #1e88e5;
}

.access-donor p {
    background-color: #eceff1;
    border-left-color: #546e7a;
}

/* ACCESS LEGEND WITHIN METADATA SECTION */
.access-legend {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.legend-icon {
    width: 18px;
    height: 18px;
    text-align: center;
    line-height: 18px;
    border-radius: 50%;
    background-color: #1976d2;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
}

.legend-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 10;
    left: 25px;
    top: 0;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    width: 240px;
    padding: 10px;
    transition: opacity 0.3s;
}

.legend-tooltip ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legend-tooltip li {
    margin: 4px 0;
    font-size: 0.9rem;
}

.color-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    border-radius: 2px;
}

.color-box.free {
    background-color: #e8f5e9;
    border-left: 4px solid #43a047;
}

.color-box.restricted {
    background-color: #fffde7;
    border-left: 4px solid #f9a825;
}

.color-box.confidential {
    background-color: #ffebee;
    border-left: 4px solid #e53935;
}

.color-box.copyrighted {
    background-color: #e3f2fd;
    border-left: 4px solid #1e88e5;
}

.color-box.donor {
    background-color: #eceff1;
    border-left: 4px solid #546e7a;
}

.legend-icon:hover+.legend-tooltip,
.legend-icon:focus+.legend-tooltip {
    visibility: visible;
    opacity: 1;
}