/* ═══════════════════════════════════════════════════
   k1.pt — Website Performance Tester
   Design: Speed — electric blue, sharp, technical
   ═══════════════════════════════════════════════════ */

:root {
    --bg: #080b12;
    --bg-surface: #0e1219;
    --bg-card: #131820;
    --bg-input: #0b0e16;
    --brd: rgba(255,255,255,0.06);
    --accent: #06b6d4;
    --accent-dark: #0891b2;
    --accent-glow: rgba(6, 182, 212, 0.12);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --error: #ef4444;
    --navy: #1e3a8a;
    --tx: #b8bdd0;
    --tx-bright: #e8ebf2;
    --tx-muted: #555b72;
    --heading: 'Outfit', sans-serif;
    --body: 'Outfit', sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="light"] {
    --bg: #f3f5f9;
    --bg-surface: #fff;
    --bg-card: #fff;
    --bg-input: #edf0f5;
    --brd: rgba(0,0,0,0.07);
    --accent-glow: rgba(6, 182, 212, 0.08);
    --success-glow: rgba(34, 197, 94, 0.08);
    --tx: #3a3f50;
    --tx-bright: #12151f;
    --tx-muted: #7d8299;
}

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

body {
    font-family: var(--body);
    background: var(--bg);
    color: var(--tx);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Navbar ─── */
.navbar {
    position: sticky; top: 0; z-index: 100; height: 62px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 clamp(1rem, 4vw, 2.5rem);
    background: rgba(8, 11, 18, 0.85);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--brd);
}
[data-theme="light"] .navbar { background: rgba(243, 245, 249, 0.9); }

.nav-left { display: flex; align-items: center; gap: 1rem; }
.nav-right { display: flex; align-items: center; gap: 0.5rem; }

.nav-logo { text-decoration: none; display: flex; align-items: center; gap: 8px; }
.nav-logo-img { height: 32px; width: auto; }
.nav-byline {
    font-size: 0.72rem; color: var(--tx-muted); text-decoration: none;
    font-weight: 400; opacity: 0.7; transition: all var(--transition);
}
.nav-byline:hover { color: var(--accent); opacity: 1; }
.nav-logo-k1 {
    font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
    color: var(--accent); letter-spacing: -0.03em;
}
.nav-logo-pt { font-family: var(--mono); font-size: 1.5rem; font-weight: 400; color: var(--tx-muted); }
.nav-tagline { font-size: 0.82rem; color: var(--tx-muted); }
.nav-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--success);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.nav-btn {
    background: transparent; border: 1px solid var(--brd); color: var(--tx-muted);
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-family: var(--body); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition); text-decoration: none;
}
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Main ─── */
.main-content {
    flex: 1; max-width: 900px; width: 100%;
    margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem);
}

/* ─── Hero / Input ─── */
.test-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.test-hero h1 {
    font-family: var(--heading); font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700; color: var(--tx-bright); margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.test-hero p {
    font-size: 1rem; color: var(--tx-muted); max-width: 500px;
    margin: 0 auto 2rem; line-height: 1.7;
}

.test-input-row {
    display: flex; gap: 8px; max-width: 640px; margin: 0 auto;
}

.test-input {
    flex: 1; padding: 16px 20px;
    background: var(--bg-card); border: 1px solid var(--brd);
    border-radius: var(--radius); color: var(--tx-bright);
    font-family: var(--mono); font-size: 1.05rem; outline: none;
    transition: border-color var(--transition);
}
.test-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.test-input::placeholder { color: var(--tx-muted); opacity: 0.5; }

.btn-test {
    padding: 16px 28px; background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius);
    font-family: var(--body); font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn-test:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-test:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-test .spinner { display: none; }
.btn-test.loading .spinner { display: inline-block; animation: spin 0.8s linear infinite; }
.btn-test.loading .btn-text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Error ─── */
.error-msg {
    display: none; max-width: 640px; margin: 1rem auto;
    background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-sm); padding: 12px 18px;
    color: var(--error); font-size: 0.95rem; text-align: center;
}
.error-msg.visible { display: block; }

/* ─── Results ─── */
.results { display: none; margin-top: 2rem; animation: fadeIn 0.4s ease; }
.results.visible { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* Grade card */
.grade-card {
    text-align: center; padding: 2.5rem;
    background: var(--bg-card); border: 1px solid var(--brd);
    border-radius: var(--radius); margin-bottom: 1.5rem;
    position: relative; overflow: hidden;
}
.grade-card::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 50% 30%, var(--accent-glow), var(--success-glow) 40%, transparent 70%);
    pointer-events: none;
}

