@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
    --bg-base:       #07080f;
    --bg-card:       #0e1020;
    --bg-card2:      #141628;
    --bg-input:      #1a1d35;
    --border:        #2a2e50;
    --border-light:  #3a3f6e;

    --accent:        #7c5cfc;
    --accent-2:      #c050f0;
    --accent-glow:   rgba(124,92,252,0.35);
    --accent-light:  #a880ff;

    --green:         #22d3a0;
    --yellow:        #f5c842;
    --red:           #f05050;
    --blue:          #4a9eff;

    --text-primary:  #f0f2ff;
    --text-secondary:#9da3cc;
    --text-muted:    #5a6080;

    --radius-sm:     8px;
    --radius-md:     14px;
    --radius-lg:     20px;
    --radius-xl:     28px;

    --shadow-card:   0 4px 32px rgba(0,0,0,0.5);
    --shadow-glow:   0 0 40px rgba(124,92,252,0.25);
    --transition:    0.22s cubic-bezier(0.4,0,0.2,1);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ─── Animated background ───────────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124,92,252,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(192,80,240,0.10) 0%, transparent 60%);
    pointer-events: none;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative; z-index: 1;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
    text-align: center;
    padding: 56px 20px 40px;
}

.header .logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.header .logo-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    box-shadow: var(--shadow-glow);
}

.header .logo-text {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-light), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header h1 {
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 400;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* ─── Step indicator ─────────────────────────────────────────────────────── */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
}

.step-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
}

.step-pill.active {
    background: linear-gradient(135deg, rgba(124,92,252,0.2), rgba(192,80,240,0.2));
    color: var(--accent-light);
    border: 1px solid rgba(124,92,252,0.4);
}

.step-pill.done {
    color: var(--green);
}

.step-pill .step-num {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--bg-card2);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    border: 1.5px solid var(--border);
}

.step-pill.active .step-num {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: white;
}

.step-pill.done .step-num {
    background: var(--green);
    border-color: transparent;
    color: #0a2018;
}

