/* Web Vitals Checker — styles.css — Neon Pink palette */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #0d0b15;
    --bg2: #13112a;
    --bg3: #1a1836;
    --border: rgba(232, 67, 147, 0.12);
    --border2: rgba(255, 255, 255, 0.05);
    --text: #f2f0fb;
    --text2: #9e9bc5;
    --text3: #4e4c72;
    --primary: #E84393;
    --primary2: #FD79A8;
    --green: #00b894;
    --yellow: #fdcb6e;
    --red: #ff7675;
    --radius: 12px;
    --t: all 0.2s ease;
}

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

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

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 60% 40% at 20% 5%, rgba(232, 67, 147, 0.08), transparent), radial-gradient(ellipse 40% 30% at 80% 80%, rgba(253, 121, 168, 0.05), transparent);
    z-index: 0;
}

/* Header */
header {
    background: rgba(13, 11, 21, 0.9);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 0 18px rgba(232, 67, 147, 0.4);
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
}

.brand-sub {
    font-size: 10px;
    color: var(--text3);
}

h1.brand-title {
    display: inline;
}

.device-toggle {
    display: flex;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.device-btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    transition: var(--t);
}

.device-btn.active {
    background: var(--primary);
    color: #fff;
}

/* URL Section */
.url-section {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    position: relative;
    z-index: 10;
}

.url-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.url-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.url-icon {
    font-size: 16px;
}

.url-input {
    flex: 1;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: var(--t);
}

.url-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(232, 67, 147, 0.1);
}

.url-input::placeholder {
    color: var(--text3);
}

.url-hint {
    font-size: 11px;
    color: var(--text3);
    margin-top: 6px;
}

.last-url {
    color: var(--primary2);
    font-family: 'JetBrains Mono', monospace;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t);
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--primary);
    color: var(--primary2);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.btn-primary:hover {
    background: #c0356d;
    border-color: #c0356d;
    color: #fff;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 7px;
}

.btn-danger {
    border-color: rgba(255, 118, 117, 0.3);
    color: var(--red);
}

.btn-danger:hover {
    background: rgba(255, 118, 117, 0.1);
    border-color: var(--red);
}

/* Cards */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text2);
}

.card-body {
    padding: 14px 16px;
}

/* Main */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* Overview Row */
.overview-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.perf-grade {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    min-width: 160px;
}

.grade-ring {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.grade-ring svg {
    position: absolute;
    inset: 0;
}

#grade-arc {
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

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

.grade-letter {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
}

.grade-score {
    font-size: 12px;
    color: var(--text3);
}

.grade-label {
    font-size: 11px;
    color: var(--text2);
    text-align: center;
}

.vitals-row {
    display: flex;
    flex: 1;
    gap: 10px;
    flex-wrap: wrap;
}

.vital-card {
    padding: 14px;
    flex: 1;
    min-width: 130px;
    cursor: default;
    transition: var(--t);
}

.vital-card:hover {
    border-color: rgba(232, 67, 147, 0.35);
}

.vital-metric {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 2px;
}

.vital-name {
    font-size: 10px;
    color: var(--text3);
    margin-bottom: 8px;
    min-height: 28px;
    line-height: 1.3;
}

.vital-value {
    font-size: 24px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    margin-bottom: 8px;
    transition: var(--t);
}

.vital-bar-wrap {
    height: 4px;
    background: var(--bg3);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.vital-bar {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transition: width 0.8s ease;
}

.vital-status {
    font-size: 10px;
    font-weight: 700;
}

/* Status colors */
.good {
    color: var(--green);
}

.warn {
    color: var(--yellow);
}

.poor {
    color: var(--red);
}

.bar-good {
    background: var(--green);
}

.bar-warn {
    background: var(--yellow);
}

.bar-poor {
    background: var(--red);
}

/* Lower row */
.lower-row {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 14px;
}

.suggestions-card,
.history-card {
    display: flex;
    flex-direction: column;
}

/* Suggestions */
.suggestion-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border2);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.suggestion-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.suggestion-desc {
    font-size: 11px;
    color: var(--text2);
    line-height: 1.5;
    margin-top: 2px;
}

.suggestion-impact {
    font-size: 10px;
    font-weight: 700;
    margin-top: 3px;
}

.impact-high {
    color: var(--red);
}

.impact-med {
    color: var(--yellow);
}

.impact-low {
    color: var(--green);
}

/* History */
.history-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border2);
    cursor: pointer;
    transition: var(--t);
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-item:hover {
    background: var(--bg3);
}

.history-item:last-child {
    border-bottom: none;
}

.history-grade {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.history-url {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary2);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-device {
    font-size: 10px;
    color: var(--text3);
}

/* Ref table */
.ref-card {}

.ref-table-wrap {
    overflow-x: auto;
}

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.ref-table th {
    background: var(--bg3);
    padding: 8px 14px;
    text-align: left;
    color: var(--text2);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border2);
}

.ref-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border2);
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
}

.ref-table td:first-child {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.ref-table tr:last-child td {
    border-bottom: none;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 11, 21, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.loading-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

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

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

.loading-text {
    font-size: 14px;
    font-weight: 600;
}

.loading-sub {
    font-size: 11px;
    color: var(--text3);
}

/* Empty state */
.empty-state {
    padding: 24px;
    text-align: center;
    color: var(--text3);
    font-size: 12px;
}

/* Toast */
.toast-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.toast {
    background: var(--bg2);
    border: 1px solid rgba(232, 67, 147, 0.3);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 12px;
    color: var(--text);
    transform: translateX(20px);
    opacity: 0;
    transition: all 0.22s ease;
    pointer-events: all;
}

.toast.show {
    transform: none;
    opacity: 1;
}

::-webkit-scrollbar {
    width: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: rgba(232, 67, 147, 0.2);
    border-radius: 3px
}

@media(max-width:768px) {
    .lower-row {
        grid-template-columns: 1fr;
    }

    .vitals-row {
        flex-direction: column;
    }

    .overview-row {
        flex-direction: column;
    }
}