/* ============================================================
   🚀 INTERNET SPEED TEST - STYLES
   Toolkitfox.com
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f4f7f6;
    --card-bg: #ffffff;
    --text: #333;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --header-bg: #1f2937;
    --nav-bg: #111827;
    --accent: #ea580c;
    --accent-dark: #c2410c;
    --accent-light: #fff7ed;
    --blue: #2563eb;
    --green: #059669;
    --red: #dc2626;
    --yellow: #f59e0b;
    --shadow: 0 2px 15px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --bg: #0f172a;
    --card-bg: #1e293b;
    --text: #cbd5e1;
    --text-dark: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --header-bg: #020617;
    --nav-bg: #020617;
    --accent-light: #422006;
    --shadow: 0 2px 15px rgba(0,0,0,0.3);
}

body {
    font-family: Arial, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
}

.top-nav {
    background: var(--nav-bg);
    padding: 12px 20px;
    text-align: center;
    border-bottom: 1px solid #374151;
    position: relative;
}
.top-nav a {
    color: #e5e7eb;
    margin: 0 14px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
    display: inline-block;
    padding: 4px 0;
}
.top-nav a:hover { color: var(--accent); }
.theme-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 16px;
    padding: 6px 10px;
    border-radius: 50%;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover { background: rgba(255,255,255,0.25); }
@media (max-width: 600px) {
    .top-nav a { margin: 0 6px; font-size: 12px; }
    .theme-toggle { right: 8px; width: 30px; height: 30px; font-size: 13px; }
}

header {
    background: var(--header-bg);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: center;
}
.header-inner {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: white;
}
.header-text h1 { margin: 0; font-size: 22px; font-weight: 800; }
.header-text h1 span { color: var(--accent); }
.header-text p { margin: 2px 0 0 0; font-size: 11px; color: #9ca3af; }

.container {
    max-width: 900px;
    margin: 40px auto;
    padding: 30px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.gauge-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.gauge {
    position: relative;
    width: 400px;
    max-width: 100%;
    text-align: center;
}

.gauge-svg {
    width: 100%;
    height: auto;
    display: block;
}

.gauge-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 12;
    stroke-linecap: round;
}

.gauge-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 12;
    stroke-linecap: round;
    stroke-dasharray: 251.3;
    stroke-dashoffset: 251.3;
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s;
}

.gauge-progress.green { stroke: var(--green); }
.gauge-progress.yellow { stroke: var(--yellow); }
.gauge-progress.red { stroke: var(--red); }

.gauge-value {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 56px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    font-family: 'Courier New', monospace;
}

.gauge-label {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gauge-status {
    position: absolute;
    bottom: -45px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-top: 60px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.stat-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.15);
    transform: translateY(-3px);
}

.stat-card.done {
    border-color: var(--green);
    background: rgba(5, 150, 105, 0.08);
}

.stat-icon {
    font-size: 28px;
    margin-bottom: 10px;
    display: block;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
    transition: color 0.3s;
}

.stat-unit {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--border);
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #f97316);
    transition: width 0.3s;
}

.start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 30px;
    padding: 18px 30px;
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(234, 88, 12, 0.3);
    font-family: inherit;
}

.start-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(234, 88, 12, 0.4);
}

.start-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    box-shadow: none;
}

.start-btn .start-icon {
    font-size: 22px;
}

.start-btn.testing .start-icon {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 20px;
    padding: 18px;
    background: var(--bg);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.info-label {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.info-value {
    color: var(--text-dark);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-message {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    display: none;
    animation: fadeIn 0.5s;
}

.result-message.show { display: block; }

.result-message.excellent {
    background: rgba(5, 150, 105, 0.1);
    color: var(--green);
    border-left: 4px solid var(--green);
}

.result-message.good {
    background: rgba(37, 99, 235, 0.1);
    color: var(--blue);
    border-left: 4px solid var(--blue);
}

.result-message.average {
    background: rgba(245, 158, 11, 0.1);
    color: var(--yellow);
    border-left: 4px solid var(--yellow);
}

.result-message.slow {
    background: rgba(220, 38, 38, 0.1);
    color: var(--red);
    border-left: 4px solid var(--red);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.faq-section {
    max-width: 900px;
    margin: 40px auto;
    padding: 25px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.faq-section h2 {
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 25px;
}

.faq-item {
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
    font-size: 16px;
    color: var(--text-dark);
    margin: 0 0 8px 0;
}

.faq-item p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.7;
    margin: 0;
}

.faq-item ul {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.7;
    padding-left: 22px;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

footer a { color: var(--blue); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

@media (max-width: 600px) {
    .container {
        padding: 20px 15px;
        margin: 20px 10px;
    }
    .gauge-value { font-size: 42px; }
    .gauge-status { font-size: 12px; bottom: -40px; }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        margin-top: 50px;
    }
    .stat-value { font-size: 24px; }
    .stat-icon { font-size: 22px; }
    .start-btn {
        padding: 15px 20px;
        font-size: 16px;
    }
    .info-panel { grid-template-columns: 1fr; }
    .header-text h1 { font-size: 18px; }
    .header-inner svg { width: 40px; height: 40px; }
}