/* v4 site styles moved out of index-v4.html */
:root {
    --bg-primary: #1a1b1e;
    --bg-secondary: #27282b;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --accent-primary: #3f83f8;
    --accent-secondary: #1a56db;
    --success: #31c48d;
    --warning: #f6ad55;
    --error: #f98080;
    --info: #60a5fa;
    --baseline-color: #60a5fa;
    --download-color: #f59e0b;
    --upload-color: #a78bfa;
}

html {
    height: 100%;
}

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
}

.header-bar {
    background-color: var(--bg-secondary);
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.card {
    background-color: var(--bg-secondary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.08);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.test-button {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 2rem auto;
    padding: 1rem;
    font-size: 1.25rem;
    font-weight: bold;
    text-align: center;
    border-radius: 0.5rem;
    background-color: var(--accent-primary);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.test-button:hover:not(:disabled) {
    background-color: var(--accent-secondary);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.test-button:disabled {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Phase Stepper */
.stepper-container {
    margin: 2rem 0;
}

.stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    z-index: 1;
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.step-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    transition: color 0.3s ease;
}

.step.active .step-icon {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(63, 131, 248, 0.2);
}

.step.active .step-label {
    color: var(--text-primary);
    font-weight: 600;
}

.step.completed .step-icon {
    background-color: var(--success);
    border-color: var(--success);
}

.step.completed .step-icon::after {
    content: '✓';
    color: white;
}

.step-connector {
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.1);
    z-index: -1;
}

.step:last-child .step-connector {
    display: none;
}

.step.completed .step-connector {
    background-color: var(--success);
}

/* Progress and Live latency */
.progress-container {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--success));
    width: 0%;
    transition: width 0.3s ease;
}

.live-latency {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
}

.live-latency-header {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.live-latency-chart {
    height: 60px;
    width: 100%;
}

/* Map */
#server-map {
    height: 300px;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
}

/* Cloudflare-like markers: server (orange) and user (blue) */
.cf-marker-icon {
    line-height: 0;
    /* remove whitespace */
    display: inline-block;
    transform: translateY(0);
    /* avoid baseline shifts */
    pointer-events: auto;
    /* allow clicking popups */
}

.cf-marker-icon svg {
    display: block;
    height: auto;
}

.cf-server-marker svg {
    width: 40px;
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.cf-user-marker svg {
    width: 24px;
    height: 24px;
    color: var(--baseline-color);
    /* fill uses currentColor */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.cf-marker-icon {
    transition: transform 0.12s cubic-bezier(.4, 0, .2, 1);
}

.cf-marker-icon:hover {
    transform: translateY(-2px) scale(1.06);
}

/* Info grid and metrics */
.connection-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem
}

.info-card {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1)
}

.info-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem
}

.info-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary)
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem
}

.metric-card {
    background-color: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 120px
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    margin: 0.5rem 0;
    color: var(--accent-primary)
}

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

/* Charts */
.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 2rem
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary)
}

.chart-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem
}

.toggle-btn {
    padding: .5rem 1rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: .375rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s ease;
    font-size: .875rem;
    font-weight: 500
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2)
}

.toggle-btn.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white
}

.section-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 0 1rem 0;
    color: var(--text-primary)
}

.hidden {
    display: none
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1)
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem
}

.footer-link {
    color: var(--text-secondary);
    transition: color .2s ease;
    font-size: .875rem;
    text-decoration: none
}

.copyright {
    text-align: center;
    color: var(--text-secondary);
    font-size: .875rem
}

/* Responsive */
@media (max-width:768px) {
    .stepper {
        overflow-x: auto;
        padding-bottom: 1rem
    }

    .step {
        min-width: 80px
    }

    .step-label {
        font-size: .65rem
    }

    .step-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem
    }

    .chart-container {
        height: 300px
    }
}

/* Matching DNS's link color for inline links in notes and other content */
.linkcolor {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.linkcolor:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}