/* ============================================
   page-legal.css
   public_html/styles/page-legal.css
   Partilhado por: terms-of-service, privacy-policy, cookies
   ============================================ */

/* ── Google Translate ── */
#google_translate_element {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    background: rgba(10, 10, 24, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 6px 12px;
    backdrop-filter: blur(16px);
}
.goog-te-gadget-simple { background: transparent !important; border: none !important; font-family: inherit !important; font-size: 0.78rem !important; }
.goog-te-gadget-simple .goog-te-menu-value span:first-child { color: rgba(255,255,255,0.7) !important; }
.goog-te-gadget-simple img { display: none !important; }
.goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }

/* ── Secção principal ── */
.legal-section {
    padding-top: 5rem !important;
    padding-bottom: 8rem !important;
}

/* ══════════════════════════════════════════
   LAYOUT — índice lateral + conteúdo
══════════════════════════════════════════ */
.legal-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 5rem;
    align-items: start;
}

/* ── Índice lateral ── */
.legal-toc {
    position: sticky;
    top: 100px;
}

.legal-toc-title {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    margin-bottom: 1rem;
}

.legal-toc-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    counter-reset: none;
}

.legal-toc-list li a {
    display: block;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.38);
    text-decoration: none;
    padding: 0.45rem 0.75rem;
    border-left: 1px solid rgba(255,255,255,0.06);
    border-radius: 0 4px 4px 0;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    line-height: 1.45;
}
.legal-toc-list li a:hover {
    color: rgba(255,255,255,0.7);
    border-color: rgba(79,142,247,0.4);
    background: rgba(79,142,247,0.04);
}

/* Metadados */
.legal-toc-meta {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.25rem;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.legal-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.legal-meta-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.22);
}
.legal-meta-item span:last-child {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.58);
    font-weight: 500;
}

/* ══════════════════════════════════════════
   CABEÇALHO DO DOCUMENTO
══════════════════════════════════════════ */
.legal-header-card {
    padding: 1.5rem 2rem;
    background: rgba(79,142,247,0.04);
    border: 1px solid rgba(79,142,247,0.1);
    border-radius: 12px;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}
.legal-header-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f8ef7, #f97316);
    opacity: 0.5;
}
.legal-header-entity {
    font-size: 1.1rem;
    font-weight: 800;
    color: rgba(255,255,255,0.9);
    margin-bottom: 0.35rem;
}
.legal-header-meta {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
}

/* ══════════════════════════════════════════
   ARTIGOS
══════════════════════════════════════════ */
.legal-article {
    margin-bottom: 3.5rem;
    padding-bottom: 3.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.legal-article:last-of-type {
    border-bottom: none;
}

.legal-article-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: rgba(255,255,255,0.88);
    margin: 0 0 1.25rem;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    line-height: 1.4;
}

.legal-article-num {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--primary-blue, #4f8ef7);
    opacity: 0.7;
    flex-shrink: 0;
    padding: 2px 7px;
    background: rgba(79,142,247,0.08);
    border-radius: 3px;
}

.legal-content p {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.8;
    margin: 0 0 1rem;
}

/* Subsecções */
.legal-subsection {
    margin: 1.75rem 0 0;
    padding: 1.5rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
}
.legal-subsection h3 {
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    margin: 0 0 0.75rem;
}
.legal-subsection p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.75;
    margin: 0 0 0.5rem;
}
.legal-subsection p:last-child { margin-bottom: 0; }

/* Lista com bullets */
.legal-ul {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.legal-ul li {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.6;
    padding-left: 1.1rem;
    position: relative;
}
.legal-ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(79,142,247,0.6);
}

/* Itens de lista estruturados */
.legal-list-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}
.legal-list-item {
    padding: 1rem 1.25rem;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
}
.legal-list-item-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
    margin-bottom: 0.35rem;
}
.legal-list-item p {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.45);
    margin: 0;
    line-height: 1.6;
}

/* Caixa de informação */
.legal-info-box {
    margin: 1.25rem 0 0;
    padding: 1.25rem 1.5rem;
    background: rgba(79,142,247,0.04);
    border: 1px solid rgba(79,142,247,0.12);
    border-radius: 8px;
}
.legal-info-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(79,142,247,0.7);
    margin-bottom: 0.65rem;
}
.legal-info-box p {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.52);
    margin: 0 0 0.35rem;
    line-height: 1.55;
}
.legal-info-box p:last-child { margin-bottom: 0; }
.legal-info-box a {
    color: rgba(255,255,255,0.65);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Grelha de direitos RGPD */
.legal-rights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 0.75rem 0 1rem;
}
.legal-right-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}
.legal-right-ref {
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--primary-blue, #4f8ef7);
    background: rgba(79,142,247,0.1);
    border-radius: 3px;
    padding: 2px 6px;
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.8;
}
.legal-right-item strong {
    display: block;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.75);
    margin-bottom: 0.2rem;
}
.legal-right-item p {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.42);
    margin: 0;
    line-height: 1.5;
}

/* Email obfuscado */
.legal-email-link {
    color: rgba(255,255,255,0.6);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
    font-style: normal;
}
.legal-email-link:hover {
    color: rgba(255,255,255,0.9);
}

