@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(124, 77, 255, 0.5);
    --text-primary: #f0f0f5;
    --text-secondary: #8888aa;
    --accent: #7c4dff;
    --accent-light: #a47aff;
    --accent-glow: rgba(124, 77, 255, 0.3);
    --success: #00e676;
    --success-glow: rgba(0, 230, 118, 0.25);
    --error: #ff5252;
    --gradient-1: linear-gradient(135deg, #7c4dff 0%, #448aff 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 600px at 20% 30%, rgba(124, 77, 255, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 80% 70%, rgba(68, 138, 255, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(0, 230, 118, 0.03) 0%, transparent 70%);
    animation: bgPulse 8s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes bgPulse {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0;
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0);
    }

    10% {
        opacity: 0.6;
    }

    90% {
        opacity: 0.2;
    }

    100% {
        opacity: 0;
        transform: translateY(-10vh) scale(1);
    }
}

.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 580px;
    padding: 20px;
    margin: 20px 0;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    width: 52px;
    height: 52px;
    background: var(--gradient-1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 8px 30px var(--accent-glow);
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.lang-picker {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.lang-btn.active {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.header h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.header p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 4px;
}

/* Section titles */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 20px 0 10px;
    padding-left: 2px;
}

.section-title:first-child {
    margin-top: 0;
}

/* Picker grid */
.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.url-picker-grid {
    width: 100%;
    margin-top: 10px;
}

.url-picker-grid .picker-card {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    text-align: left;
}

.url-zone {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed var(--border);
    border-radius: 16px;
    background: rgba(15, 15, 20, 0.4);
    cursor: text;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 100%;
    /* Stretch horizontally fully */
    margin: 0 auto;
}

.picker-card {
    display: flex;
    /* width: 100%; */
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    color: var(--text-primary);
}

.picker-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(124, 77, 255, 0.15);
}


.picker-card-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.picker-card-desc {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
}

/* Hidden / visible transitions */
#pickerSection {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#pickerSection.hidden {
    display: none;
}

.step2 {
    display: none;
}

.step2.visible {
    display: block;
    animation: slideUp 0.3s ease;
}

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(124, 77, 255, 0.08);
}

/* Chosen mode bar */
.chosen-mode {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-active);
    border-radius: 14px;
    margin-bottom: 16px;
}

.chosen-mode-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
}

.chosen-from {
    color: var(--accent-light);
}

.chosen-arrow {
    color: var(--text-secondary);
    font-size: 14px;
}

.chosen-to {
    color: var(--success);
}

.chosen-change {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chosen-change:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

/* Upload Zone */
.upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.merge-zones {
    display: none;
    /* Hidden by default, shown via JS */
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.merge-zones.visible {
    display: grid;
}

.upload-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 20px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    overflow: hidden;
    flex: 1;
}

.upload-zone.small {
    padding: 24px 14px;
}

.upload-zone.small .upload-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
    margin-bottom: 10px;
}

.upload-zone.small .upload-title {
    font-size: 14px;
}

.upload-zone.small .upload-subtitle {
    font-size: 11px;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-1);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 18px;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(124, 77, 255, 0.12);
}

.upload-zone:hover::before,
.upload-zone.drag-over::before {
    opacity: 0.04;
}

.upload-zone.drag-over {
    border-color: var(--accent-light);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(124, 77, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    transition: transform 0.3s ease;
}

.upload-zone:hover .upload-icon {
    transform: scale(1.1);
}

.upload-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
}

.upload-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

input[type="file"] {
    display: none;
}

/* URL Zone */
.url-zone {
    display: none;
    position: relative;
    border: 2px solid var(--border);
    border-radius: 24px;
    padding: 40px 30px;
    text-align: center;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    overflow: hidden;
    width: 100%;
    /* Stretch horizontally */
    margin: 0 auto;
}

.url-zone.visible {
    display: flex;
    flex-direction: column;
}

.url-zone .upload-title {
    color: var(--text-secondary);
    /* Darken title as requested */
    font-size: 18px;
}

.url-zone .upload-subtitle {
    color: rgba(255, 255, 255, 0.3);
    /* Darken subtitle as requested */
}

.url-input {
    width: 100%;
    margin-top: 20px;
    padding: 16px 20px;
    background: rgba(5, 5, 8, 0.8);
    /* Darker background */
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.url-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(233, 69, 96, 0.2);
}

.url-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    /* Much darker placeholder text */
}

