/* ============================================
   CetNet - Portal do Colaborador CETURB
   Design System & Global Styles
   ============================================ */

:root {
    --brand-pink: #ED1556;
    --brand-blue: #00AEEF;
    --brand-gray: #58595B;
    --brand-dark-gray: #3a3b3c;
    --brand-white: #ffffff;
    --brand-bg-light: #f4f7f9;
    --brand-pink-light: rgba(237, 21, 86, 0.08);
    --brand-blue-light: rgba(0, 174, 239, 0.08);
    --brand-pink-glow: rgba(237, 21, 86, 0.25);
    --brand-blue-glow: rgba(0, 174, 239, 0.25);
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 68px;
    --card-radius: 20px;
    --card-shadow: 0 2px 16px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 8px 32px rgba(0,0,0,0.12);
    --transition-default: all 0.3s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Poppins', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    color: var(--brand-dark-gray);
    background: var(--brand-bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, .h1 {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
}

h2, .h2 {
    font-size: 26px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

h3, .h3 {
    font-size: 20px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
}

small, .small {
    font-size: 13px;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(0,0,0,0.25);
    }

#blazor-error-ui {
    background: var(--brand-pink);
    color: white;
    padding: 0.8rem 1.5rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 9999;
    text-align: center;
    display: none;
}

    #blazor-error-ui .reload {
        color: white;
        text-decoration: underline;
    }

    #blazor-error-ui .dismiss {
        cursor: pointer;
        margin-left: 1rem;
    }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "Ocorreu um erro.";
    }

/* SHARED: Card Header (usado por multiplos componentes) */
.card-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

    .card-header-custom h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
        color: var(--brand-dark-gray);
    }

    .card-header-custom .card-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

.card-icon.pink {
    background: var(--brand-pink-light);
    color: var(--brand-pink);
}

.card-icon.blue {
    background: var(--brand-blue-light);
    color: var(--brand-blue);
}

/* BUTTONS */
.btn-brand-pink {
    background: var(--brand-pink);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-default);
}

    .btn-brand-pink:hover {
        background: #d4124e;
        transform: scale(1.02);
        box-shadow: 0 4px 16px var(--brand-pink-glow);
        color: white;
    }

.btn-brand-blue {
    background: var(--brand-blue);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-default);
}

    .btn-brand-blue:hover {
        background: #009ad6;
        transform: scale(1.02);
        box-shadow: 0 4px 16px var(--brand-blue-glow);
        color: white;
    }

.btn-outline-brand {
    background: transparent;
    color: var(--brand-blue);
    border: 2px solid var(--brand-blue);
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-default);
}

    .btn-outline-brand:hover {
        background: var(--brand-blue);
        color: white;
    }

/* PAGE HEADER */
.page-header {
    margin-bottom: 24px;
}

    .page-header h1 {
        font-size: 28px;
        font-weight: 700;
        color: var(--brand-dark-gray);
        margin: 0 0 4px;
    }

    .page-header p {
        color: var(--brand-gray);
        font-size: 14px;
        margin: 0;
    }

/* INFO CARD */
.info-card {
    background: var(--brand-white);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 28px;
    transition: var(--transition-default);
    margin-bottom: 20px;
}

    .info-card:hover {
        box-shadow: var(--card-shadow-hover);
    }

/* SYSTEM CARDS */
.system-card {
    background: var(--brand-white);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    text-align: center;
    transition: var(--transition-default);
}

    .system-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--card-shadow-hover);
    }

    .system-card .system-icon {
        width: 64px;
        height: 64px;
        border-radius: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 28px;
        margin: 0 auto 16px;
    }

    .system-card h4 {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 8px;
    }

    .system-card p {
        font-size: 13px;
        color: var(--brand-gray);
        margin-bottom: 16px;
    }

/* RAMAL CARDS */
/*.ramal-card {
    background: var(--brand-white);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 20px;
    transition: var(--transition-default);
}

    .ramal-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--card-shadow-hover);
    }

    .ramal-card h4 {
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 12px;
        color: var(--brand-dark-gray);
    }

.ramal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 13px;
}

    .ramal-item:last-child {
        border-bottom: none;
    }*/

/* CHAT */
.chat-container {
    display: flex;
    height: calc(100vh - var(--header-height) - 120px);
    background: var(--brand-white);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.chat-sidebar {
    width: 280px;
    border-right: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-weight: 600;
    font-size: 16px;
}

.chat-contact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition-default);
}

    .chat-contact:hover, .chat-contact.active {
        background: var(--brand-bg-light);
    }

    .chat-contact .contact-avatar {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        background: var(--brand-blue-light);
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        color: var(--brand-blue);
        flex-shrink: 0;
    }

    .chat-contact .contact-info h4 {
        font-size: 14px;
        font-weight: 600;
        margin: 0;
    }

    .chat-contact .contact-info p {
        font-size: 12px;
        color: var(--brand-gray);
        margin: 0;
    }

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

    .chat-message.sent {
        align-self: flex-end;
        background: var(--brand-blue);
        color: white;
        border-bottom-right-radius: 4px;
    }

    .chat-message.received {
        align-self: flex-start;
        background: var(--brand-bg-light);
        color: var(--brand-dark-gray);
        border-bottom-left-radius: 4px;
    }

