/* ════ TOKENS ════ */
:root {
    --bg: #0a0a0a;
    --card: #121212;
    --card2: #1a1a1a;
    --feature-bg: #161616;
    --tiktok-red: #FE2C55;
    --tiktok-red-h: #e62548;
    --text: #ffffff;
    --dim: #8a8a8a;
    --border: #262626;
    --primary: #FE2C55;
}

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

html,
body {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ════ OVERLAYS ════ */
#loadingOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}

#authOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(254, 44, 85, 0.15);
    border-left-color: var(--tiktok-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ════ AUTH CARD ════ */
.auth-card {
    background: var(--card);
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
    margin: 1rem;
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.auth-tab {
    cursor: pointer;
    color: var(--dim);
    font-weight: 600;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.auth-tab.active {
    color: var(--tiktok-red);
    border-bottom-color: var(--tiktok-red);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dim);
    font-size: 0.9rem;
}

input[type=text],
input[type=email],
input[type=password],
input[type=number] {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    background: #000;
    border: 1px solid var(--border);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

input:focus {
    border-color: var(--tiktok-red);
}

/* ════ BUTTONS ════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.25rem;
    border-radius: 0.6rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-family: inherit;
}

.btn-primary {
    background: var(--tiktok-red);
    color: #fff;
}

.btn-primary:hover {
    background: var(--tiktok-red-h);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: var(--card2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--border);
}

.btn-dl {
    background: #166534;
    color: #fff;
}

.btn-dl:hover {
    background: #15803d;
}

/* ════ TOAST ════ */
#toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--card);
    color: var(--text);
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ════ LANDING VIEW ════ */
#landingView {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.bg-icon {
    position: absolute;
    font-size: 15rem;
    color: rgba(254, 44, 85, 0.05);
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.bg-1 {
    top: 10%;
    left: -5%;
    transform: rotate(-15deg);
}

.bg-2 {
    top: 30%;
    right: -5%;
    transform: rotate(15deg);
}

.landing-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    z-index: 1;
}

.navbar {
    padding: 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tiktok-red);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.hero {
    text-align: center;
    padding: 5rem 0 4rem;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--tiktok-red);
    background: none;
    -webkit-text-fill-color: unset;
}

.hero p {
    font-size: 1.2rem;
    color: var(--dim);
    max-width: 600px;
    margin: 0 auto;
}

.features-container {
    background: var(--card);
    border-radius: 2rem;
    padding: 4rem 3rem;
    margin-bottom: 4rem;
    border: 1px solid var(--border);
}

.features-title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 3.5rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--feature-bg);
    padding: 1.5rem;
    border-radius: 1rem;
    transition: transform 0.2s ease;
}

.feature-item:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.feature-item i {
    font-size: 1.5rem;
    color: var(--tiktok-red);
    min-width: 2.5rem;
    text-align: center;
}

.feature-item span {
    font-weight: 600;
    font-size: 0.95rem;
}

.pricing-card-landing {
    background: var(--card);
    border: 2px solid var(--tiktok-red);
    border-radius: 2rem;
    padding: 3.5rem;
    text-align: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 5rem;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.price-tag {
    font-size: 5rem;
    font-weight: 800;
    margin: 1rem 0;
}

.price-tag span {
    font-size: 1.25rem;
    color: var(--dim);
}

.btn-landing {
    width: 100%;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    border-radius: 0.75rem;
    font-weight: 700;
}

/* ════ TOOL VIEW ════ */
#toolView {
    display: none;
    min-height: 100vh;
    flex-direction: column;
}

#toolHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tool-logo {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--tiktok-red);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

#toolUserBadge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--dim);
}

#toolUserEmail {
    font-weight: 600;
    color: var(--text);
}

#toolTierBadge {
    display: inline-flex;
}

