/* ============================================================
   TIKTOK DOWNLOADER - PREMIUM UI
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #050810;
    --bg-main: #0a0f1b;
    --bg-card: #0f1420;
    --bg-light: #151b2b;
    --accent-1: #00e8c6;
    --accent-2: #00d4a3;
    --accent-3: #00bf8f;
    --text-white: #ffffff;
    --text-light: #e4e9f1;
    --text-gray: #9ca3af;
    --text-muted: #6b7280;
    --border: rgba(0, 232, 198, 0.1);
    --border-hover: rgba(0, 232, 198, 0.25);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-main) 50%, #0a0d15 100%);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
}

/* ── Animated Background ── */
.bg-effect {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 10% 90%, rgba(0, 232, 198, 0.12), transparent 40%),
        radial-gradient(circle at 90% 10%, rgba(0, 191, 143, 0.08), transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(0, 212, 170, 0.04), transparent 60%);
}

.bg-effect::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(0, 232, 198, 0.02), transparent 80%);
    animation: pulse-slow 8s ease-in-out infinite;
}

.bg-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 232, 198, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: drift 20s linear infinite;
}

@keyframes pulse-slow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 232, 198, 0.03);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
    border-radius: 10px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}

.app {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.container {
    background: linear-gradient(135deg, rgba(15, 20, 32, 0.8) 0%, rgba(21, 27, 43, 0.6) 100%);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: 40px;
    padding: 60px 50px;
    animation: fadeInScale 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 0 60px rgba(0, 232, 198, 0.08),
        0 30px 100px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 232, 198, 0.03), transparent);
    pointer-events: none;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ── Header ── */
.header {
    margin-bottom: 50px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 16px;
    animation: slideDown 0.8s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo-icon {
    width: 70px;
    height: 70px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(0, 232, 198, 0.15), rgba(0, 212, 170, 0.05));
    border: 1.5px solid var(--border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--accent-1);
    box-shadow:
        0 0 30px rgba(0, 232, 198, 0.2),
        inset 0 1px 20px rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-12px);
    }
}

.logo-icon:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow:
        0 0 50px rgba(0, 232, 198, 0.35),
        inset 0 1px 20px rgba(255, 255, 255, 0.15);
}

.logo h1 {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-white), var(--accent-1));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.logo h1 span {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    opacity: 0.8;
}

/* ── Input Section ── */
.input-section {
    margin-bottom: 40px;
    position: relative;
    z-index: 2;
}

.input-box {
    display: flex;
    align-items: center;
    gap: 0;
    background: linear-gradient(135deg, rgba(0, 232, 198, 0.04), rgba(0, 212, 170, 0.02));
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 6px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 20px rgba(0, 232, 198, 0.05);
}

.input-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0, 232, 198, 0.1), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.input-box:focus-within::before {
    opacity: 1;
}

.input-box:focus-within {
    border-color: var(--border-hover);
    background: linear-gradient(135deg, rgba(0, 232, 198, 0.08), rgba(0, 212, 170, 0.04));
    box-shadow:
        inset 0 1px 20px rgba(0, 232, 198, 0.1),
        0 0 40px rgba(0, 232, 198, 0.15);
}

.input-icon {
    padding: 0 18px;
    color: var(--text-gray);
    font-size: 18px;
    transition: all 0.3s ease;
}

.input-box:focus-within .input-icon {
    color: var(--accent-1);
    transform: scale(1.1);
}

.input-box input {
    flex: 1;
    padding: 18px 14px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 15px;
    font-weight: 500;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.input-box input::placeholder {
    color: rgba(155, 163, 175, 0.5);
    font-weight: 400;
}

.input-box button {
    padding: 16px 40px;
    background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 100%);
    color: var(--bg-dark);
    font-weight: 800;
    font-size: 14px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    box-shadow:
        0 10px 40px rgba(0, 232, 198, 0.3),
        inset 0 1px 20px rgba(255, 255, 255, 0.2);
    position: relative;
    margin-right: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
}

.input-box button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 16px;
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.input-box button:hover {
    transform: translateY(-4px);
    box-shadow:
        0 15px 60px rgba(0, 232, 198, 0.4),
        inset 0 1px 20px rgba(255, 255, 255, 0.3);
}

.input-box button:hover::before {
    transform: translateX(100%);
}

.input-box button:active {
    transform: translateY(-2px) scale(0.98);
}

.input-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 6px;
}

.input-hint i {
    color: var(--accent-1);
    font-size: 12px;
}

/* ── Result ── */
#result {
    margin-top: 30px;
    min-height: 60px;
    position: relative;
    z-index: 2;
}

.loading {
    text-align: center;
    color: var(--text-gray);
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading i {
    animation: spinSmooth 1.5s ease-in-out infinite;
    color: var(--accent-1);
    font-size: 32px;
}

@keyframes spinSmooth {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border: 1.5px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 18px 22px;
    border-radius: 18px;
    font-size: 14px;
    text-align: center;
    animation: shakeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.15);
}

