/* =========================================================
   CUSTOM CSS - WEBCENTER (POSTFIXADMIN)
   Cores Oficiais:
   Cinza Claro: #F1F1F1 | Cinza Escuro: #303030
   Branco: #FFFFFF | Preto: #000000 | Vermelho: #A01D29
   ========================================================= */

/* --- 1. RESET GLOBAL E ESTABILIDADE --- */
html, body {
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    background-color: #F1F1F1;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    overflow-x: hidden !important; /* Corta vazamentos laterais */
    overflow-y: auto !important;   /* Garante rolagem vertical livre */
    touch-action: auto !important; /* Evita que o Edge trave o toque */
    line-height: 1.5 !important;   /* Firefox: respiro entre as linhas */
}

/* Força containers antigos a respeitarem os limites da tela */
#container, #main-container, .container, table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* --- 2. INPUTS E BOTÕES GLOBAIS --- */
/* Trava de zoom automático e duplo clique no mobile */
input, select, textarea, button, a {
    touch-action: manipulation !important;
}

input[type="text"], input[type="password"], select, .form-control {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px !important; 
    padding: 12px;
    margin-top: 5px;
}

select, select.form-control {
    background-color: #FFFFFF !important;
    color: #303030 !important;
    border: 1px solid #A01D29 !important;
}
select option, select optgroup {
    background-color: #FFFFFF !important;
    color: #303030 !important;
}

/* Forçar Vermelho Webcenter em TODOS os botões do sistema */
.btn, .btn-primary, .btn-default, .btn-success, .btn-info,
input[type="submit"], input[type="button"], button, .btn-login {
    background-color: #A01D29 !important;
    color: #FFFFFF !important;
    border: 1px solid #7d161f !important;
    background-image: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
    font-weight: bold !important;
    border-radius: 4px !important;
    padding: 12px !important;
    margin-top: 15px;
    transition: background 0.3s !important;
    box-sizing: border-box;
    cursor: pointer;
}

.btn:hover, input[type="submit"]:hover, button:hover, .btn-login:hover {
    background-color: #7d161f !important;
}

