:root {
    --bg-base: #020617;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;

    --brand-primary: #8B5CF6;
    /* Purple/Violet theme for downloader */
    --brand-secondary: #EC4899;
    --brand-success: #10B981;
    --brand-error: #EF4444;

    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Animated Background Gradients */
.bg-gradient {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    z-index: 0;
    animation: drift 15s infinite ease-in-out alternate;
}

.bg-main {
    width: 300px;
    height: 300px;
    background: var(--brand-primary);
    top: -50px;
    right: -50px;
}

.bg-accent {
    width: 250px;
    height: 250px;
    background: var(--brand-secondary);
    bottom: -50px;
    left: -50px;
    animation-delay: -7s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(-30px, 30px) scale(1.1);
    }
}

/* App Wrapper */
.app-wrapper {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    position: relative;
    z-index: 10;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Header */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    border-radius: 100px;
    margin-bottom: 2rem;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-bg {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4);
}

.top-header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.version-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-secondary);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 2.5rem;
}

.hero-section h2 {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
}

.supported-platforms {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.platform-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.8rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

/* Downloader Card */
.downloader-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-container.focused {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.input-container.error {
    border-color: var(--brand-error);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.url-icon {
    padding: 0 0.75rem;
    color: var(--text-secondary);
    display: flex;
}

#video-url {
    background: transparent;
    border: none;
    color: var(--text-primary);
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    min-width: 0;
    padding: 0.5rem 0;
    /* Allow text selection in the input */
    user-select: auto;
}

#video-url::placeholder {
    color: #475569;
}

.clear-btn,
.paste-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.paste-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 0.25rem;
}

.paste-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.status-message {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0 0.5rem;
    color: var(--brand-error);
    margin-top: -0.5rem;
}

.glass-btn {
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.glass-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: #64748B;
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: not-allowed;
}

.glass-btn:not(:disabled):active {
    transform: scale(0.98);
}

.terms-text {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Result Section */
.result-card {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.success-icon-wrapper {
    width: 64px;
    height: 64px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-success);
    margin-bottom: 1rem;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.success-icon {
    width: 32px;
    height: 32px;
}

.result-card h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.video-preview {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-mockup {
    width: 60px;
    height: 60px;
    background: #1E293B;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.v-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.v-size {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.secondary-btn {
    width: 100%;
    padding: 1rem;
    background: var(--brand-success);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.secondary-btn:active {
    transform: scale(0.98);
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem;
}

/* Loading Overlay */
.glass-overlay {
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(12px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.sub-overlay-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Custom SVG Loader */
.processing-animation {
    width: 64px;
    height: 64px;
    margin-bottom: 1.5rem;
}

.circular {
    animation: rotate 2s linear infinite;
    height: 100%;
    transform-origin: center center;
    width: 100%;
}

.path {
    stroke-dasharray: 1, 200;
    stroke-dashoffset: 0;
    animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite;
    stroke-linecap: round;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 89, 200;
        stroke-dashoffset: -35px;
    }

    100% {
        stroke-dasharray: 89, 200;
        stroke-dashoffset: -124px;
    }
}

@keyframes color {

    100%,
    0% {
        stroke: var(--brand-primary);
    }

    40% {
        stroke: var(--brand-secondary);
    }

    66% {
        stroke: var(--brand-success);
    }
}