:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --primary: #00ff9d;
    --secondary: #58a6ff;
    --danger: #ff5555;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;
    --border: #30363d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    padding: 0; /* Removi padding global para ajustar sidebar */
    margin: 0;
}

/* --- LAYOUT SIDEBAR + CONTENT (App Container) --- */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar Estilo */
.sidebar {
    width: 260px;
    background: #0d1117;
    border-right: 1px solid var(--border);
    padding: 25px;
    display: flex;
    flex-direction: column;
    position: fixed; /* Fixo na esquerda */
    height: 100vh;
    z-index: 100;
    top: 0;
    left: 0;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}
.brand span { color: var(--primary); }

.sidebar-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu { flex: 1; }

.nav-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 12px 15px;
    margin-bottom: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-btn:hover { background: rgba(255,255,255,0.05); }
.nav-btn.active {
    background: rgba(0, 255, 157, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.sidebar-footer { margin-top: auto; }

/* Conteúdo Principal */
.content-area {
    margin-left: 260px; /* Mesma largura da sidebar */
    width: calc(100% - 260px);
    padding: 40px;
    background: #161b22;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.section-header { margin-bottom: 30px; }
.section-header h2 { font-size: 1.5rem; color: #fff; display: flex; align-items: center; gap: 10px; }
.section-header p { color: var(--text-muted); margin-top: 5px; }

/* Utilitários de Visibilidade */
.tool-section { display: none; animation: fadeIn 0.4s ease; }
.tool-section.active { display: block; }
.hidden { display: none !important; }

/* GRID RESPONSIVO */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.full-width { grid-column: 1 / -1; }

/* CARDS */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.neon-border { border-top: 3px solid var(--primary); }

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}
.card-header h3 { font-size: 1rem; color: #fff; margin: 0; }
.card-header i { color: var(--primary); }

/* UI ELEMENTS */
.output-box {
    background: #050505;
    padding: 12px;
    border-radius: 6px;
    border: 1px dashed var(--border);
    font-size: 0.85rem;
    word-break: break-all;
    min-height: 45px;
    color: var(--primary);
}

.code-style { font-family: monospace; }

/* CONTROLS & INPUTS */
.controls { margin-top: 15px; }
input[type="range"] { width: 100%; margin: 15px 0; accent-color: var(--primary); cursor: pointer; }
.checkboxes { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.8rem; }

textarea, input[type="text"] {
    width: 100%;
    background: #0d1117;
    border: 1px solid var(--border);
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
}
textarea { min-height: 80px; }

/* BOTÕES */
.btn-action, .btn-small {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
    margin-top: 10px;
}

.btn-action:hover { opacity: 0.9; }
.btn-action:active { transform: scale(0.98); }

.btn-group { display: flex; gap: 10px; margin-top: 10px; }
.btn-small { padding: 10px; font-size: 0.9rem; margin-top: 0; }
.btn-small.outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}
.btn-small.outline:hover { background: rgba(0,255,157,0.1); }

/* INPUT FILE ESTILIZADO */
.drop-zone {
    border: 2px dashed var(--border);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    transition: 0.3s;
}
.drop-zone:hover { border-color: var(--primary); color: #fff; }

/* SYSTEM LIST */
.system-list { list-style: none; padding: 0; }
.system-list li { margin-bottom: 5px; }

/* JWT Visualizer */
.jwt-container { display: flex; flex-direction: column; gap: 10px; }
.jwt-box {
    background: #050505;
    border-radius: 6px;
    padding: 10px;
    font-size: 0.85rem;
    border-left: 4px solid #333;
}
.jwt-box.header { border-color: #fb542b; }
.jwt-box.payload { border-color: #d63aff; }
.jwt-box pre { white-space: pre-wrap; word-break: break-all; color: #c9d1d9; margin-top: 5px; }

/* Helpers */
.warning { background: #ffcc00; color: #000; }

/* TABS */
.tabs { display: flex; gap: 10px; margin-bottom: 10px; }
.tab-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
}
.tab-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0,255,157,0.05);
}

/* BOTÃO PORTFOLIO */
.btn-portfolio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 255, 157, 0.05);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}
.btn-portfolio:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.5);
}

/* FOOTER */
footer {
    margin-top: auto;
    padding-top: 40px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
}

/* --- RESPONSIVIDADE TOTAL (Celular e Tablet até 1024px) --- */
@media (max-width: 1024px) {
    
    /* --- NOVO: ISSO AQUI É O QUE FALTAVA --- */
    /* Manda o container colocar um elemento embaixo do outro (Coluna) */
    .app-container {
        flex-direction: column; 
    }

    /* --- ANTIGO: O SEU CÓDIGO (Mantenha exatamente assim) --- */
    /* Sidebar vira um cabeçalho estático */
    .sidebar {
        position: relative; /* Remove a fixação lateral */
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 20px;
        z-index: 10;
    }

    /* ... o resto dos códigos que vem abaixo (brand, nav-menu, etc) continua igual ... */

    /* Centraliza a logo no topo */
    .brand { text-align: center; margin-bottom: 15px; }
    .sidebar-subtitle { text-align: center; display: block; margin-bottom: 15px; }

    /* Ajusta o menu para não ficar gigante */
    .nav-menu {
        display: flex;
        flex-wrap: wrap; /* Permite quebrar linha se precisar */
        gap: 10px;
        justify-content: center;
    }

    .nav-btn {
        width: auto; /* Tamanho automático */
        margin-bottom: 0;
        font-size: 0.85rem;
        padding: 8px 12px;
        background: rgba(255,255,255,0.03); /* Fundo sutil */
    }

    /* 2. Conteúdo Principal flui abaixo da sidebar */
    .content-area {
        margin-left: 0;
        width: 100%;
        padding: 15px; /* Menos padding no mobile */
    }

    /* 3. Força Coluna Única nos Cards (Fim dos problemas de layout quebrado) */
    .dashboard-grid {
        grid-template-columns: 1fr !important; /* Força 1 coluna */
        gap: 15px;
    }

    /* Garante que nada estoure a largura da tela */
    .card, .full-width {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0; /* Correção mágica para Grid/Flex */
    }

    /* 4. Ajustes finos de UI */
    .btn-group { flex-direction: column; }
    
    /* Esconde o rodapé da sidebar no mobile para poupar espaço (opcional) */
    .sidebar-footer { margin-top: 20px; text-align: center; }
}

/* --- AJUSTE PARA CELULARES MUITO PEQUENOS (iPhone SE/Galaxy Fold) --- */
@media (max-width: 380px) {
    .brand { font-size: 1.2rem; }
    .nav-btn { width: 100%; text-align: center; justify-content: center; }
    .card-header h3 { font-size: 0.9rem; }
}


/* --- CORREÇÃO PARA IPV6 LONGO --- */
.card-body strong, 
.card-body span,
#quick-ip div {
    /* Força o texto a quebrar se for muito longo */
    word-break: break-word; 
    overflow-wrap: break-word;
    
    /* Garante que não ultrapasse a largura do card */
    max-width: 100%;
    display: inline-block;
}

/* Ajuste específico para o widget pequeno da Dashboard */
#quick-ip {
    font-size: 0.95rem; /* Diminui levemente a fonte geral */
    line-height: 1.4;
}