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

:root {
    --primary: #ec4899;
    --primary-dark: #db2777;
    --primary-light: #fce7f3;
    --bg: #f8f8fb;
    --bg-card: #ffffff;
    --bg-input: #f1f1f6;
    --border: #e2e2ec;
    --text: #111118;
    --text-muted: #6b7280;
    --text-dim: #9ca3af;
    --success: #16a34a;
    --error: #dc2626;
    --tiktok: #010101;
    --instagram: #e1306c;
    --facebook: #1877f2;
    --youtube: #ff0000;
    --twitter: #1da1f2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 2px 16px rgba(0,0,0,.08);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ─── Header ─── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(248,248,251,.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    overflow: visible;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.logo-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    /* Permite a logo "vazar" para fora do header sem aumentar o header */
    position: relative;
    margin: -30px 0;
}

.nav {
    display: flex;
    gap: 24px;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: .9rem;
    transition: color .2s;
}

.nav a:hover { color: var(--text); }

/* ─── Hero ─── */
.hero {
    padding: 48px 0 48px;
    text-align: center;
}

.hero h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 32px;
    color: var(--text);
}

/* ─── Search Box ─── */
.search-box {
    position: relative;
    max-width: 680px;
    margin: 0 auto 24px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    transition: border-color .2s, box-shadow .2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(236,72,153,.12);
}

.input-icon {
    margin-left: 10px;
    color: var(--text-dim);
    flex-shrink: 0;
    pointer-events: none;
}

#videoUrl {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    min-width: 0;
}

#videoUrl::placeholder { color: var(--text-dim); letter-spacing: 0; }

.paste-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    transition: background .2s, border-color .2s, color .2s;
    flex-shrink: 0;
    white-space: nowrap;
}

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

.paste-label {
    font-size: .85rem;
    font-weight: 500;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, transform .1s;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.search-submit {
    padding: 12px 14px;
    border-radius: 10px;
    flex-shrink: 0;
    width: auto;
    min-width: 44px;
}

@media (max-width: 480px) {
    .input-wrapper {
        padding: 5px;
        gap: 4px;
    }

    #videoUrl {
        font-size: .95rem;
        padding: 10px 6px;
    }

    .paste-btn {
        padding: 7px;
    }

    .search-submit {
        padding: 10px 12px;
    }

    .format-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px;
    }

    .format-item .format-info {
        width: 100%;
    }

    .format-item .btn-download {
        align-self: flex-end;
    }

    .btn-download {
        justify-content: center;
    }

    .format-info {
        width: 100%;
    }
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}

.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* ─── Platform Badges ─── */
.platforms-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 500;
    border: 1.5px solid;
}

