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

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #f0fdf4;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #d1fae5;
    --shadow: 0 1px 3px 0 rgba(16, 185, 129, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(16, 185, 129, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 1.5rem;
}

.header-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin: 1.5rem 0;
    font-size: 1.1rem;
    flex-wrap: wrap;
}

.stat {
    opacity: 0.95;
}

.header-links {
    margin-top: 1.5rem;
}

.github-link {
    display: inline-block;
    background: white;
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.github-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

/* Control Panel */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.control-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s;
}

.control-group select:focus {
    outline: none;
    border-color: var(--primary);
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.primary-btn {
    background: var(--primary);
    color: white;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.secondary-btn {
    background: var(--secondary);
    color: white;
}

.secondary-btn:hover:not(:disabled) {
    background: #475569;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.status-text {
    font-weight: 600;
    color: var(--text);
}

.status-text.monitoring {
    color: var(--success);
}

.status-text.error {
    color: var(--danger);
}

.last-update {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Providers Grid */
.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.provider-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s;
}

.provider-card.testing {
    border-color: var(--info);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.provider-card.success {
    border-color: var(--success);
}

.provider-card.error {
    border-color: var(--danger);
}

.provider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.provider-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.provider-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--secondary);
}

.provider-status.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.provider-status.offline {
    background: var(--danger);
}

.latency-display {
    text-align: center;
    padding: 1.5rem 0;
    margin: 1rem 0;
    background: var(--bg);
    border-radius: 0.5rem;
}

.latency-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.latency-label {
    font-size: 0.9rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.provider-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: white;
    border-radius: 0.375rem;
    border: 1px solid var(--border);
}

.stat-label {
    color: var(--text-light);
}

.stat-value {
    font-weight: 600;
    color: var(--text);
}

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

.chart-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.chart-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    font-weight: 600;
}

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

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

/* Statistics Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--bg);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge.fast {
    background: #d1fae5;
    color: #065f46;
}

.badge.normal {
    background: #fef3c7;
    color: #92400e;
}

.badge.slow {
    background: #fecaca;
    color: #991b1b;
}

.badge.excellent {
    background: #d1fae5;
    color: #065f46;
}

.badge.good {
    background: #dbeafe;
    color: #1e40af;
}

.badge.poor {
    background: #fecaca;
    color: #991b1b;
}

/* Info Section */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border: 2px solid var(--border);
}

.info-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.info-card p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Privacy Section */
.privacy-list {
    list-style: none;
    padding: 0;
}

.privacy-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-light);
    line-height: 1.6;
}

.privacy-list li:last-child {
    border-bottom: none;
}

/* Related Tools */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    padding: 1.5rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s;
}

.tool-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.tool-card h3 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.tool-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.badge-container {
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .header-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    main {
        padding: 1rem;
    }

    section {
        padding: 1.5rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .providers-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.testing .provider-status {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.provider-card {
    animation: slideIn 0.3s ease-out;
}
