/* =====================================================
   CREA-SP — TOS  |  style-art-datatables.css
   Paleta: #01509b azul institucional
===================================================== */

/* ---------- RESET BÁSICO ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* ---------- PÁGINA ---------- */
.tos-page-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 28px 28px 48px;
    max-width: 1140px;
    margin: 0 auto;
}

/* ---------- HERO ---------- */
.tos-hero {
    background: #01509b;
    padding: 36px 32px 30px;
    position: relative;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.tos-hero::before {
    content: "";
    position: absolute;
    right: -80px; top: -80px;
    width: 280px; height: 280px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    pointer-events: none;
}
.tos-hero::after {
    content: "";
    position: absolute;
    right: 80px; top: 50px;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}
.tos-hero-logo {
    display: block;
    height: 36px;
    width: auto;
    margin-bottom: 20px;
    /* SVG tem fundo transparente mas o texto é escuro — inverte para branco */
    filter: brightness(0) invert(1);
}
.tos-hero-eyebrow {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    margin-bottom: 10px;
}
.tos-hero h2 {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin: 0 0 10px !important;
    line-height: 1.25 !important;
}
.tos-hero-desc {
    font-size: 14px;
    color: rgba(255,255,255,0.82);
    line-height: 1.65;
    max-width: 600px;
    margin: 0;
}

/* ---------- LABEL DE SEÇÃO ---------- */
.tos-section-label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 14px;
}
.tos-section-label::before {
    content: "";
    display: block;
    width: 3px; height: 16px;
    background: #01509b;
    border-radius: 2px;
    flex-shrink: 0;
}
.tos-section-label span {
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* ---------- DOCS GRID ---------- */
.tos-docs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.tos-doc-card {
    background: #fff;
    border: 1px solid #e3e8f0;
    border-radius: 12px;
    padding: 16px;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: border-color .2s, box-shadow .2s;
}
.tos-doc-card:hover {
    border-color: #01509b;
    box-shadow: 0 0 0 3px rgba(1,80,155,.08);
}
.tos-doc-icon {
    width: 34px; height: 34px;
    background: #eaf1fb;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.tos-doc-title {
    font-size: 13px;
    font-weight: 600;
    color: #01509b;
    line-height: 1.4;
}
.tos-doc-subtitle {
    font-size: 11px;
    color: #9ca3af;
}

/* ---------- AVISO ---------- */
.tos-notice {
    background: #fff8ed;
    border-left: 3px solid #f59e0b;
    border-radius: 0 10px 10px 0;
    padding: 12px 16px;
    font-size: 13px;
    color: #78350f;
    line-height: 1.6;
    margin-bottom: 22px;
}
.tos-notice strong { color: #92400e; }

/* =====================================================
   DATATABLE CARD
   O DataTables gera: #art-tabela-equivalencia_wrapper
===================================================== */
#art-tabela-equivalencia_wrapper {
    background: #fff;
    border: 1px solid #e3e8f0;
    border-radius: 16px;
    overflow: hidden;
    padding: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- TOPBAR ---------- */
.tos-table-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f2f5;
    gap: 12px;
    flex-wrap: wrap;
}
.tos-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.tos-topbar-right {
    display: flex;
    align-items: center;
}

/* título */
.tos-table-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
/* badge contador */
.tos-table-badge {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 500;
    margin-left: 6px;
}

/* SELECT quantidade */
.dataTables_length { margin: 0; }
.dataTables_length label {
    font-size: 13px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.dataTables_length select {
    appearance: none;
    background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239ca3af'/%3E%3C/svg%3E") no-repeat right 8px center;
    border: 1px solid #e3e8f0;
    border-radius: 8px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    height: 34px;
}

/* BUSCA — ícone injetado via JS no tabela-tos.php */
.dataTables_filter { margin: 0; position: relative; }
.dataTables_filter label {
    display: block;
    margin: 0;
    font-size: 0;
}
.dataTables_filter input {
    display: block;
    background: #f3f4f6;
    border: 1px solid #e3e8f0;
    border-radius: 10px;
    padding: 0 14px 0 34px;
    font-size: 13px;
    width: 260px;
    height: 36px;
    color: #374151;
    transition: border-color .2s, box-shadow .2s;
}
.dataTables_filter input::placeholder { color: #9ca3af; }
.dataTables_filter input:focus {
    background: #fff;
    border-color: #01509b;
    box-shadow: 0 0 0 3px rgba(1,80,155,.1);
    outline: none;
}

/* ---------- CABEÇALHO TABELA ---------- */
#art-tabela-equivalencia thead tr {
    background: #f8fafc !important;
}
#art-tabela-equivalencia thead th {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #01509b !important;
    padding: 11px 14px !important;
    border-bottom: 1px solid #e3e8f0 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    background: #f8fafc !important;
    white-space: nowrap;
}

/* ---------- TABELA ---------- */
#art-tabela-equivalencia {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: fixed !important;   /* CRÍTICO: respeita width das colunas */
    margin: 0 !important;
}

/* todas as células: quebra texto, nunca estoura */
#art-tabela-equivalencia th,
#art-tabela-equivalencia td {
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal !important;
}

#art-tabela-equivalencia tbody tr {
    border-bottom: 1px solid #f0f2f5;
    background: #fff;
    box-shadow: none !important;
    transform: none !important;
    border-left: none !important;
    border-radius: 0 !important;
    transition: background .15s;
}
#art-tabela-equivalencia tbody tr:last-child { border-bottom: none; }
#art-tabela-equivalencia tbody tr:hover { background: #f8fbff; }

#art-tabela-equivalencia td {
    padding: 12px 14px !important;
    border: none !important;
    vertical-align: middle;
    font-size: 13px;
    color: #374151;
}