.badge.tiktok    { color: #111; border-color: #ccc; background: #f5f5f5; }
.badge.instagram { color: #c2185b; border-color: #e1306c44; background: #fce4ec; }
.badge.facebook  { color: #1565c0; border-color: #1877f244; background: #e3f2fd; }
.badge.youtube   { color: #c62828; border-color: #ff000044; background: #ffebee; }
.badge.twitter   { color: #0277bd; border-color: #1da1f244; background: #e1f5fe; }

/* ─── Result / Loading / Error sections ─── */
.result-section,
.loading-section,
.error-section {
    margin-bottom: 40px;
}

/* ─── Result Card ─── */
.result-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.result-header {
    display: flex;
    gap: 20px;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.result-thumb {
    width: 140px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    background: var(--border);
}

.result-thumb-placeholder {
    width: 140px;
    height: 90px;
    border-radius: var(--radius-sm);
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-meta { flex: 1; min-width: 0; }

.result-platform {
    display: inline-block;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--primary);
    margin-bottom: 6px;
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-info {
    display: flex;
    gap: 16px;
    font-size: .82rem;
    color: var(--text-muted);
}

/* ─── Format List ─── */
.formats-section { padding: 20px 24px; }

.formats-section h3 {
    font-size: .85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-dim);
    margin-bottom: 14px;
}

.format-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .2s;
    gap: 12px;
}

.format-item:hover { border-color: var(--primary); }

.format-item.enhance {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-color: #c4b5fd;
    border-radius: 16px;
}

.format-item.enhance:hover { border-color: #a78bfa; }

.format-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.format-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.format-icon.video { background: rgba(99,102,241,.15); color: var(--primary); }
.format-icon.audio { background: rgba(34,197,94,.15); color: var(--success); }

.format-label {
    font-size: .9rem;
    font-weight: 500;
}

.format-size {
    font-size: .78rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.btn-download {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
    flex-shrink: 0;
}

.btn-download:hover { background: var(--primary-dark); }
.btn-download:disabled { opacity: .5; cursor: not-allowed; }

.btn-download.downloading {
    background: var(--primary-dark);
    pointer-events: none;
}

/* ─── Loading ─── */
.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    box-shadow: var(--shadow);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Error ─── */
.error-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    background: var(--bg-card);
    border: 1.5px solid #dc262633;
    border-radius: var(--radius);
    text-align: center;
    color: var(--text-muted);
    box-shadow: var(--shadow);
}

/* ─── How To ─── */
.how-to {
    padding: 80px 0;
    border-top: 1px solid var(--border);
}

.how-to h2,
.platforms-section h2 {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 48px;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.step {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-align: center;
    transition: border-color .2s, transform .2s;
    position: relative;
    z-index: 0;
}

.step:hover {
    border-color: var(--primary);
    transform: scale(1.04);
    z-index: 1;
}

.step-number {
    width: 44px;
    height: 44px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 auto 16px;
}

.step-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.step-icon svg { stroke: currentColor; }
.step h3 { font-size: 1rem; margin-bottom: 8px; }
.step p  { font-size: .88rem; color: var(--text-muted); }

/* ─── Platforms Section ─── */
.platforms-section {
    padding: 80px 0;
    border-top: 1px solid var(--border);
}

.platforms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.platform-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    text-align: center;
    transition: border-color .2s, transform .2s;
    position: relative;
    z-index: 0;
}

.platform-card:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    z-index: 1;
}

.platform-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.tiktok-icon    { background: #111; }
.instagram-icon { background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.facebook-icon  { background: #1877f2; }
.youtube-icon   { background: #ff0000; }

.platform-card h3 { font-size: 1rem; margin-bottom: 10px; }

.platform-card ul {
    list-style: none;
    font-size: .82rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.platform-card ul li::before {
    content: '✓ ';
    color: var(--success);
}

/* ─── Footer ─── */
.footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    text-align: center;
    color: var(--text-dim);
    font-size: .85rem;
}

/* ─── Progress bar ─── */
.download-progress {
    margin-top: 16px;
    padding: 0 24px 20px;
}

.progress-bar-wrap {
    background: var(--border);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
    transition: width .3s;
    width: 0%;
}

.progress-label {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-size: .9rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    z-index: 999;
    animation: slideIn .3s ease;
    max-width: 320px;
    color: var(--text);
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--error); color: var(--error); }

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

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .container { padding: 0 16px; }

    /* Header */
    .header { padding: 8px 0; }
    .header .container { justify-content: center; }
    .logo-img { width: 72px; height: 72px; margin: 0; }
    .nav { display: none; }

    /* Hero */
    .hero { padding: 32px 0 32px; }

    /* Search */
    .search-box { flex-direction: column; gap: 10px; }
    .btn-primary { justify-content: center; padding: 14px; }
    .search-submit { width: auto; min-width: 44px; }

    /* Badges */
    .platforms-badges { gap: 6px; }
    .badge { font-size: .75rem; padding: 4px 10px; }

    /* Result card */
    .result-header { flex-direction: column; gap: 14px; padding: 16px; }
    .result-thumb { width: 100%; height: 200px; }
    .result-thumb-placeholder { width: 100%; height: 200px; }
    .result-meta { width: 100%; }
    .result-title { font-size: .95rem; }

    /* Formats */
    .formats-section { padding: 14px 16px; }
    .format-item { padding: 10px 12px; gap: 8px; }
    .format-label { font-size: .85rem; }
    .btn-download { padding: 8px 12px; font-size: .8rem; }

    /* How to */
    .how-to { padding: 48px 0; }
    .how-to h2, .platforms-section h2 { font-size: 1.4rem; margin-bottom: 28px; }
    .steps { grid-template-columns: 1fr; gap: 14px; }
    .step { padding: 20px 16px; }

    /* Platforms grid */
    .platforms-section { padding: 48px 0; }
    .platforms-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .platform-card { padding: 18px 14px; }
    .platform-icon { width: 44px; height: 44px; border-radius: 10px; }

    /* Loading / Error */
    .loading-card, .error-card { padding: 32px 16px; }

    /* Toast */
    .toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }

    /* Progress */
    .download-progress { padding: 0 16px 16px; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-6px); }
    30%, 70% { transform: translateX(6px); }
}

.shake {
    animation: shake .5s cubic-bezier(.36,.07,.19,.97) both;
}

@media (max-width: 400px) {
    .platforms-grid { grid-template-columns: 1fr; }
    .logo-img { width: 60px; height: 60px; margin: 0; }
}
