/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --spotify-green: #1DB954;
    --spotify-green-light: #1ed760;
    --spotify-green-dark: #169c46;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-input: #f3f4f6;
    --bg-input-focus: #e5e7eb;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #9ca3af;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-focus: rgba(29, 185, 84, 0.5);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(29, 185, 84, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Main Card ===== */
.main-card {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    max-width: 580px;
    width: 100%;
    margin: 0 auto;
}

/* ===== Input Section ===== */
.input-section {
    margin-bottom: 24px;
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    overflow: hidden;
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.1);
}

.input-icon {
    padding: 0 0 0 16px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.input-wrapper:focus-within .input-icon {
    color: var(--spotify-green);
}

#spotifyUrl {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    padding: 14px 12px;
    outline: none;
    min-width: 0;
}

#spotifyUrl::placeholder {
    color: var(--text-muted);
}

.paste-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.paste-btn:hover {
    color: var(--spotify-green);
}

.url-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.hint-icon {
    font-size: 0.85rem;
}

/* ===== Download Button ===== */
.download-btn {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--spotify-green) 0%, var(--spotify-green-dark) 100%);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: 0.6s;
}

.download-btn:hover::before {
    left: 100%;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.download-btn:disabled::before {
    display: none;
}

.btn-content,
.btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-icon {
    flex-shrink: 0;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Error Message ===== */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-sm);
    color: #f87171;
    font-size: 0.85rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Progress Section ===== */
.progress-section {
    margin-top: 24px;
    animation: slideIn 0.4s ease;
}

.progress-status {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--spotify-green), var(--spotify-green-light));
    border-radius: 100px;
    animation: progressIndeterminate 1.8s ease-in-out infinite;
    position: relative;
}

@keyframes progressIndeterminate {
    0% {
        width: 10%;
        margin-left: 0%;
    }

    50% {
        width: 40%;
        margin-left: 30%;
    }

    100% {
        width: 10%;
        margin-left: 90%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== Completed Section ===== */
.completed-section {
    margin-top: 24px;
    animation: slideIn 0.4s ease;
}

.completed-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.success-icon {
    width: 48px;
    height: 48px;
    background: rgba(29, 185, 84, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--spotify-green);
    flex-shrink: 0;
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.completed-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.completed-header p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== Completed Actions ===== */
.completed-actions {
    display: flex;
    gap: 12px;
}

.download-all-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--spotify-green) 0%, var(--spotify-green-dark) 100%);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.new-download-btn {
    padding: 14px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-download-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .main-card {
        padding: 24px 20px;
    }

    .completed-actions {
        flex-direction: column;
    }
}