.chat-input-area {
    padding: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
    display: flex;
    gap: 12px;
}

    .chat-input-area input {
        flex: 1;
        padding: 10px 16px;
        border: 2px solid rgba(0,0,0,0.06);
        border-radius: 12px;
        font-size: 14px;
        outline: none;
        transition: var(--transition-default);
    }

        .chat-input-area input:focus {
            border-color: var(--brand-blue);
        }

    .chat-input-area button {
        padding: 10px 20px;
        border-radius: 12px;
        border: none;
        background: var(--brand-blue);
        color: white;
        font-weight: 600;
        cursor: pointer;
        transition: var(--transition-default);
    }

        .chat-input-area button:hover {
            background: #009ad6;
        }

/* INFOMAP */
.infomap-step {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 16px;
    transition: var(--transition-default);
    position: relative;
}

    .infomap-step:hover {
        border-color: var(--brand-blue);
        box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    }

    .infomap-step::after {
        content: '';
        position: absolute;
        bottom: -16px;
        left: 50%;
        transform: translateX(-50%);
        width: 2px;
        height: 16px;
        background: var(--brand-blue);
    }

    .infomap-step:last-child::after {
        display: none;
    }

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px;
}

.step-content p {
    font-size: 13px;
    color: var(--brand-gray);
    margin: 0;
}

/* SETOR CARDS */
.setor-card {
    background: var(--brand-white);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    transition: var(--transition-default);
    text-align: center;
}

    .setor-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--card-shadow-hover);
    }

.setor-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 12px;
}

/* CONFETTI (injetado via JS no DOM global) */
@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 9999;
    animation: confetti-fall 3s ease-in-out forwards;
}

/* UTILITIES */
.text-pink {
    color: var(--brand-pink) !important;
}

.text-blue {
    color: var(--brand-blue) !important;
}

.text-gray {
    color: var(--brand-gray) !important;
}

.text-dark-gray {
    color: var(--brand-dark-gray) !important;
}

.bg-pink-light {
    background: var(--brand-pink-light) !important;
}

.bg-blue-light {
    background: var(--brand-blue-light) !important;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--brand-gray);
    margin: 8px 16px 4px;
}

.glass-card {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

/* ANIMATIONS */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

/* RESPONSIVE GLOBAL */
@media (max-width: 992px) {
    .chat-sidebar {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        height: auto;
    }

    .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        max-height: 200px;
        overflow-y: auto;
    }

    .chat-messages {
        min-height: 300px;
    }
}

/* ============================================
   TERMO DE RESPONSABILIDADE — TELA
   ============================================ */

.trm-loading {
    text-align: center;
    padding: 16px;
}

.trm-toolbar {
    display: flex;
    gap: 8px;
    margin: 8px 0 16px 0;
    flex-wrap: wrap;
}

    .trm-toolbar .btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 8px 16px;
        font-size: 13px;
        border-radius: 8px;
        border: none;
        cursor: pointer;
        font-weight: 600;
        transition: all 0.2s ease;
    }

    .trm-toolbar .btn-primary {
        background: #00AEEF;
        color: #fff;
    }

        .trm-toolbar .btn-primary:hover {
            background: #0098d1;
            transform: translateY(-1px);
        }

    .trm-toolbar .btn-secondary {
        background: #6c757d;
        color: #fff;
    }

        .trm-toolbar .btn-secondary:hover {
            background: #5a6268;
            transform: translateY(-1px);
        }

.trm-aviso-impressao {
    background: #fff7e6;
    border-left: 4px solid #f0a800;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    color: #7a5b00;
    margin-bottom: 14px;
}

.trm-pages {
    display: block;
    width: 100%;
    background: #e9ecef;
    padding: 20px 0;
}

.trm-a4 {
    width: 190mm;
    min-height: 267mm;
    margin: 0 auto 12px auto;
    padding: 8mm 10mm;
    box-sizing: border-box;
    background: #fff;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.trm-header {
    break-inside: avoid;
    page-break-inside: avoid;
}

.trm-header-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.trm-logo {
    width: 110px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.trm-orgao {
    flex: 1;
    text-align: center;
    font-weight: 700;
    line-height: 1.25;
    font-size: 11.5px;
}

.trm-a4 h1 {
    margin: 12px 0 8px 0;
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.trm-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
}

.trm-decl {
    margin: 0 0 10px 0;
    line-height: 1.3;
    font-size: 12px;
    font-weight: 600;
}

.trm-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    table-layout: fixed;
}

    .trm-table thead {
        display: table-header-group;
    }

        .trm-table thead th {
            border-top: 1.5px solid #000;
            border-bottom: 1.5px solid #000;
            padding: 5px 4px;
            font-size: 12px;
            font-weight: 700;
            text-align: left;
        }

    .trm-table td {
        border-bottom: 1px solid #d9d9d9;
        padding: 4px;
        vertical-align: top;
        font-size: 11px;
        line-height: 1.2;
        word-break: break-word;
    }

        .trm-table th:nth-child(1), .trm-table td:nth-child(1) {
            width: 12%;
        }

        .trm-table th:nth-child(2), .trm-table td:nth-child(2) {
            width: 56%;
        }

        .trm-table th:nth-child(3), .trm-table td:nth-child(3) {
            width: 17%;
        }

        .trm-table th:nth-child(4), .trm-table td:nth-child(4) {
            width: 15%;
        }

    .trm-table .right {
        text-align: right;
    }