/* ── larguras fixas das 4 colunas (somam 100%) ── */
#art-tabela-equivalencia th:nth-child(1),
#art-tabela-equivalencia td:nth-child(1) { width: 18%; }

#art-tabela-equivalencia th:nth-child(2),
#art-tabela-equivalencia td:nth-child(2) { width: 27%; font-size: 12px; color: #6b7280; }

#art-tabela-equivalencia th:nth-child(3),
#art-tabela-equivalencia td:nth-child(3) { width: 28%; font-weight: 600; color: #111827; }

#art-tabela-equivalencia th:nth-child(4),
#art-tabela-equivalencia td:nth-child(4) { width: 27%; font-size: 12px; color: #4b5563; }

/* badge área — não cresce além do texto */
.area-tag {
    display: inline-block;
    background: #eaf1fb;
    color: #01509b;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    line-height: 1.5;
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
}

/* ---------- HIGHLIGHT ---------- */
.highlight {
    background: #fff0b3;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
}

/* ---------- BOTTOMBAR ---------- */
.tos-table-bottombar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid #f0f2f5;
    flex-wrap: wrap;
    gap: 8px;
}
.dataTables_info {
    font-size: 12px;
    color: #9ca3af;
    padding: 0 !important;
}

/* PAGINAÇÃO */
.dataTables_paginate {
    display: flex;
    gap: 3px;
    float: none !important;
    padding: 0 !important;
}
.dataTables_paginate .paginate_button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px !important;
    background: #fff !important;
    border: 1px solid #e3e8f0 !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: #374151 !important;
    cursor: pointer;
    transition: all .15s;
    margin: 0 !important;
    line-height: 1 !important;
    box-shadow: none !important;
}
.dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
    background: #f3f4f6 !important;
    border-color: #d1d5db !important;
    color: #111827 !important;
}
.dataTables_paginate .paginate_button.disabled,
.dataTables_paginate .paginate_button.disabled:hover {
    opacity: .3;
    cursor: default;
    background: #fff !important;
}
#art-tabela-equivalencia_wrapper .dataTables_paginate .paginate_button.current,
#art-tabela-equivalencia_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #01509b !important;
    color: #fff !important;
    border-color: #01509b !important;
    box-shadow: 0 2px 6px rgba(1,80,155,.28) !important;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .tos-docs-grid { grid-template-columns: 1fr 1fr; }
}

/* ── TABLET (até 768px): scroll horizontal na tabela ── */
@media (max-width: 768px) {
    .tos-page-content { padding: 16px 14px 32px; }

    /* wrapper scroll */
    #art-tabela-equivalencia_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* topbar empilha */
    .tos-table-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }
    .tos-topbar-left { flex-wrap: wrap; gap: 8px; }
    .tos-topbar-right { width: 100%; }
    .dataTables_filter,
    .dataTables_filter label { width: 100%; }
    .dataTables_filter input { width: 100% !important; }

    /* tabela com largura mínima para não esmagar colunas */
    #art-tabela-equivalencia {
        min-width: 600px;
        table-layout: fixed !important;
    }
    /* recalcula larguras para tela menor */
    #art-tabela-equivalencia th:nth-child(1),
    #art-tabela-equivalencia td:nth-child(1) { width: 22%; }
    #art-tabela-equivalencia th:nth-child(2),
    #art-tabela-equivalencia td:nth-child(2) { width: 26%; }
    #art-tabela-equivalencia th:nth-child(3),
    #art-tabela-equivalencia td:nth-child(3) { width: 28%; }
    #art-tabela-equivalencia th:nth-child(4),
    #art-tabela-equivalencia td:nth-child(4) { width: 24%; }

    .tos-table-bottombar {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
    }
}

/* ── MOBILE (até 480px): cards empilhados por linha ── */
@media (max-width: 480px) {
    .tos-hero { padding: 22px 16px 20px; }
    .tos-hero h2 { font-size: 18px !important; }
    .tos-docs-grid { grid-template-columns: 1fr; gap: 8px; }

    /* esconde thead e transforma cada tr em card */
    #art-tabela-equivalencia thead { display: none; }

    #art-tabela-equivalencia,
    #art-tabela-equivalencia tbody,
    #art-tabela-equivalencia tr,
    #art-tabela-equivalencia td {
        display: block !important;
        width: 100% !important;
        min-width: unset !important;
    }

    #art-tabela-equivalencia tr {
        border: 1px solid #e3e8f0 !important;
        border-radius: 10px !important;
        margin: 0 0 10px !important;
        padding: 4px 0 !important;
        background: #fff !important;
    }
    #art-tabela-equivalencia tr:last-child { margin-bottom: 0 !important; }

    /* cada td vira linha com label à esquerda */
    #art-tabela-equivalencia td {
        padding: 8px 14px !important;
        border-bottom: 1px solid #f3f4f6 !important;
        display: grid !important;
        grid-template-columns: 100px 1fr;
        gap: 8px;
        align-items: start;
        font-size: 13px !important;
    }
    #art-tabela-equivalencia td:last-child {
        border-bottom: none !important;
    }

    /* labels gerados via data-label no JS */
    #art-tabela-equivalencia td::before {
        content: attr(data-label);
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .05em;
        color: #9ca3af;
        padding-top: 2px;
    }
    /* primeira célula ocupa largura total (badge) */
    #art-tabela-equivalencia td:first-child {
        grid-template-columns: 1fr;
        padding-bottom: 6px !important;
    }
    #art-tabela-equivalencia td:first-child::before { display: none; }
}

/* ---------- LIMPA LEGADO ---------- */
.tos-container,
.top-bar,
.bottom-bar { display: none !important; }

table.dataTable { width: 100% !important; }