/* =========================================
   1. VARIÁVEIS E RESET GERAL
   ========================================= */
:root {
    /* Paleta de Cores Corporativa Dark */
    --bg-dark: #0d1117;       /* Fundo da página */
    --bg-card: #161b22;       /* Fundo dos cards */
    --bg-header: rgba(13, 17, 23, 0.9);
    
    /* Cores de Destaque */
    --accent: #1178ff;        /* Azul principal */
    --accent-hover: #3a8eff;
    --text-main: #ffffff;
    --text-muted: #8b949e;
    --border: #30363d;        /* Bordas sutis */
    --success: #238636;       /* Verde para status OK */
    
    /* Cores Específicas do Speed Test (Gradientes simulados) */
    --gauge-dl-color: #00c6ff; /* Ciano para Download */
    --gauge-ul-color: #ff00c6; /* Magenta para Upload */

    --font-stack: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-stack);
    line-height: 1.6;
    scroll-behavior: smooth;
    overflow-x: hidden; /* Previne rolagem lateral indesejada */
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }
button { font-family: inherit; }

/* =========================================
   2. LAYOUT & HELPERS
   ========================================= */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 80px 0;
    border-bottom: 1px solid var(--border);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.section-header p {
    color: var(--text-muted);
}

/* Estilo base dos Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* =========================================
   3. HEADER & HERO
   ========================================= */
.header {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding: 20px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.logo .accent { color: var(--accent); }

.nav-links { display: flex; gap: 30px; }
.nav-links a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}
.nav-links a:hover { color: var(--accent); }

.hero {
    padding: 180px 0 100px;
    text-align: center;
    background: radial-gradient(circle at top, #1b2636 0%, var(--bg-dark) 80%);
}

.hero h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* =========================================
   4. COMPONENTES DE BOTÃO
   ========================================= */
.btn-primary {
    background-color: var(--accent);
    color: white;
    padding: 15px 30px;
    border-radius: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(17, 120, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(17, 120, 255, 0.4);
}

.btn-primary:disabled {
    background-color: #21262d;
    color: #484f58;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 12px 30px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: 0.3s;
}

.btn-outline:hover {
    background: rgba(17, 120, 255, 0.1);
}
.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================
   5. SPEED TEST (MODO FULL WIDTH / TELA INTEIRA)
   ========================================= */

/* Removemos a restrição do container principal APENAS para esta seção */
#speedtest .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
}

.speedtest-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.speed-card {
    width: 100%;        /* Ocupa a tela toda */
    max-width: none;    /* Remove o limite de 800px */
    padding: 60px 20px; /* Espaçamento interno vertical maior */
    background-color: var(--bg-card);
    
    /* Remove bordas laterais e arredondadas para encostar na tela */
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-left: none;
    border-right: none;
    border-radius: 0; 
    box-shadow: none; /* Remove sombra externa pois agora é um painel */
    
    /* Centraliza o conteúdo interno */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* -- Stats Topo (Ping/Jitter) -- */
.meta-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px; /* Mais espaço entre os itens */
    margin-bottom: 50px;
    background: rgba(0,0,0,0.2);
    padding: 20px 40px;
    border-radius: 50px; /* Arredondado estilo pílula */
    border: 1px solid var(--border);
}

.meta-item { text-align: center; }

.meta-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}

.meta-item .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    font-weight: 600;
    margin-bottom: 5px;
}

.meta-value-group {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.meta-item .value {
    font-size: 2rem;
    font-weight: 700;
    color: #ffbd2e;
}

.meta-item .unit { font-size: 0.9rem; color: var(--text-muted); }

/* -- Barras de Progresso (Com limitador visual para não esticar demais) -- */
.bars-container {
    display: flex;
    flex-direction: column;
    gap: 50px;
    margin-bottom: 50px;
    width: 100%;
    max-width: 1200px; /* Mantém as barras num tamanho legível no centro */
}

.bar-wrapper { position: relative; }

.bar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
}

