/* ==========================================================================
   Wave Downloader — Clean Minimalist Dark Design System (Linear & Stepper)
   ========================================================================== */

:root {
    /* Matte Dark Palette */
    --bg-main: #0c0d12;
    --bg-surface: #13151c;
    --bg-surface-hover: #1a1c26;
    --bg-input: #101117;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-active: #06b6d4;

    --text-primary: #ededed;
    --text-secondary: #9aa0ad;
    --text-muted: #5e6371;

    /* Wave Cyan / Ocean Accent */
    --accent-cyan: #06b6d4;
    --accent-blue: #0ea5e9;
    --accent-btn: #06b6d4;
    --accent-btn-hover: #0891b2;
    --accent-text: #08090d;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-dropdown: 0 10px 30px rgba(0, 0, 0, 0.5);

    --transition: all 0.16s ease-out;
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f1f5f9;
    --bg-input: #ffffff;
    --border: rgba(0, 0, 0, 0.09);
    --border-hover: rgba(0, 0, 0, 0.18);
    --border-active: #0284c7;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent-cyan: #0284c7;
    --accent-blue: #0ea5e9;
    --accent-btn: #0f172a;
    --accent-btn-hover: #1e293b;
    --accent-text: #ffffff;

    --shadow-subtle: 0 4px 16px rgba(0, 0, 0, 0.05);
    --shadow-dropdown: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    padding: 24px 0 20px;
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-wave-svg {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-muted {
    font-weight: 500;
    color: var(--text-muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.header-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

/* Rounded Flag Icons */
.flag-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.flag-svg {
    width: 18px;
    height: 12px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    display: block;
}

.lang-item-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    padding: 7px 9px;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

.icon-chevron {
    width: 13px;
    height: 13px;
    transition: transform 0.15s ease;
}

/* Dropdown Shared */
.dropdown-wrap {
    position: relative;
}

.dropdown-wrap.open .icon-chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 100;
}

.dropdown-wrap.open .dropdown-menu {
    display: flex;
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.dropdown-item.active {
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
    font-weight: 600;
}

.dropdown-item .badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Main */
.main {
    flex: 1;
    padding: 50px 0 60px;
}

.hero {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    font-size: 0.98rem;
    color: var(--text-secondary);
    max-width: 580px;
    margin: 0 auto 32px;
    line-height: 1.5;
}

/* Search & Convert Bar */
.converter-box {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 8px;
    box-shadow: var(--shadow-subtle);
    transition: var(--transition);
}

.search-form:focus-within {
    border-color: var(--border-active);
}

.input-icon {
    display: flex;
    align-items: center;
    padding-left: 8px;
    color: var(--text-muted);
}

.icon-search { width: 18px; height: 18px; }
.icon-link { width: 18px; height: 18px; display: none; color: var(--accent-cyan); }

.search-form.has-url .icon-search { display: none; }
.search-form.has-url .icon-link { display: block; }

.main-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 8px;
    min-width: 140px;
}

.main-input::placeholder {
    color: var(--text-muted);
}

.paste-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.paste-btn svg {
    width: 13px;
    height: 13px;
}

.paste-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
    border-color: var(--border-hover);
}

.format-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.format-btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

.fmt-tag {
    font-weight: 700;
    color: var(--accent-cyan);
}

.fmt-desc {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.format-menu {
    width: 240px;
    max-height: 320px;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 6px 10px 2px;
}

.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent-btn);
    color: var(--accent-text);
    border: none;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.primary-btn:hover {
    background: var(--accent-btn-hover);
}

.icon-action {
    width: 16px;
    height: 16px;
}

/* Autocomplete Suggestions */
.suggestions-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 90;
    text-align: left;
}

.suggestions-list.show {
    display: flex;
}

.suggest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.suggest-item:hover, .suggest-item.focused {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.suggest-item svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

/* Minimalist Conversion Card */
.process-card {
    max-width: 820px;
    margin: 24px auto 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    text-align: left;
}

.process-thumb-wrap {
    position: relative;
    flex: 0 0 160px;
    height: 96px;
    background: #101117;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.thumb-skeleton {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #101117;
}

.skeleton-wave {
    width: 32px;
    height: 32px;
    opacity: 0.6;
    animation: pulseWave 1.6s infinite ease-in-out;
}

@keyframes pulseWave {
    0%, 100% { opacity: 0.3; transform: scale(0.95); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.process-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.process-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 3px;
}

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

.process-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.process-badge {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
}

.process-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.process-author {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.process-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.process-fill {
    height: 100%;
    background: var(--accent-cyan);
    border-radius: var(--radius-full);
    transition: width 0.2s ease;
}

.process-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 0.78rem;
}

.process-status {
    color: var(--text-secondary);
}

.process-stats {
    display: flex;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
}

.stat-speed {
    color: var(--accent-cyan);
}

.stat-percent {
    color: var(--text-primary);
    font-weight: 600;
}

.process-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.download-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #06B6D4;
    color: #08090C;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 700;
    padding: 9px 22px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    box-shadow: 0 2px 10px rgba(6, 182, 212, 0.25);
}

.download-link-btn:hover {
    background: #22d3ee;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
}

.download-link-btn svg {
    width: 17px;
    height: 17px;
}

.size-pill {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.76rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: inherit;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

/* Results Grid */
.results-container {
    max-width: 820px;
    margin: 36px auto 0;
    text-align: left;
}

.results-header {
    margin-bottom: 14px;
}

.results-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}

.result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.result-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

.result-thumb-box {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
}

.result-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.result-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-author {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.result-btn {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.result-btn:hover {
    background: var(--accent-btn);
    color: var(--accent-text);
    border-color: transparent;
}

/* Supported Platforms Bar (Clean Badges with SVG Brand Icons) */
.platforms-bar {
    padding: 28px 0 32px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.platforms-title {
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.platforms-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.platform-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.platform-chip:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-surface-hover);
}

.plat-svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.8;
    transition: var(--transition);
}

.platform-chip:hover .plat-svg {
    opacity: 1;
    color: var(--accent-cyan);
}

/* ==========================================================================
   Horizontal Connected Stepper (Styled per Reference Image)
   ========================================================================== */
.stepper-section {
    padding: 44px 0 20px;
}

.stepper-horizontal {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 38px 28px 32px;
}

.stepper-track-line {
    position: absolute;
    top: 55px; /* Aligned with center of the 36px circular nodes */
    left: calc(16.66% + 20px);
    right: calc(16.66% + 20px);
    height: 2px;
    background: var(--accent-cyan);
    z-index: 1;
}

.stepper-col {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.step-node-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--accent-cyan);
    color: var(--accent-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 0 0 6px var(--bg-surface); /* Cleanly masks the track line */
}

.step-node-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-node-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
}

.step-node-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-brand {
    display: flex;
    gap: 12px;
    align-items: center;
}

.footer-title {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Ad Container Styling */
.ad-slot-container {
    width: 100%;
    max-width: 728px;
    margin: 28px auto 0;
    display: flex;
    justify-content: center;
}

.ad-placeholder {
    width: 100%;
    min-height: 90px;
    background: #0f1118;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 14px;
}

.ad-badge {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ad-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 1.7rem;
    }

    .search-form {
        flex-wrap: wrap;
    }

    .main-input {
        width: 100%;
        min-width: 100%;
        order: 1;
    }

    .paste-btn {
        order: 2;
    }

    .format-btn {
        order: 3;
        flex: 1;
        justify-content: space-between;
    }

    .primary-btn {
        order: 4;
        width: 100%;
        justify-content: center;
    }

    .process-card {
        flex-direction: column;
        align-items: stretch;
    }

    .process-thumb-wrap {
        height: 160px;
    }

    /* Vertical Stepper on mobile (like reference) */
    .stepper-horizontal {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 28px 20px;
    }

    .stepper-track-line {
        top: 46px;
        bottom: 46px;
        left: 36px;
        right: auto;
        width: 2px;
        height: auto;
    }

    .stepper-col {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 18px;
    }

    .step-node-circle {
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .step-node-desc {
        margin: 0;
        max-width: none;
    }
}