@keyframes shakeIn {
    0% {
        opacity: 0;
        transform: translateY(-10px) scaleX(0.95);
    }
    50% {
        transform: translateY(0) scaleX(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scaleX(1);
    }
}

.result-card {
    background: linear-gradient(135deg, rgba(15, 20, 32, 0.8), rgba(21, 27, 43, 0.5));
    border-radius: 28px;
    overflow: hidden;
    border: 1.5px solid var(--border);
    animation: popIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 0 50px rgba(0, 232, 198, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-card:hover {
    border-color: var(--border-hover);
    box-shadow:
        0 0 80px rgba(0, 232, 198, 0.2),
        0 30px 80px rgba(0, 0, 0, 0.4);
    transform: translateY(-8px);
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.result-card .thumbnail {
    width: 100%;
    max-height: 450px;
    object-fit: cover;
    display: block;
    background: var(--bg-light);
    position: relative;
}

.result-card .thumbnail::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

.result-card .info {
    padding: 28px 30px 32px;
}

.result-card .title {
    font-size: 17px;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
    color: var(--text-white);
    line-height: 1.4;
    letter-spacing: -0.3px;
}

.result-card .author {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-card .author i {
    color: var(--accent-1);
    font-size: 12px;
}

.result-card .stats {
    display: flex;
    gap: 22px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.result-card .stats i {
    margin-right: 6px;
    color: var(--accent-1);
    font-size: 11px;
}

.download-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.download-links a {
    flex: 1;
    min-width: 130px;
    padding: 14px 24px;
    text-align: center;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: var(--bg-dark);
    font-weight: 800;
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow:
        0 8px 28px rgba(0, 232, 198, 0.28),
        inset 0 1px 15px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.download-links a:hover {
    transform: translateY(-4px);
    box-shadow:
        0 12px 40px rgba(0, 232, 198, 0.4),
        inset 0 1px 15px rgba(255, 255, 255, 0.3);
}

.download-links a.audio {
    background: linear-gradient(135deg, rgba(155, 163, 175, 0.4), rgba(155, 163, 175, 0.2));
    color: var(--text-light);
    border: 1.5px solid rgba(155, 163, 175, 0.3);
}

.download-links a.audio:hover {
    background: linear-gradient(135deg, rgba(155, 163, 175, 0.6), rgba(155, 163, 175, 0.4));
    border-color: rgba(155, 163, 175, 0.5);
}

/* ── Features ── */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 44px;
    padding-top: 36px;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 2;
}

.feature-item {
    text-align: center;
    padding: 20px 14px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(0, 232, 198, 0.05), rgba(0, 212, 170, 0.02));
    border: 1.5px solid rgba(0, 232, 198, 0.08);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.feature-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(0, 232, 198, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.feature-item:hover::before {
    opacity: 1;
}

.feature-item:hover {
    border-color: var(--border-hover);
    background: linear-gradient(135deg, rgba(0, 232, 198, 0.12), rgba(0, 212, 170, 0.06));
    transform: translateY(-6px);
    box-shadow: 0 12px 35px rgba(0, 232, 198, 0.12);
}

.feature-item i {
    font-size: 24px;
    color: var(--accent-1);
    display: block;
    margin-bottom: 8px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feature-item:hover i {
    transform: scale(1.25) rotate(-10deg);
}

.feature-item span {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    display: block;
    letter-spacing: 0.3px;
}

.feature-item small {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Footer ── */
.footer {
    margin-top: 44px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 13px;
    color: var(--text-muted);
    position: relative;
    z-index: 2;
}

.footer strong {
    color: var(--text-gray);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.footer-links a::before {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    transition: width 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent-1);
    transform: translateY(-2px);
}

.footer-links a:hover::before {
    width: 100%;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .container {
        padding: 40px 32px;
        border-radius: 32px;
    }

    .logo h1 {
        font-size: 32px;
    }

    .logo-icon {
        width: 60px;
        height: 60px;
        font-size: 32px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 32px 24px;
        border-radius: 28px;
    }

    .logo {
        flex-direction: column;
        gap: 12px;
    }

    .logo h1 {
        font-size: 28px;
    }

    .logo-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    .input-box {
        flex-wrap: wrap;
        background: rgba(0, 232, 198, 0.02);
        border: 1.5px solid rgba(0, 232, 198, 0.12);
        padding: 0;
    }

    .input-box input {
        width: 100%;
        padding: 14px 16px;
        background: rgba(255, 255, 255, 0.02);
        border-radius: 12px;
        order: 2;
    }

    .input-icon {
        display: none;
    }

    .input-box button {
        width: 100%;
        justify-content: center;
        padding: 14px;
        margin: 0;
        order: 1;
        border-radius: 12px;
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .feature-item {
        padding: 16px 12px;
        border-radius: 16px;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 24px 18px;
        border-radius: 24px;
    }

    .logo h1 {
        font-size: 24px;
    }

    .logo-icon {
        width: 50px;
        height: 50px;
        font-size: 26px;
    }

    .header {
        margin-bottom: 32px;
    }

    .download-links a {
        min-width: 100%;
        font-size: 12px;
        padding: 12px 16px;
    }

    .features {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .feature-item {
        padding: 14px 10px;
        font-size: 10px;
    }

    .result-card .thumbnail {
        max-height: 300px;
    }

    .input-box button {
        font-size: 12px;
    }
}