.bar-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-wrapper .bar-label i { color: var(--gauge-dl-color); }
.upload-wrapper .bar-label i { color: var(--gauge-ul-color); }

.bar-value {
    font-size: 3rem; /* Valor maior */
    font-weight: 700;
    line-height: 1;
    color: var(--text-main);
    font-family: monospace;
}

.bar-value small {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* O Trilho da Barra */
.progress-track {
    width: 100%;
    height: 16px; /* Barra mais grossa */
    background: #0d1117;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* O Preenchimento da Barra */
.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 8px;
    transition: width 0.2s ease-out;
    position: relative;
    z-index: 1;
}

.download-wrapper .progress-fill {
    background: linear-gradient(90deg, #005c7a 0%, var(--gauge-dl-color) 100%);
    box-shadow: 0 0 20px var(--gauge-dl-color);
}

.upload-wrapper .progress-fill {
    background: linear-gradient(90deg, #7a005e 0%, var(--gauge-ul-color) 100%);
    box-shadow: 0 0 20px var(--gauge-ul-color);
}

/* -- Botão Iniciar Grande -- */
.action-center {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%;
}

.btn-start-large {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
    padding: 18px 80px;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.btn-start-large:hover:not(:disabled) {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 40px rgba(17, 120, 255, 0.4);
}

.btn-start-large:disabled {
    border-color: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Status e Ações */
.status-message {
    text-align: center;
    color: var(--success);
    font-weight: 600;
    height: 20px;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.speed-results-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.speed-results-actions .btn-primary {
    padding: 14px 30px;
    font-size: 1rem;
    background-color: #0d1117;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
}

.speed-results-actions .btn-primary:hover:not(:disabled) {
    background-color: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* =========================================
   6. PING SECTION (TERMINAL STYLE)
   ========================================= */
.alt-bg {
    background-color: #0f131a; /* Fundo levemente alternado */
}

.terminal-window {
    background: #090c10;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    margin-bottom: 30px;
}

.terminal-header {
    background: #161b22;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }
.terminal-header .title { margin-left: 10px; font-size: 0.8rem; color: var(--text-muted); }

.terminal-body {
    padding: 20px;
    height: 220px;
    overflow-y: auto;
    color: #27c93f; /* Verde terminal */
    font-size: 0.9rem;
}

.terminal-body::-webkit-scrollbar { width: 6px; }
.terminal-body::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.stats-row {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.stat-item { text-align: center; }
.stat-item small { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 5px; }
.stat-item strong { font-size: 1.4rem; font-weight: 600; }

.action-area {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

/* =========================================
   7. TRACEROUTE (TABLE STYLE)
   ========================================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.trace-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--bg-card);
}

.trace-table th {
    text-align: left;
    padding: 15px;
    background-color: #1c2128;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.trace-table td {
    padding: 14px 15px;
    border-bottom: 1px solid #21262d;
    color: var(--text-main);
}

.trace-table tr:last-child td { border-bottom: none; }
.trace-table tr:hover td { background-color: rgba(255,255,255,0.02); }

.status-ok { color: var(--success); display: inline-flex; align-items: center; gap: 5px; }
.status-wait { color: var(--accent); font-style: italic; }

/* =========================================
   8. FOOTER & RESPONSIVO
   ========================================= */
.footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    background-color: var(--bg-card);
    margin-top: auto;
}

/* Adaptações para Mobile */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    
    /* Speed Test Mobile */
    .ping-jitter-display {
        position: relative;
        top: 0;
        margin-bottom: 20px;
        gap: 40px;
    }
    
    .speed-gauges-wrapper { 
        flex-direction: column; 
        gap: 50px; 
        margin-bottom: 30px;
    }
    
    .gauge-center { margin-top: 20px; margin-bottom: 20px; }

    .speed-results-actions {
        flex-direction: column;
        width: 100%;
    }
    .speed-results-actions .btn-primary { width: 100%; }

    /* Outros ajustes */
    .nav-links { display: none; } /* Ocultar menu em telas muito pequenas */
    .stats-row { flex-wrap: wrap; gap: 20px; }
}