:root {
    --bg: #0a0a0a;
    --card-bg: #161616;
    --text: #ffffff;
    --text-muted: #a0a0a0;
    --primary: #00ff9d;
    /* Neon Green */
    --primary-glow: rgba(0, 255, 157, 0.4);
    --danger: #ff4b4b;
    --warning: #ffb700;
    --success: #00ff9d;
    --font: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

h1,
h2,
h3 {
    font-weight: 800;
}

/* HEADER */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 span {
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
}

header p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* HIDDEN UTILITY */
.hidden {
    display: none !important;
}

/* SEARCH SECTION */
.input-group {
    display: flex;
    gap: 10px;
}

input[type="url"] {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid #333;
    padding: 1rem;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="url"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

button {
    background: var(--primary);
    color: #000;
    font-weight: 700;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.1s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* LOADING */
#loading-section {
    text-align: center;
    padding: 6rem 0;
}

.loader {
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto 1.5rem auto;
    position: relative;
}

.loader .bar {
    width: 0%;
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
    transition: width 0.5s ease-out;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.steps {
    /* Optional: Hide steps if we use dynamic text */
    display: none;
}

/* BENTO GRID LAYOUT */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto;
    gap: 1rem;
    margin-bottom: 3rem;
}

.card {
    background: rgba(22, 22, 22, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* 1. HERO CARD (Spannt über 2 Spalten) */
.card-hero {
    grid-column: span 2;
    background: linear-gradient(145deg, rgba(22, 22, 22, 0.8), rgba(10, 10, 10, 0.9));
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
}

.grade-big {
    font-size: 5rem;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 40px var(--primary-glow);
    line-height: 1;
}

.hero-content h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.hero-content p {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* 2. COMPARISON CARD (Spannt über 2 Spalten) */
.card-comparison {
    grid-column: span 2;
    background: linear-gradient(145deg, #1a1a1a, #111);
    align-items: center;
    text-align: center;
}

.card-comparison h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.comparison-badge {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin: 0.5rem 0;
}

.comparison-badge span {
    color: var(--primary);
}

.sub-text {
    font-size: 0.8rem;
    color: #666;
}

/* 3. METRIC CARDS (Je 1 Spalte) */
.card-metric {
    grid-column: span 1;
    text-align: center;
    min-height: 150px;
}

.card-metric h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.card-metric .value {
    font-size: 2rem;
    font-weight: 800;
    margin: 0.5rem 0;
}

.card-metric .sub {
    font-size: 0.75rem;
    color: #666;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .card-hero,
    .card-comparison,
    .card-metric {
        grid-column: span 1;
    }
}

/* HERO CARD */
.hero-card {
    background: linear-gradient(135deg, rgba(20, 20, 30, 0.6) 0%, rgba(30, 30, 40, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.hero-details {
    flex: 1;
}

.hero-summary {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.badge-comparison {
    display: inline-block;
    background: rgba(12, 206, 107, 0.15);
    color: #0cce6b;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.circular-chart-big {
    max-width: 120px;
    max-height: 120px;
    transform: rotate(-90deg);
    /* Start at top */
}

.percentage-big {
    fill: var(--text-color);
    font-family: sans-serif;
    font-weight: bold;
    font-size: 0.7em;
    /* Relative to SVG viewBox 36 */
    text-anchor: middle;
}

@media (max-width: 600px) {
    .hero-card {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
}

/* METRICS GRID (Reuse for Lighthouse & Custom) */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 40px;
    width: 100%;
}

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

.section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-color);
    opacity: 0.8;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

/* Metric Card Style */
.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 5px;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.metric-sub {
    font-size: 0.75rem;
    color: #666;
    margin-top: 5px;
}

/* Lighthouse Gauge specific override if needed, but metric-card works too */
.lh-gauge-text {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Lighthouse Grid */
.lighthouse-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
}

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

.lh-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

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

.lh-gauge {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    position: relative;
    border-radius: 50%;
    /* Gauge logic via JS conic-gradient or SVG, simpler: text */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
}

/* Helper classes for gauge coloring (JS will apply border/color) */
.lh-score-good {
    color: #0cce6b;
    border: 3px solid #0cce6b;
}

/* >= 90 */
.lh-score-avg {
    color: #ffa400;
    border: 3px solid #ffa400;
}

/* 50-89 */
.lh-score-bad {
    color: #ff4e42;
    border: 3px solid #ff4e42;
}

/* < 50 */

.lh-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Results Section */
.results-container {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

/* DETAILS & LISTS */
.issue-item {
    background: rgba(30, 30, 30, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.issue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.issue-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.impact-badge {
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.impact-badge.kritisch {
    background: var(--danger);
    color: #fff;
}

.impact-badge.hoch {
    background: var(--warning);
    color: #000;
}

.impact-badge.mittel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.impact-badge.niedrig {
    background: rgba(255, 255, 255, 0.05);
    color: #666;
}

.issue-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.advice-box {
    background: rgba(0, 255, 157, 0.05);
    border-left: 3px solid var(--primary);
    padding: 10px 15px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-radius: 0 8px 8px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.learn-more-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
    margin-left: auto;
    /* Push to the right if space allows */
}

.learn-more-link:hover {
    border-bottom-color: var(--primary);
    opacity: 0.8;
}

.advice-label {
    color: var(--primary);
    font-weight: bold;
    margin-right: 5px;
}

/* DETAILS TOGGLE */
.details-wrapper {
    margin-top: 1rem;
}

.details-list {
    margin-top: 0.8rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.detail-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-url {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary);
    opacity: 0.8;
    word-break: break-all;
    margin-bottom: 4px;
}

.detail-metric {
    font-size: 0.85rem;
    color: #fff;
}

.detail-selector {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 5px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #eee;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-explanation {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 5px;
}

.detail-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-weight: 600;
}

.detail-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: var(--primary);
}

.passed-list-compact {
    background: rgba(0, 255, 157, 0.02);
    border: 1px solid rgba(0, 255, 157, 0.05);
    border-radius: 12px;
    padding: 10px 15px;
}

/* TECH STACK */
.tech-stack-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tech-badge {
    background: rgba(30, 30, 30, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.tech-badge:hover {
    background: rgba(40, 40, 40, 0.8);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.tech-badge .tech-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: 0.5px;
    opacity: 0.8;
}