.url-options {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.url-select {
    flex: 1;
    padding: 12px 16px;
    background: rgba(10, 10, 15, 0.4);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
}

.url-select:hover {
    border-color: var(--accent-light);
}

.url-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.15);
}

.url-select option {
    background: var(--bg-main);
    color: var(--text-main);
}

/* File Info */
.file-info {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-top: 10px;
    backdrop-filter: blur(20px);
}

.file-info.visible {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(124, 77, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.file-remove {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.file-remove:hover {
    background: rgba(255, 82, 82, 0.1);
    border-color: var(--error);
    color: var(--error);
}

/* Format Selector */
.format-selector {
    display: none;
    margin-top: 16px;
    animation: slideUp 0.3s ease;
}

.format-selector.visible {
    display: block;
}

.format-selector-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.format-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.format-opt {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.format-opt:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(124, 77, 255, 0.06);
}

.format-opt.active {
    background: var(--gradient-1);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* Convert Button */
.convert-btn {
    display: none;
    width: 100%;
    padding: 16px;
    margin-top: 16px;
    border: none;
    border-radius: 14px;
    background: var(--gradient-1);
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 24px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.convert-btn.visible {
    display: block;
    animation: slideUp 0.3s ease;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 36px var(--accent-glow);
}

.convert-btn:active:not(:disabled) {
    transform: translateY(0);
}

.convert-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.convert-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.convert-btn:hover:not(:disabled)::after {
    left: 100%;
}

/* Progress */
.progress-section {
    display: none;
    margin-top: 16px;
    animation: slideUp 0.3s ease;
}

.progress-section.visible {
    display: block;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-label {
    font-size: 14px;
    font-weight: 600;
}

.progress-percent {
    font-size: 14px;
    color: var(--accent-light);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 100px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-1);
    border-radius: 100px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    text-align: center;
}

.progress-details {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent-light);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    min-height: 18px;
    letter-spacing: 0.3px;
}

/* Result */
.result-section {
    display: none;
    margin-top: 16px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid rgba(0, 230, 118, 0.2);
    border-radius: 16px;
    text-align: center;
    backdrop-filter: blur(20px);
    animation: slideUp 0.4s ease;
}

.result-section.visible {
    display: block;
}

.result-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--success-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    animation: successPop 0.5s ease;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.result-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.result-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #00c853 0%, #00e676 100%);
    color: #0a1a0a;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px var(--success-glow);
    text-decoration: none;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--success-glow);
}

.convert-another {
    display: block;
    margin-top: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

.convert-another:hover {
    color: var(--text-primary);
}

/* Error */
.error-message {
    display: none;
    margin-top: 16px;
    padding: 14px 18px;
    background: rgba(255, 82, 82, 0.08);
    border: 1px solid rgba(255, 82, 82, 0.3);
    border-radius: 14px;
    color: var(--error);
    font-size: 14px;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.error-message.visible {
    display: block;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    opacity: 0.5;
    z-index: 1;
}

/* Main Layout with Side Ads */
.main-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.side-ad-container {
    flex: 1;
    min-width: 160px;
    max-width: 250px;
    position: sticky;
    top: 20px;
    height: auto;
    display: flex;
    flex-direction: column;
}

.vertical-ad {
    min-height: 600px;
    height: calc(100vh - 100px);
    margin: 0;
    border-style: solid;
}

/* Advertisement Slots */
.ad-slot,
.side-ad-container {
    display: none !important;
    /* Hidden until needed */
}

.ad-slot {
    width: 100%;
    min-height: 90px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border);
    border-radius: 16px;
    margin: 24px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    overflow: hidden;
}

.ad-slot:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--accent-light);
}

.top-ad {
    margin-top: 0;
    margin-bottom: 30px;
}

.mid-ad {
    margin: 20px 0;
}

.bottom-ad {
    margin-top: 40px;
    margin-bottom: 20px;
    border-style: solid;
}

.ad-placeholder {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
}

/* Response Section Refinements */
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border);
    margin-top: 12px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-lg {
    width: 100%;
    padding: 18px;
    font-size: 18px;
}

/* Responsive */
@media (max-width: 1000px) {
    .side-ad-container {
        display: none;
    }

    .main-wrapper {
        padding: 10px;
    }
}

@media (max-width: 600px) {
    .header-top {
        flex-direction: column;
        gap: 15px;
    }

    .container {
        padding: 15px;
    }

    .header h1 {
        font-size: 24px;
    }

    .upload-zone {
        padding: 32px 18px;
    }

    .picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .format-categories {
        flex-direction: column;
    }

    .format-cat {
        max-width: none;
    }
}