.step-connector {
    width: 32px;
    height: 1px;
    background: var(--border);
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    transition: var(--transition);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ─── Inputs ─────────────────────────────────────────────────────────────── */
.input-group {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.input-field {
    flex: 1;
    min-width: 200px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 15px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
    resize: none;
}

.input-field::placeholder { color: var(--text-muted); }

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.input-field { min-height: 80px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: 0 4px 20px rgba(124,92,252,0.45);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(124,92,252,0.6);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}

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

.btn-ghost {
    background: transparent;
    color: var(--accent-light);
    border: 1.5px solid rgba(124,92,252,0.3);
    padding: 8px 16px;
    font-size: 13px;
}

.btn-ghost:hover {
    background: rgba(124,92,252,0.1);
    border-color: var(--accent);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ─── Duration selector ─────────────────────────────────────────────────── */
.duration-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.duration-btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

.duration-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.duration-btn.active {
    background: linear-gradient(135deg, rgba(124,92,252,0.25), rgba(192,80,240,0.25));
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ─── Platform selector ──────────────────────────────────────────────────── */
.platform-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.platform-btn {
    padding: 8px 16px;
    border-radius: 99px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.platform-btn.active {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(124,92,252,0.15);
}

/* ─── Search results ─────────────────────────────────────────────────────── */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    background: var(--bg-card2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
}

.result-item:hover {
    border-color: var(--accent);
    background: rgba(124,92,252,0.07);
    transform: translateX(4px);
}

.result-item.selected {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(124,92,252,0.12), rgba(192,80,240,0.08));
    box-shadow: 0 0 0 1px var(--accent);
}

.result-num {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.result-item.selected .result-num {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: white;
}

.result-info { min-width: 0; }

.result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-source {
    font-size: 12px;
    color: var(--text-muted);
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.platform-badge.youtube  { color: #ff4444; border-color: rgba(255,68,68,0.3); background: rgba(255,68,68,0.1); }
.platform-badge.tiktok   { color: #00f0b0; border-color: rgba(0,240,176,0.3); background: rgba(0,240,176,0.08); }
.platform-badge.facebook { color: #4a9eff; border-color: rgba(74,158,255,0.3); background: rgba(74,158,255,0.08); }
.platform-badge.twitter, .platform-badge.x { color: #e0e0e0; border-color: rgba(224,224,224,0.3); background: rgba(224,224,224,0.06); }
.platform-badge.news     { color: var(--yellow); border-color: rgba(245,200,66,0.3); background: rgba(245,200,66,0.06); }
.platform-badge.web      { color: var(--text-secondary); }

.virality-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.score-circle {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 800;
    border: 2px solid;
    position: relative;
}

.score-circle.high   { color: var(--green);  border-color: var(--green);  background: rgba(34,211,160,0.1); }
.score-circle.medium { color: var(--yellow); border-color: var(--yellow); background: rgba(245,200,66,0.1); }
.score-circle.low    { color: var(--red);    border-color: var(--red);    background: rgba(240,80,80,0.1); }

.score-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }

/* ─── Output Package ─────────────────────────────────────────────────────── */
.output-section { margin-top: 12px; }

.output-block {
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 22px;
    margin-bottom: 14px;
    position: relative;
}

.output-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.output-block-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.output-block-content {
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

.copy-btn.copied {
    color: var(--green);
    border-color: var(--green);
}

/* Virality Score grande */
.virality-display {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.virality-big-score {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
}

.virality-bar-wrap {
    flex: 1;
    min-width: 120px;
}

.virality-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-input);
    overflow: hidden;
    margin-bottom: 6px;
}

.virality-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

/* Hashtags */
.hashtags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hashtag-pill {
    padding: 5px 12px;
    border-radius: 99px;
    background: rgba(124,92,252,0.12);
    border: 1px solid rgba(124,92,252,0.3);
    color: var(--accent-light);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.hashtag-pill:hover {
    background: rgba(124,92,252,0.25);
}

/* Script duration badge */
.script-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.meta-badge {
    padding: 4px 12px;
    border-radius: 99px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.meta-badge.highlight {
    background: rgba(34,211,160,0.1);
    border-color: rgba(34,211,160,0.3);
    color: var(--green);
}

/* ─── Loading ─────────────────────────────────────────────────────────────── */
.loading-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 48px 20px;
    text-align: center;
}

.loading-overlay.visible { display: flex; }

.spinner {
    width: 48px; height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.loading-step { display: flex; align-items: center; gap: 8px; }
.loading-step.active { color: var(--accent-light); }
.loading-step.done   { color: var(--green); }

/* ─── Section visibility ─────────────────────────────────────────────────── */
.section { display: none; }
.section.visible { display: block; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-error {
    background: rgba(240,80,80,0.1);
    border: 1px solid rgba(240,80,80,0.3);
    color: #ff8080;
}

.alert-info {
    background: rgba(74,158,255,0.1);
    border: 1px solid rgba(74,158,255,0.3);
    color: #80c0ff;
}

/* ─── Label ─────────────────────────────────────────────────────────────── */
.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-group { margin-bottom: 20px; }

/* ─── Divider ─────────────────────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .card { padding: 20px 16px; }
    .result-item { grid-template-columns: auto 1fr; }
    .virality-score { display: none; }
    .input-group { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
    .steps-indicator { gap: 4px; }
    .step-connector { width: 16px; }
}

/* ─── Search Source Selector ─────────────────────────────────────────────── */
.search-source-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.source-option {
    cursor: pointer;
}

.source-option input[type="radio"] {
    display: none;
}

.source-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.source-pill:hover {
    border-color: var(--border-light);
}

.source-option input[type="radio"]:checked + .source-pill {
    border-color: var(--accent);
    background: rgba(124,92,252,0.12);
    box-shadow: 0 0 0 1px var(--accent);
}

.source-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.source-pill strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.source-pill small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}

.source-option input[type="radio"]:checked + .source-pill strong {
    color: var(--accent-light);
}

/* ─── Styles Carousel ────────────────────────────────────────────────────── */
.styles-carousel-wrap {
    position: relative;
}

.styles-carousel-track-outer {
    overflow: hidden;
    border-radius: var(--radius-md);
}

.styles-gallery {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 4px 2px 8px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.styles-gallery::-webkit-scrollbar { display: none; }

.styles-carousel-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
}

.carousel-arrow {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
}

.carousel-arrow:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: rgba(124,92,252,0.1);
}

.carousel-dots {
    display: flex;
    gap: 6px;
}

.carousel-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.carousel-dot.active {
    background: var(--accent);
    width: 18px;
    border-radius: 3px;
}

.style-card {
    flex: 0 0 170px;
    scroll-snap-align: start;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card2);
    position: relative;
}

.style-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(124,92,252,0.25);
}

.style-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 8px 24px rgba(124,92,252,0.3);
}

.style-card-img {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    position: relative;
}

.style-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.style-card:hover .style-card-img img {
    transform: scale(1.05);
}

.style-card-overlay {
    position: absolute; inset: 0;
    background: rgba(124,92,252,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
    backdrop-filter: blur(2px);
}

.style-card.selected .style-card-overlay { opacity: 1; }

.style-selected-badge {
    color: white;
    font-size: 12px;
    font-weight: 700;
    background: var(--accent);
    padding: 3px 10px;
    border-radius: 99px;
}

.style-card-img-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(
        45deg,
        var(--bg-input),
        var(--bg-input) 8px,
        var(--bg-card2) 8px,
        var(--bg-card2) 16px
    );
    aspect-ratio: 16/9;
}

.style-card-info { padding: 8px 10px; }

.style-card-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.style-card-tagline {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .style-card { flex: 0 0 145px; }
}


/* ─── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Selection ─────────────────────────────────────────────────────────── */
::selection { background: var(--accent-glow); color: var(--accent-light); }