.trm-footer {
    margin-top: auto;
    break-inside: avoid;
    page-break-inside: avoid;
}

    .trm-footer p {
        margin: 0;
        border-top: 1.5px solid #000;
        padding-top: 10px;
        font-size: 10.5px;
        font-weight: 700;
        line-height: 1.3;
        text-transform: uppercase;
    }

.trm-sign {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 11px;
    font-weight: 700;
}

    .trm-sign > div {
        flex: 1;
    }

.trm-bottom {
    margin-top: 12px;
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    font-weight: 700;
}

/* Responsivo do termo (visualização na tela) */
@media (max-width: 900px) {
    .trm-pages {
        padding: 8px 0;
    }

    .trm-a4 {
        width: 100%;
        min-height: auto;
        margin: 0 0 8px 0;
        padding: 14px 12px;
        box-shadow: none;
        border-radius: 0;
    }

    .trm-header-top {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .trm-orgao {
        font-size: 10.5px;
    }

    .trm-a4 h1 {
        font-size: 15px;
    }

    .trm-meta {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
    }

    .trm-decl {
        font-size: 11px;
    }

    .trm-sign {
        flex-direction: column;
        gap: 10px;
    }

    .trm-table td,
    .trm-table th {
        font-size: 10px;
        padding: 3px;
    }
}

/* ============================================
   TERMO DE RESPONSABILIDADE — IMPRESSÃO
   Este é o ÚNICO @media print do termo.
   ============================================ */
@media print {

    @page {
        size: A4 portrait;
        margin: 0;
    }

    html, body {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        width: 210mm !important;
        overflow: visible !important;
    }

        /* --------------------------------------------------
       1) NUCLEAR: esconde TUDO que NÃO seja
          - o próprio .trm-pages
          - um descendente de .trm-pages
          - um ancestral de .trm-pages
       -------------------------------------------------- */
        body *:not(.trm-pages):not(.trm-pages *):not(:has(.trm-pages)) {
            display: none !important;
        }

        /* --------------------------------------------------
       2) Reexibe os ancestrais do termo com layout neutro
       -------------------------------------------------- */
        body:has(.trm-pages),
        body *:has(> .trm-pages),
        body *:has(.trm-pages):not(.trm-pages *) {
            display: block !important;
            position: static !important;
            padding: 0 !important;
            margin: 0 !important;
            width: 100% !important;
            max-width: none !important;
            min-height: 0 !important;
            height: auto !important;
            overflow: visible !important;
            background: #fff !important;
            box-shadow: none !important;
            border: none !important;
            transform: none !important;
            filter: none !important;
        }

    /* --------------------------------------------------
       3) Container e folhas
       -------------------------------------------------- */
    .trm-pages {
        display: block !important;
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .trm-a4 {
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 8mm 10mm !important;
        box-sizing: border-box !important;
        background: #fff !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        overflow: visible !important;
    }

        .trm-a4:last-child {
            page-break-after: auto !important;
            break-after: auto !important;
        }

    /* --------------------------------------------------
       4) Força TUDO dentro do termo a aparecer
          (vence qualquer regra genérica que tenha sobrado)
       -------------------------------------------------- */
    .trm-pages,
    .trm-pages * {
        visibility: visible !important;
        opacity: 1 !important;
        clip: auto !important;
        clip-path: none !important;
    }

    .trm-a4 .trm-header,
    .trm-a4 header.trm-header {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .trm-a4 .trm-footer,
    .trm-a4 footer.trm-footer {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
        margin-top: 20px !important;
    }

    .trm-a4 .trm-header-top {
        display: flex !important;
        align-items: center !important;
        gap: 14px !important;
    }

    /* LOGO — super específico pra vencer qualquer coisa */
    .trm-a4 .trm-header .trm-header-top .trm-logo,
    .trm-a4 .trm-header .trm-header-top img.trm-logo,
    .trm-a4 img.trm-logo {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 110px !important;
        max-width: 110px !important;
        min-width: 110px !important;
        height: auto !important;
        max-height: none !important;
        object-fit: contain !important;
        flex-shrink: 0 !important;
        clip: auto !important;
        clip-path: none !important;
        filter: none !important;
        transform: none !important;
    }

    .trm-a4 .trm-orgao,
    .trm-a4 .trm-meta,
    .trm-a4 .trm-decl,
    .trm-a4 h1 {
        display: block !important;
    }

    /* --------------------------------------------------
       5) Nada quebra no meio
       -------------------------------------------------- */
    .trm-header,
    .trm-footer,
    .trm-table tr,
    .trm-table td,
    .trm-table th {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}
