/* Reset e Estilos Gerais */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f9;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
}

/* Header Principal */
.main-header {
    background: linear-gradient(to right, #2c3e50, #4ca1af);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.main-header h1 {
    font-size: 24px;
    margin: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    font-weight: 500;
}

.btn-logout {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background 0.3s;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Área de Botões Globais */
.global-actions-panel {
    margin: 0 auto 20px auto;
    max-width: 1200px;
    padding: 0 15px;
}

.btn-global-action {
    background: linear-gradient(135deg, #009688, #00796b);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-global-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #00bfa5, #00897b);
}

/* Painel de Filtros */
.filter-panel {
    background-color: white;
    padding: 20px;
    margin: 0 auto 20px auto;
    max-width: 1200px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

.form-group input, 
.form-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus, 
.form-group select:focus {
    border-color: #4ca1af;
    outline: none;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.btn-filtrar {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-filtrar:hover {
    background-color: #1976d2;
}

.btn-limpar {
    background-color: #e0e0e0;
    color: #555;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-limpar:hover {
    background-color: #d5d5d5;
}

/* Tabela de Dados */
.table-container {
    max-width: 1200px;
    margin: 0 auto 20px auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

tr:hover {
    background-color: #f1f1f1 !important;
}

tbody tr:nth-child(even),
table tr:nth-child(even) {
    background-color: #fafafa !important;
}

tbody tr:nth-child(even):hover,
table tr:nth-child(even):hover {
    background-color: #f1f1f1 !important;
}

.linha-zebrada {
    background-color: #fafafa !important;
}

.linha-zebrada:hover {
    background-color: #f1f1f1 !important;
}

/* Coluna de Ações e Botões */
.actions-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    color: white;
    font-size: 14px;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-action:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn-status { background-color: #ff9800; }
.btn-obrigacoes { background-color: #607d8b; }
.btn-mensagem { background-color: #9c27b0; }
.btn-sistemas { background-color: #00bcd4; }
.btn-acessos { background-color: #3f51b5; }
.btn-bugs { background-color: #f44336; }
.btn-xml { background-color: #4caf50; }
.btn-impedimento, .btn-bloquear { background-color: #795548; }
.btn-tipo, .btn-tipo-btn { background-color: #673ab7; }
.btn-boletos { background-color: #455a64; }
.btn-backup { background-color: #00897b; }
.btn-demandas { background-color: #1a237e; } /* Azul escuro para representar desenvolvedor/sistema */
.btn-equipamentos { background-color: #3e2723; } /* Marrom escuro para depósito/equipamentos */
.btn-segmento { background-color: #006064; color: #ffffff; } /* Ciano escuro para segmento comercial */
.btn-action.disabled { opacity: 0.4; pointer-events: none; }

.status-select-fast {
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    width: 140px;
}
.status-select-fast:hover { opacity: 0.85; transform: scale(1.05); }
.select-status-aberta { background-color: #e3f2fd !important; color: #1976d2 !important; border-color: #1976d2 !important; }
.select-status-em_andamento { background-color: #fff3e0 !important; color: #f57c00 !important; border-color: #f57c00 !important; }
.select-status-concluida { background-color: #e8f5e9 !important; color: #388e3c !important; border-color: #388e3c !important; }
.select-status-cancelada { background-color: #ffe0b2 !important; color: #d32f2f !important; border-color: #d32f2f !important; }

/* Badges de Tarefas */
.badge-priority {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}
.priority-baixa { background-color: #e0e0e0; color: #616161; }
.priority-media { background-color: #bbdefb; color: #1976d2; }
.priority-alta { background-color: #ffe0b2; color: #e65100; }
.priority-critica { background-color: #ffcdd2; color: #c62828; }

.badge-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}
.status-aberta { border: 1px solid #1976d2; color: #1976d2; }
.status-em_andamento { border: 1px solid #f57c00; color: #f57c00; }
.status-concluida { border: 1px solid #388e3c; color: #388e3c; }
.status-cancelada { border: 1px solid #d32f2f; color: #d32f2f; }

.btn-icon-only {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
    transition: transform 0.2s;
}
.btn-icon-only:hover { transform: scale(1.2); }
.btn-edit-task { color: #1976d2; }
.btn-delete-task { color: #d32f2f; }
.btn-download-anexo { color: #388e3c; }

/* Scrollbar personalizada para o modal body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}
.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}
.modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Toolbar do Modal de Obrigações */
.toolbar-item {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    color: white;
    vertical-align: middle;
}


/* Flags e Indicadores */
.flag-ativo { color: #4caf50; margin-right: 5px; }
.flag-inativo { color: #f44336; margin-right: 5px; }
.flag-mensagem { color: #ff9800; margin-left: 5px; }
.flag-impedimento { color: #d32f2f; margin-left: 5px; }

/* Layout de 2 linhas por cliente */
tbody.client-group {
    border-bottom: 3px solid #e0e0e0; /* Divisória mais grossa entre clientes */
}

tbody.client-group:hover tr {
    background-color: #f5f5f5; /* Highlight no grupo todo ao passar o mouse */
}

.client-data-row td {
    border-bottom: none !important; /* Remove borda entre dados e ações */
    padding-bottom: 5px;
}

.client-actions-row td {
    border-bottom: none !important; /* Remove borda da célula de ação */
    padding-top: 5px;
    padding-bottom: 15px;
    text-align: center; /* Centraliza botões */
}

.actions-wrapper {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    align-items: center;
    padding: 8px 15px;
    background-color: #f8f9fa;
    border-radius: 20px;
    border: 1px solid #eee;
}

.dot-tipo {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}
.dot-azul { background-color: #2196f3; }
.dot-verde { background-color: #4caf50; }
.dot-laranja { background-color: #ff9800; }
.dot-preta { background-color: #333; }

/* Paginação */
.pagination-container {
    max-width: 1200px;
    margin: 0 auto 30px auto;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    list-style: none;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pagination li {
    border-right: 1px solid #ddd;
}

.pagination li:last-child {
    border-right: none;
}

.pagination a, .pagination span {
    display: block;
    padding: 10px 15px;
    background-color: white;
    color: #333;
    transition: background 0.3s;
}

.pagination a:hover {
    background-color: #eee;
}

.pagination .active span {
    background-color: #2196f3;
    color: white;
}

/* Modais Modernos */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    border-radius: 10px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: linear-gradient(135deg, #2196f3, #1976d2); /* Default Blue */
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-obrigacoes-header {
    background: linear-gradient(135deg, #607d8b, #455a64); /* Blue Grey */
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
    font-weight: 500;
}

.close {
    color: white;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.2s;
}

.close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    background-color: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #eee;
}

/* Cards e Toggle Switches */
.obligation-card {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px; /* Aumentado padding */
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: box-shadow 0.2s;
    min-height: 60px; /* Altura mínima para evitar sobreposição */
}

.obligation-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.obligation-title {
    font-weight: 600;
    color: #444;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 70px; /* Largura ajustada */
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196f3;
}

input:checked + .slider:before {
    transform: translateX(40px); /* Ajustado para largura 70px */
}

.status-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: bold;
    color: white;
}

.status-sim {
    left: 8px;
    opacity: 0;
    transition: opacity 0.4s;
}

.status-nao {
    right: 8px;
    opacity: 1;
    transition: opacity 0.4s;
}

input:checked + .slider .status-sim {
    opacity: 1;
}

input:checked + .slider .status-nao {
    opacity: 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.spinner {
    text-align: center;
    color: #007bff;
}

.spinner i {
    font-size: 40px;
    margin-bottom: 10px;
}

/* Badges de Obrigações - Painel (NOVO) */
.badges-container {
    display: flex;
    gap: 5px;
    justify-content: flex-start;
    align-items: center;
}

.badge-oblig {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 4px 0;
    width: 45px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid transparent;
    transition: all 0.2s;
    cursor: default;
}

/* Estilos Ativos (SIM) */
.badge-active.sin {
    background-color: #e8f5e9; /* Green 50 */
    color: #2e7d32; /* Green 800 */
    border-color: #c8e6c9;
}

.badge-active.icm {
    background-color: #fff3e0; /* Orange 50 */
    color: #ef6c00; /* Orange 800 */
    border-color: #ffe0b2;
}

.badge-active.pis {
    background-color: #f3e5f5; /* Purple 50 */
    color: #7b1fa2; /* Purple 800 */
    border-color: #e1bee7;
}

/* Estilo Inativo (NÃO) */
.badge-inactive {
    background-color: #f5f5f5; /* Grey 100 */
    color: #cfcfcf; /* Grey 400 - bem apagado */
    border-color: #eeeeee;
}

.btn-limpar-data {
    background: #ff5252;
    color: white;
    border: none;
    border-radius: 4px;
    width: 36px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-limpar-data:hover {
    background: #d32f2f;
}

.check-completed {
    color: #2e7d32;
    margin-left: 3px;
    font-size: 10px;
    background: white;
    border-radius: 50%;
    padding: 1px;
}

/* Modal Scrollable (Correção de Rolagem) */
.modal-content-scrollable {
    display: flex;
    flex-direction: column;
    max-height: 90vh !important; /* Força limite de altura */
}

.modal-content-scrollable .modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Alias e Classes Adicionais para Compatibilidade */
@media (max-width: 992px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .user-info {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }
    
    .pagination-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination {
        width: 100%;
        justify-content: center;
    }
    
    .filter-actions {
        justify-content: flex-end;
        width: 100%;
    }

    /* Tabela Responsiva */
    table, thead, tbody, th, td, tr {
        display: block;
    }
    
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    tr {
        border: 1px solid #ddd;
        margin-bottom: 15px;
        border-radius: 8px;
        background: #fff;
    }
    
    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }
    
    td:before {
        position: absolute;
        top: 12px;
        left: 15px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
    }

    .actions-cell {
        justify-content: flex-end;
    }
}

/* Alias e Classes Adicionais para Compatibilidade */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-modern-header {
    background: linear-gradient(135deg, #009688, #00796b);
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.btn-cancelar {
    background-color: #e0e0e0;
    color: #333;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-cancelar:hover {
    background-color: #d5d5d5;
}

.btn-salvar {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-salvar:hover {
    background-color: #1976d2;
}

/* Login Page Styles */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #ece9e6, #ffffff);
}

.login-container {
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-logo {
    max-width: 150px;
    margin-bottom: 20px;
}

.login-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-error {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 40px; /* Space for icon */
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.input-wrapper input:focus {
    border-color: #2196f3;
    outline: none;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(to right, #2196f3, #21cbf3);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}