/* --- 3. TELA DE LOGIN --- */
.login-container {
    width: 90%;
    max-width: 380px;
    margin: 10vh auto;
    background: #FFFFFF;
    padding: 25px;
    border-top: 5px solid #A01D29;
    box-sizing: border-box;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* --- 4. MENU SUPERIOR (NAVBAR) --- */
.wc-navbar {
    background-color: #303030;
    border-bottom: 4px solid #A01D29;
    color: #FFFFFF;
    width: 100%;
}

.wc-nav-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.wc-brand {
    font-size: 1.2rem;
    font-weight: bold;
    color: #FFFFFF;
    letter-spacing: 1px;
}
.wc-brand span { color: #A01D29; font-weight: 900; }

.wc-nav-links {
    list-style: none;
    display: flex;
    margin: 0; padding: 0;
    align-items: center;
}

.wc-nav-links li a {
    color: #FFFFFF;
    text-decoration: none;
    padding: 8px 15px;
    display: block;
    font-weight: 500;
    transition: background 0.3s;
    font-size: 15px;
    white-space: nowrap !important; /* Firefox: não quebrar links */
    margin-left: 5px !important;
}

.wc-nav-links li a:hover {
    background-color: #A01D29;
    border-radius: 4px;
}

.wc-logout { color: #A01D29 !important; font-weight: bold; }
.wc-menu-checkbox, .wc-menu-icon { display: none; }

/* Impede que textos gigantes (ex: emails longos) quebrem a tabela no desktop */
td, th { word-wrap: break-word !important; }

/* --- 5. RESPONSIVIDADE MOBILE (< 768px) --- */
@media (max-width: 768px) {
    
    /* 5.1. Correção Edge: liberar fluxo e rolagem */
    body, body.page-login {
        display: block !important; 
        height: auto !important;
        min-height: 100% !important;
        padding-top: 5vh !important;
        padding-bottom: 15vh !important; 
    }

    .login-container {
        margin: 0 auto !important;
        display: block !important;
        position: relative !important;
    }

    /* 5.2. Menu Hambúrguer */
    .wc-menu-icon {
        display: block; font-size: 28px; cursor: pointer;
        color: #FFFFFF; user-select: none;
    }
    .wc-nav-links {
        display: none; flex-direction: column; width: 100%; margin-top: 10px;
    }
    .wc-nav-links li { width: 100%; text-align: center; border-top: 1px solid #444; }
    .wc-nav-links li a { padding: 15px; margin-left: 0 !important; }
    .wc-nav-links li a:hover { border-radius: 0; }
    .wc-menu-checkbox:checked ~ .wc-nav-links { display: flex; }

    /* 5.3. A MÁGICA: Tabelas viram Cartões Brancos */
    table, thead, tbody, th, td, tr {
        display: block !important;
        width: 100% !important;
    }
    thead tr {
        position: absolute; top: -9999px; left: -9999px; /* Esconde cabeçalho */
    }
    tr {
        margin-bottom: 20px !important;
        background: #FFFFFF !important;
        border: 1px solid #ccc !important;
        border-left: 5px solid #A01D29 !important; /* Destaque lateral Webcenter */
        border-radius: 4px;
        padding: 10px !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    td {
        border: none !important;
        padding: 8px 5px !important;
        border-bottom: 1px solid #F1F1F1 !important;
    }
    td:last-child {
        border-bottom: none !important;
        padding-top: 15px !important; /* Dá espaço para os links de Editar/Apagar */
    }
}

/* =========================================================
   6. SUBMENUS E DROPDOWNS (DINÂMICOS)
   ========================================================= */

/* Desktop: Comportamento Hover (Passar o mouse) */
.wc-dropdown {
    position: relative;
}

.wc-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #303030;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 220px;
    z-index: 999;
    border-top: 3px solid #A01D29;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Quando passa o mouse na categoria, o submenu aparece */
.wc-dropdown:hover .wc-submenu {
    display: block;
}

.wc-submenu li {
    border-bottom: 1px solid #444;
    width: 100%;
}

.wc-submenu li:last-child {
    border-bottom: none;
}

.wc-submenu li a {
    padding: 12px 15px;
    font-size: 14px;
}

/* --- Ajuste do Submenu no Celular --- */
@media (max-width: 768px) {
    .wc-submenu {
        position: relative;
        display: block; /* No celular, já deixa tudo aberto para facilitar a vida */
        border-top: none;
        background-color: #222; /* Um cinza mais escuro para mostrar que é submenu */
        box-shadow: none;
    }
    
    .wc-cat-title {
        color: #A01D29 !important; /* Título da categoria em vermelho */
        font-weight: 900 !important;
        background-color: #111;
        pointer-events: none; /* Desativa o clique na categoria pai se ela for apenas texto */
    }
    
    .wc-submenu li a {
        padding-left: 30px !important; /* Dá um recuo (identação) nos itens filhos */
        font-size: 14px;
        border-bottom: 1px solid #333;
    }
}

/* --- 7. LIMPEZA DE LIXO VISUAL (LEGENDAS ANTIGAS) --- */
/* Esconde a legenda de cores no fundo da página de e-mails */
#legend, .legend, .south, form + br + table {
    display: none !important;
}

/* Esconde textos explicativos soltos que usavam a classe legend */
span.legend {
    display: none !important;
}

/* --- LIMPEZA DA LEGENDA DE CORES (DESKTOP E MOBILE) --- */
#legend, .legend, ul.legend, div.legend, table.legend, span.legend {
    display: none !important;
}

/* Força a ocultação da tabela de legenda que o PostfixAdmin joga no final do formulário */
form[name="frmOverview"] ~ table, 
form[name="frmOverview"] ~ br,
form[name="frmOverview"] ~ ul {
    display: none !important;
}

/* Remove os marcadores coloridos inuteis ao lado dos e-mails se eles estiverem poluindo */
td font[color], td span[style*="background"] {
    display: none !important;
}





body select,
body select.form-control,
body .form-control[name="domain"],
body select[name="domain"] {
    background-color: #FFFFFF !important;
    color: #303030 !important;
    -webkit-appearance: menulist !important;
    appearance: menulist !important;
    opacity: 1 !important;
}

body select,
body select.form-control {
    -webkit-text-fill-color: #303030 !important;
}

select[name="domain"],
select[name="fDomain"],
select[name="username"] {
    color: #303030 !important;
    background: #FFFFFF !important;
    -webkit-text-fill-color: #303030 !important;
    -webkit-opacity: 1 !important;
}

select, select.form-control {
    height: auto !important;
    min-height: 42px !important;
    line-height: 1.4 !important;
}

form[name="frmOverview"] select.form-control {
    min-height: 52px !important;
    line-height: 1.6 !important;
}