.tool-body {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.tool-title {
    margin-bottom: 2rem;
}

.tool-title h1 {
    font-size: 2rem;
    font-weight: 800;
    background: none;
    -webkit-text-fill-color: unset;
    color: var(--text);
}

.tool-title p {
    color: var(--dim);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.tool-card {
    background: var(--card);
    border-radius: 1rem;
    padding: 2rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.chip {
    font-size: 0.8rem;
    background: #0f0f0f;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.3rem 0.7rem;
    color: var(--dim);
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.25rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-item input[type=checkbox] {
    width: auto;
}

.coming-soon-tag {
    font-size: 0.7rem;
    background: #1e3a5f;
    color: #60a5fa;
    border-radius: 0.3rem;
    padding: 0.1rem 0.4rem;
    margin-left: 0.25rem;
}

.btn-launch {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 0.6rem;
    font-weight: 700;
    background: var(--tiktok-red);
    color: #fff;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-launch:hover {
    background: var(--tiktok-red-h);
    transform: translateY(-1px);
}

.btn-launch:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#resultsCard {
    display: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.badge-pending {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-running {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-done {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-failed {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-cancelled {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.progress-wrap {
    margin: 1rem 0;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--tiktok-red);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--tiktok-red);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--dim);
    margin-top: 0.25rem;
}

.history-item {
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.history-item:hover {
    border-color: var(--tiktok-red);
}

.history-item .hi-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.history-item .hi-meta {
    font-size: 0.8rem;
    color: var(--dim);
    margin-top: 0.2rem;
}

.history-item .hi-status {
    font-size: 0.8rem;
    font-weight: 700;
}

/* ════ PAYWALL CARD ════ */
.paywall-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 3rem 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.paywall-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(254, 44, 85, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.paywall-lock {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    display: block;
    filter: drop-shadow(0 0 16px rgba(254, 44, 85, 0.4));
}

.paywall-card h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.paywall-card p {
    color: var(--dim);
    font-size: 1rem;
    max-width: 420px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.paywall-features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.paywall-feature-chip {
    background: rgba(254, 44, 85, 0.08);
    border: 1px solid rgba(254, 44, 85, 0.2);
    border-radius: 2rem;
    padding: 0.35rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--tiktok-red);
}

.btn-upgrade {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 2.5rem;
    background: var(--tiktok-red);
    color: #fff;
    border: none;
    border-radius: 0.7rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-upgrade:hover {
    background: var(--tiktok-red-h);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(254, 44, 85, 0.3);
}

/* ════ TIER BADGE ════ */
.tier-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tier-free {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.tier-pro {
    background: rgba(254, 44, 85, 0.12);
    color: var(--tiktok-red);
    border: 1px solid rgba(254, 44, 85, 0.35);
}

.tier-lifetime {
    background: rgba(234, 179, 8, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

/* ════ macOS JOB DOCK ════ */
#jobDock {
    position: fixed;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0.6rem;
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 2rem;
    z-index: 1000;
    pointer-events: none;
    min-width: 68px;
    transition: opacity 0.3s;
}

#jobDock:empty {
    opacity: 0;
    pointer-events: none;
}

#jobDock:not(:empty) {
    opacity: 1;
}

.dock-bubble {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: bubblePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bubblePop {
    from {
        transform: scale(0) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.dock-bubble:hover {
    transform: scale(1.18) translateY(-6px);
}

.dock-bubble .bubble-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--card2);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    position: relative;
}

.dock-bubble.running::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(var(--tiktok-red) 0%, #ff6b8a 40%, transparent 60%);
    animation: spin 1.1s linear infinite;
    z-index: -1;
}

.dock-bubble.running .bubble-inner {
    border-color: transparent;
}

.dock-bubble.completed .bubble-inner {
    border-color: #22c55e;
    box-shadow: 0 0 14px #22c55e88;
}

.dock-bubble.failed .bubble-inner {
    border-color: #ef4444;
    animation: redpulse 1.4s ease infinite;
}

@keyframes redpulse {

    0%,
    100% {
        box-shadow: 0 0 8px #ef444488;
    }

    50% {
        box-shadow: 0 0 20px #ef4444cc;
    }
}

.dock-bubble.pending .bubble-inner {
    border-color: #ca8a04;
}

.bubble-tooltip {
    position: absolute;
    right: 62px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    white-space: nowrap;
    color: var(--text);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    font-family: inherit;
}

.dock-bubble:hover .bubble-tooltip {
    opacity: 1;
}

/* ════ RESPONSIVE ════ */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }

    .bg-icon {
        display: none;
    }

    .features-container {
        padding: 2.5rem 1.5rem;
    }

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

    .pricing-card-landing {
        padding: 2.5rem 1.5rem;
    }

    #toolHeader {
        padding: 0.8rem 1rem;
    }

    .tool-title h1 {
        font-size: 1.5rem;
    }

    .tool-body {
        padding: 1rem;
        padding-bottom: 6rem;
        /* Space for bottom dock */
    }

    #toolUserEmail {
        display: none;
        /* Hide email on mobile to save space */
    }

    #toolUserBadge {
        gap: 0.5rem;
    }

    /* Reposition Dock to Bottom Center on Mobile */
    #jobDock {
        top: auto;
        bottom: 1.5rem;
        right: 50%;
        transform: translateX(50%);
        flex-direction: row;
        /* Horizontal dock */
        padding: 0.6rem 1rem;
        min-width: unset;
        width: auto;
        max-width: 90vw;
        border-radius: 3rem;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    }

    .dock-bubble {
        width: 48px;
        height: 48px;
    }

    .bubble-tooltip {
        display: none;
        /* Tooltips are for hover/desktop */
    }
}