/* ================================================================
   VibeCheck — Premium Dark UI
   ================================================================ */

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

:root {
    /* Palette — dark purple / violet */
    --bg-primary: #09090b;
    --bg-secondary: #111114;
    --bg-card: #16161a;
    --bg-card-hover: #1c1c22;
    --bg-elevated: rgba(255, 255, 255, 0.04);
    --bg-glass: rgba(22, 22, 26, 0.75);

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(139, 92, 246, 0.35);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-accent: #c4b5fd;

    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.25);
    --accent-gradient: linear-gradient(135deg, #8b5cf6, #6366f1, #3b82f6);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --orange: #f97316;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px var(--accent-glow);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-default: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-light);
}

/* ── Animated Background Particles ──────────────────────────────── */
.bg-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0;
    animation: float-particle linear infinite;
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 0.15;
    }

    90% {
        opacity: 0.15;
    }

    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* ── Header ─────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    background: rgba(9, 9, 11, 0.8);
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.logo-icon {
    font-size: 1.4rem;
}

.header-nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

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

/* ── Hero Section ───────────────────────────────────────────────── */
main {
    flex: 1;
    position: relative;
    z-index: 1;
}

.hero {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 24px 60px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-accent);
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-full);
    margin-bottom: 28px;
    letter-spacing: 0.02em;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 18px;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto 40px;
}

/* ── URL Form ───────────────────────────────────────────────────── */
.url-form {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 6px 6px 6px 18px;
    transition: border-color var(--transition-default), box-shadow var(--transition-default);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.input-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
    margin-right: 12px;
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 12px 0;
    min-width: 0;
}

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

.analyze-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    min-width: 110px;
}

.analyze-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

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

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

.spinner {
    animation: spin 1s linear infinite;
}

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

.input-hint {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Loading Section ────────────────────────────────────────────── */
.loading-section {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    text-align: center;
}

.scanner-animation {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 32px;
}

.scanner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
}

.ring-1 {
    border-top-color: var(--accent);
    animation: spin 2s linear infinite;
}

.ring-2 {
    inset: 12px;
    border-right-color: var(--accent-light);
    animation: spin 2.5s linear infinite reverse;
}

.ring-3 {
    inset: 24px;
    border-bottom-color: #6366f1;
    animation: spin 3s linear infinite;
}

.scanner-core {
    position: absolute;
    inset: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
    animation: pulse-core 2s ease-in-out infinite;
}

@keyframes pulse-core {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.9);
    }
}

.loading-text {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    max-width: 320px;
    margin: 0 auto;
}

.loading-steps .step {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-left: 24px;
    position: relative;
    transition: color var(--transition-default);
}

.loading-steps .step::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--border-default);
    transition: background var(--transition-default), border-color var(--transition-default);
}

.loading-steps .step.active {
    color: var(--text-accent);
}

.loading-steps .step.active::before {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.loading-steps .step.done {
    color: var(--success);
}

.loading-steps .step.done::before {
    background: var(--success);
    border-color: var(--success);
}

/* ── Results Section ────────────────────────────────────────────── */
.results-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 24px 80px;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.results-header {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.results-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, var(--accent-glow), transparent 70%);
    pointer-events: none;
}

.score-gauge-container {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.score-gauge {
    position: relative;
    width: 160px;
    height: 160px;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--bg-elevated);
    stroke-width: 8;
}

.gauge-fill {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-number {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    font-family: var(--font-mono);
}

.score-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.verdict-container {
    position: relative;
    z-index: 1;
}

.verdict-emoji {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.verdict-text {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.verdict-url {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    word-break: break-all;
}

.scan-stats {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    letter-spacing: 0.01em;
}

/* ── Category Cards ─────────────────────────────────────────────── */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--transition-default), transform var(--transition-default);
    cursor: default;
}

.category-card:hover {
    border-color: var(--border-default);
    transform: translateY(-2px);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.category-icon {
    font-size: 1.1rem;
}

.category-score {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
}

.category-score.score-low {
    color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.category-score.score-medium {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.category-score.score-high {
    color: var(--orange);
    background: rgba(249, 115, 22, 0.1);
}

.category-score.score-critical {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Progress bar */
.category-progress {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    margin-bottom: 16px;
    overflow: hidden;
}

.category-progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0;
}

.category-progress-fill.fill-low {
    background: var(--success);
}

.category-progress-fill.fill-medium {
    background: var(--warning);
}

.category-progress-fill.fill-high {
    background: var(--orange);
}

.category-progress-fill.fill-critical {
    background: var(--danger);
}

/* Findings list */
.findings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.finding-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.finding-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.finding-badge.tier-definitive {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.finding-badge.tier-strong {
    color: #f97316;
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.25);
}

.finding-badge.tier-moderate {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.finding-badge.tier-weak {
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
}

.finding-points {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-accent);
    min-width: 28px;
    text-align: right;
}

.no-findings {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 0;
}

/* ── Evidence Summary ──────────────────────────────────────────── */
.evidence-summary {
    margin-bottom: 28px;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
}

.evidence-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.evidence-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.evidence-tiers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.evidence-tier-card {
    padding: 16px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    text-align: center;
}

.tier-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.tier-icon {
    font-size: 1rem;
}

.tier-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.tier-count {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 2px;
}

.tier-detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.tier-points {
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.tier-capped {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 400;
}

@media (max-width: 640px) {
    .evidence-tiers {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Try Another ────────────────────────────────────────────────── */
.try-another {
    text-align: center;
    padding-top: 12px;
}

.try-another-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.try-another-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

/* ── Error Section ──────────────────────────────────────────────── */
.error-section {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.error-card {
    text-align: center;
    padding: 48px 32px;
    background: var(--bg-card);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-xl);
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.error-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.error-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero {
        padding: 48px 16px 40px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .input-wrapper {
        flex-direction: column;
        padding: 8px;
        gap: 8px;
    }

    .input-icon {
        display: none;
    }

    .input-wrapper input {
        width: 100%;
        padding: 12px;
    }

    .analyze-btn {
        width: 100%;
        justify-content: center;
    }

    .results-header {
        flex-direction: column;
        gap: 24px;
        padding: 32px 24px;
        text-align: center;
    }

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