:root {
    --primary-color: #d11242;
    --primary-hover: #b80f3a;
    --secondary-color: #f4f4f4;
    --bg-body: #f4f6f9;
    --bg-container: #ffffff;
    --text-main: #2c3e50;
    --text-color: #333;
    --border-color: #e2e8f0;
    --success-color: #28a745;
    --error-color: #dc3545;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f9f9f9;
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px; /* Expandido para acomodar o form maior */
    margin: 0 auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    color: #000;
    margin: 0;
    font-size: 1.5rem;
}

.social-icons .icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    color: white;
    text-decoration: none;
    margin-left: 5px;
    font-weight: bold;
    font-size: 14px;
}
.social-icons .facebook { background-color: #3b5998; }
.social-icons .twitter { background-color: #00aced; }
.social-icons .linkedin { background-color: #007bb6; }

.lembrete {
    font-size: 0.85rem;
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: justify;
}

h2 {
    color: #000;
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: bold;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: bold;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-bottom: none;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"], 
input[type="email"], 
textarea, 
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
}

.disabled-input {
    background-color: #eee;
    color: #888;
}

.radio-group {
    margin-bottom: 15px;
}

.radio-group label {
    display: inline-block;
    margin-right: 15px;
    font-weight: normal;
}

.radio-group label:first-child {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
        padding: 15px;
    }

    .tab-btn.active {
        border-left: none;
        background-color: var(--primary-color);
        color: #ffffff;
    }

    .radio-group label {
        display: block;
        margin-bottom: 10px;
    }
}

.submit-container {
    text-align: right;
    margin-top: 20px;
}

.btn-submit {
    padding: 10px 30px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-submit:hover {
    background: #a30e33;
}

.btn,
.btn-primary,
button[type="submit"],
.submit-container button {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color, #d11242) !important;
    color: #ffffff !important;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s, filter 0.3s;
}

.btn:hover,
.btn-primary:hover,
button[type="submit"]:hover,
.submit-container button:hover {
    filter: brightness(0.9);
    color: #ffffff !important;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

.modal-footer-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-footer-actions .btn {
    flex: 1;
}

@media (max-width: 400px) {
    .modal-footer-actions {
        flex-direction: column;
    }
}

.result-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

.result-message.success {
    display: block;
    background-color: #d4edda;
    color: var(--success-color);
    border: 1px solid #c3e6cb;
}

.result-message.error {
    display: block;
    background-color: #f8d7da;
    color: var(--error-color);
    border: 1px solid #f5c6cb;
}

.result-box {
    margin-top: 15px;
    padding: 15px;
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.hidden {
    display: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
}

.badge-aberto {
    background-color: #d32f2f !important;
    color: #fff !important;
}

.badge-em-andamento {
    background-color: #388e3c !important;
    color: #fff !important;
}

.badge-concluido {
    background-color: #757575 !important;
    color: #fff !important;
}

/* Dashboard Styles */
.dashboard-cards {
    display: flex;
    flex-direction: row;
    gap: 15px;
    flex-wrap: wrap; /* Para responsividade em telas menores */
}

.dashboard-card {
    flex: 1;
    min-width: 150px;
    border: 3px solid var(--border-color);
    border-radius: 8px;
    padding: 20px 15px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dashboard-card .card-value {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 5px;
}

.dashboard-card .card-label {
    font-size: 1rem;
    font-weight: normal;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.dashboard-card svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Card Themes */
.card-total {
    border-color: #1976d2;
    background-color: #e3f2fd;
    color: #1976d2;
}

.card-aberto {
    border-color: #d32f2f;
    background-color: #ffebee;
    color: #d32f2f;
}

.card-andamento {
    border-color: #388e3c;
    background-color: #e8f5e9;
    color: #388e3c;
}

.card-concluido {
    border-color: #757575;
    background-color: #f5f5f5;
    color: #757575;
}

/* Print Styles */
@media print {
    body {
        background-color: #fff;
        padding: 0;
        display: block !important;
    }

    .container {
        box-shadow: none;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    /* General rules */
    .header-actions,
    .print-btn,
    .logout-btn {
        display: none !important;
    }

    .dashboard-card {
        border: 1px solid #000;
    }

    table {
        border: 1px solid #000;
    }

    th, td {
        border: 1px solid #000;
        padding: 5px;
    }

    th {
        background-color: #ddd !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .status-badge {
        border: 1px solid #000;
        color: #000 !important;
        background: transparent !important;
    }

    /* Print General Report specific rules */
    body.print-general-report #main-section,
    body.print-general-report .tabs,
    body.print-general-report .filter-section,
    body.print-general-report .filter-builder-container,
    body.print-general-report #users-section,
    body.print-general-report #manifestationModal,
    body.print-general-report #reports-section h2,
    body.print-general-report #reports-section > div:first-of-type /* filter buttons */ {
        display: none !important;
    }

    body.print-general-report #reports-section {
        display: block !important;
    }

    body.print-general-report #reports-section td:last-child,
    body.print-general-report #reports-section th:last-child {
        display: none !important;
    }

    body.print-general-report tr.sla-warning {
        background-color: #fff3cd !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.print-general-report tr.sla-critical {
        background-color: #f8d7da !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }


    /* Print Individual Protocol specific rules */
    body.print-individual #main-section,
    body.print-individual #reports-section,
    body.print-individual .tabs,
    body.print-individual .filter-section,
    body.print-individual .filter-builder-container,
    body.print-individual #users-section,
    body.print-individual header {
        display: none !important;
    }

    body.print-individual #manifestationModal {
        display: block !important;
        position: static !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        left: 0 !important;
        margin-left: 0 !important;
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    body.print-individual .modal-content {
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        left: 0 !important;
        margin-left: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        color: #000 !important;
    }

    body.print-individual .modal-content * {
        color: #000 !important;
    }

    body.print-individual #modalDetails p,
    body.print-individual #modalDetails > div {
        page-break-inside: avoid;
    }

    body.print-individual #interactionsTimeline {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    body.print-individual #interactionsTimeline > div {
        page-break-inside: avoid;
    }

    body.print-individual #manifestationModal .close-btn,
    body.print-individual #manifestationModal #interactionForm,
    body.print-individual #manifestationModal #replyHeading,
    body.print-individual #manifestationModal #modalBackBtn,
    body.print-individual #manifestationModal .modal-footer-actions,
    body.print-individual #manifestationModal .btn {
        display: none !important;
    }

    /* Default printing when print button clicked on dashboard */
    body:not(.print-general-report):not(.print-individual) #main-section td:last-child,
    body:not(.print-general-report):not(.print-individual) #main-section th:last-child {
         display: none !important;
    }
}

/* SLA Alert */
tr.sla-warning {
    background-color: #fff3cd !important;
}

tr.sla-critical {
    background-color: #f8d7da !important;
}

/* Orientações */
.orientacoes-container {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-left: 4px solid #d11242 !important;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.orientacoes-titulo {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 15px;
}

.orientacoes-lista {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 0;
    padding-left: 20px;
    color: #444; /* Dark gray */
}

.orientacoes-lista li::marker {
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .orientacoes-lista {
        grid-template-columns: 1fr;
    }
}

/* Success Card */
.success-card {
    display: block;
    background-color: #d4edda;
    color: var(--success-color);
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    min-height: 250px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.success-card h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.5rem;
    color: #155724;
}

.success-card .protocol-number {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 20px 0;
    padding: 10px 20px;
    background: #fff;
    border: 2px dashed #28a745;
    border-radius: 4px;
    display: inline-block;
}

.btn-reload {
    margin-top: 20px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-reload:hover {
    background: #a30e33;
}

/* Padronização Global de Fontes */
body, input, select, button, textarea {
    font-family: inherit;
    font-size: 14px;
}

/* Alinhamento do Menu Superior */
.top-action-menu {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    justify-content: flex-end;
    flex-direction: column;
}

.top-action-menu .btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 16px;
    font-weight: 500;
    white-space: nowrap;
    width: 150px;
    box-sizing: border-box;
}

/* Padronização da Barra de Filtros */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-bar select,
.filter-bar input[type="text"],
.filter-bar input[type="date"] {
    height: 38px;
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    box-sizing: border-box;
}

/* Container Responsivo para Tabela */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.btn-sm.btn-secondary { display: inline-block; width: auto; }

.tab-link, .nav-link, a.protocol-link {
    color: #d11242;
}
.tab-link:hover, .nav-link:hover, a.protocol-link:hover {
    color: #b80f3a;
}

html[data-font-size="small"] body { font-size: 14px; }
html[data-font-size="medium"] body { font-size: 16px; }
html[data-font-size="large"] body { font-size: 18px; }