.grade-letter {
    font-family: var(--mono); font-size: 5rem; font-weight: 700;
    line-height: 1; margin-bottom: 0.5rem; position: relative;
}
.grade-A { color: var(--success); }
.grade-B { color: #86efac; }
.grade-C { color: var(--warning); }
.grade-D { color: #fb923c; }
.grade-F { color: var(--error); }

.grade-score {
    font-family: var(--mono); font-size: 1.1rem; color: var(--tx-muted);
    position: relative;
}

.grade-url {
    font-family: var(--mono); font-size: 0.85rem; color: var(--tx-muted);
    margin-top: 0.5rem; word-break: break-all; position: relative;
}

/* Section cards */
.card {
    background: var(--bg-card); border: 1px solid var(--brd);
    border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem;
}
.card-header {
    padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--brd);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title {
    font-size: 0.85rem; font-weight: 600; color: var(--tx-bright);
    display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--accent); font-size: 0.85rem; }
.card-body { padding: 1.2rem; }

/* Timing bars */
.timing-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid var(--brd);
}
.timing-row:last-child { border-bottom: none; }
.timing-label { flex: 0 0 160px; font-size: 0.88rem; color: var(--tx-muted); }
.timing-bar-wrap { flex: 1; height: 6px; background: var(--brd); border-radius: 3px; overflow: hidden; }
.timing-bar {
    height: 100%; border-radius: 3px; transition: width 0.8s ease;
    background: linear-gradient(90deg, var(--success), var(--accent));
}
.timing-value { flex: 0 0 70px; text-align: right; font-family: var(--mono); font-size: 0.88rem; font-weight: 600; color: var(--tx-bright); }

/* Detail grid */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.detail-item {
    padding: 10px 14px; border-bottom: 1px solid var(--brd);
    display: flex; justify-content: space-between; align-items: center;
}
.detail-item:nth-child(odd) { border-right: 1px solid var(--brd); }
.detail-label { font-size: 0.85rem; color: var(--tx-muted); }
.detail-value { font-family: var(--mono); font-size: 0.88rem; font-weight: 500; color: var(--tx-bright); }

/* Status badges */
.badge { padding: 2px 10px; border-radius: 4px; font-size: 0.78rem; font-weight: 600; }
.badge-good { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-warn { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-bad { background: rgba(239,68,68,0.12); color: var(--error); }
.badge-info { background: var(--accent-glow); color: var(--accent); }

/* Issues / Positives lists */
.issue-list { list-style: none; padding: 0; }
.issue-item {
    padding: 10px 14px; border-bottom: 1px solid var(--brd);
    display: flex; gap: 10px; align-items: flex-start;
    font-size: 0.95rem; line-height: 1.6;
}
.issue-item:last-child { border-bottom: none; }
.issue-icon { flex-shrink: 0; margin-top: 3px; }

/* Asset list */
.asset-summary {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
    background: var(--brd); border-radius: var(--radius-sm); overflow: hidden;
    margin-bottom: 0.5rem;
}
.asset-stat {
    background: var(--bg-card); padding: 12px; text-align: center;
}
.asset-stat-num { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.asset-stat-label { font-size: 0.78rem; color: var(--tx-muted); }

/* Footer */
.site-footer {
    text-align: center; padding: 2rem; font-size: 0.82rem;
    color: var(--tx-muted); border-top: 1px solid var(--brd);
}
.site-footer a { color: var(--accent); text-decoration: none; }

/* ─── Login ─── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--tx-muted); margin-bottom: 0.4rem; }
.form-input {
    width: 100%; padding: 12px 16px; background: var(--bg-input);
    border: 1px solid var(--brd); border-radius: var(--radius-sm);
    color: var(--tx); font-family: var(--mono); font-size: 1rem; outline: none;
}
.form-input:focus { border-color: var(--accent); }
.btn-primary {
    width: 100%; padding: 14px; background: var(--accent); color: #fff;
    border: none; border-radius: var(--radius-sm);
    font-family: var(--body); font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { background: var(--accent-dark); }

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .test-input-row { flex-direction: column; }
    .btn-test { width: 100%; justify-content: center; }
    .timing-label { flex: 0 0 100px; font-size: 0.8rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-item:nth-child(odd) { border-right: none; }
    .asset-summary { grid-template-columns: 1fr; }
    .nav-byline { display: none; }
}