/* Rodapé do documento */
.legal-doc-footer {
    margin-top: 1rem;
    padding: 1.5rem 2rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
}
.legal-doc-footer p {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.35);
    margin: 0 0 0.35rem;
    line-height: 1.6;
}
.legal-doc-footer p:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .legal-layout {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    .legal-toc {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        align-items: flex-start;
    }
    .legal-toc-list { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
    .legal-toc-list li a { border-left: none; border: 1px solid rgba(255,255,255,0.07); border-radius: 4px; }
    .legal-toc-meta { min-width: 200px; }
}

@media (max-width: 768px) {
    .legal-rights-grid { grid-template-columns: 1fr; }
    .legal-section { padding-top: 3rem !important; }
    #google_translate_element { bottom: 14px; right: 14px; }
}

/* ══════════════════════════════════════════
   TABELA
══════════════════════════════════════════ */
.legal-table-wrapper {
    overflow-x: auto;
    margin: 1.25rem 0;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.07);
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.legal-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    white-space: nowrap;
}

.legal-table tbody td {
    padding: 0.8rem 1rem;
    color: rgba(255,255,255,0.55);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: top;
    line-height: 1.5;
}

.legal-table tbody tr:last-child td {
    border-bottom: none;
}

.legal-table tbody tr:hover td {
    background: rgba(255,255,255,0.02);
}

.legal-table code {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 3px;
    padding: 1px 5px;
    color: rgba(255,255,255,0.7);
}

.legal-td-no-req {
    color: rgba(16,185,129,0.8) !important;
    font-weight: 600;
    font-size: 0.75rem;
}
.legal-td-req {
    color: rgba(245,158,11,0.8) !important;
    font-weight: 600;
    font-size: 0.75rem;
}

/* ── Botão gerir cookies ── */
.legal-cookies-manage-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.75rem 1rem;
    background: rgba(79,142,247,0.08);
    border: 1px solid rgba(79,142,247,0.2);
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary-blue, #4f8ef7);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}
.legal-cookies-manage-btn:hover {
    background: rgba(79,142,247,0.14);
    border-color: rgba(79,142,247,0.4);
}
.legal-cookies-manage-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    flex-shrink: 0;
}

/* ── Links internos ── */
.legal-doc-footer a,
.legal-content a:not(.legal-email-link) {
    color: rgba(255,255,255,0.5);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}
.legal-doc-footer a:hover,
.legal-content a:not(.legal-email-link):hover {
    color: rgba(255,255,255,0.8);
}

/* ══════════════════════════════════════════
   TABELAS — subcontratistas e cookies
══════════════════════════════════════════ */

/* Tabela genérica (3 colunas) */
.legal-table,
.legal-cookies-table {
    margin: 1.25rem 0;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    overflow: hidden;
}

.legal-table-row,
.legal-cookies-row {
    display: grid;
    gap: 0;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    align-items: center;
}
.legal-table-row:last-child,
.legal-cookies-row:last-child { border-bottom: none; }

.legal-table-row { grid-template-columns: 1.2fr 2fr 1fr; }
.legal-cookies-row { grid-template-columns: 1.2fr 2fr 1fr; }

.legal-table-header,
.legal-cookies-header {
    background: rgba(255,255,255,0.035);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
}

.legal-table-row span,
.legal-cookies-row span {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.52);
    line-height: 1.5;
    padding: 0 0.5rem 0 0;
}
.legal-table-row strong,
.legal-cookies-row strong {
    color: rgba(255,255,255,0.78);
}

/* Badges de consentimento */
.legal-badge-required {
    display: inline-block;
    font-size: 0.65rem !important;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(16,185,129,0.1);
    border: 1px solid rgba(16,185,129,0.25);
    color: #10b981 !important;
    white-space: nowrap;
}

.legal-badge-consent {
    display: inline-block;
    font-size: 0.65rem !important;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.25);
    color: #f59e0b !important;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .legal-table-row,
    .legal-cookies-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    .legal-table-header,
    .legal-cookies-header { display: none; }
}

/* ══════════════════════════════════════════
   COOKIES PAGE — extras
══════════════════════════════════════════ */

/* Tabela 4 colunas */
.legal-cookies-4col {
    grid-template-columns: 1.1fr 1.4fr 2fr 1fr !important;
}

/* Badge de duração */
.legal-duration {
    font-size: 0.75rem !important;
    color: rgba(255,255,255,0.45) !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Browsers */
.legal-browsers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.legal-browser-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0.85rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 7px;
}
.legal-browser-item strong {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
}
.legal-browser-item span {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.35);
    line-height: 1.4;
}

/* Botão de gestão de cookies no índice */
.legal-manage-cookies {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.legal-manage-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.22);
    margin-bottom: 0.65rem;
}
.legal-manage-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    background: rgba(79,142,247,0.08);
    border: 1px solid rgba(79,142,247,0.18);
    border-radius: 8px;
    color: var(--primary-blue, #4f8ef7);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}
.legal-manage-btn:hover {
    background: rgba(79,142,247,0.14);
    border-color: rgba(79,142,247,0.35);
}
.legal-manage-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .legal-cookies-4col {
        grid-template-columns: 1fr 1fr !important;
    }
    .legal-browsers {
        grid-template-columns: 1fr;
    }
}
