/* ESTILOS GERAIS */
:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
}

* {
    box-sizing: border-box;
}

/* Previne overflow e permite crescimento natural do conteúdo */
.section>*,
.card>*,
.modal-content>* {
    max-height: none !important;
}


body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #F9FAFB;
    display: flex;
    height: 100vh;
    overflow: hidden;
    zoom: 0.9;
}

/* MENU LATERAL */
/* MENU LATERAL - ESTRUTURA FLEXBOX CORRETA */
.sidebar {
    width: 280px;
    background-color: #ffffff;
    color: #4B5563;
    display: flex;
    flex-direction: column;
    /* Pilha vertical */
    flex-shrink: 0;
    position: relative;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    border-right: 1px solid #E5E7EB;
    height: 100vh;
    /* Altura total da tela */
    overflow: hidden;
    /* Sem scroll na sidebar inteira, só na lista */
    z-index: 50;
}

.sidebar h2 {
    text-align: center;
    padding: 20px;
    margin: 0;
    color: #1F2937;
    font-weight: 700;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

/* Links do Menu - Ocupam espaço disponível */
#menu-items-container {
    flex-grow: 1;
    /* Empurra o rodapé para baixo */
    overflow-y: auto;
    /* Scroll apenas nos links */
    overflow-x: hidden;
    padding: 10px 0;

    /* Esconde scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#menu-items-container::-webkit-scrollbar {
    display: none;
}

.menu-item {
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: #4B5563;
    font-weight: 500;
    border-radius: 8px;
    margin: 6px 12px;
}

.menu-item:hover {
    background-color: #F3F4F6;
    color: #1F2937;
}

.menu-item.active {
    background-color: #EEF2FF;
    color: #4F46E5;
    font-weight: 600;
}

/* Rodapé fixo da sidebar */
.sidebar-footer {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

.user-info-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: #6B7280;
}

.logout-icon {
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    color: #6B7280;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TOP BAR (Barra Superior com Sino) */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #fff;
    border-bottom: 1px solid #E5E7EB;
    position: sticky;
    top: 0;
    z-index: 100;
    margin: -20px -20px 20px -20px;
    /* Compensa o padding do container principal */
}

.top-bar h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #111827;
}

.notification-bell {
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-bell:hover {
    background-color: #F3F4F6;
}

.badge-count {
    position: absolute;
    top: 0;
    right: 0;
    background-color: #EF4444;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid white;
}

.logout-icon:hover {
    background-color: #FEE2E2;
    color: #DC2626;
}


/* ÁREA DE CONTEÚDO */
.content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    background-color: #F9FAFB;
    padding: 20px;
}

/* Container principal do app - Ocupa tela restante e tem scroll próprio */
#main-app-container {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    /* Scroll principal da página */
    overflow-x: hidden;
    background-color: #F9FAFB;
    padding: 20px 40px;
    /* Mais padding lateral */
    display: flex;
    flex-direction: column;
}

/* Seções (Cards) - width 100% para preencher espaço */
.section {
    width: 100%;
    max-width: 100%;
    /* Remove limite de largura */
    margin-bottom: 30px;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-height: auto;
    /* Deixa altura fluida */
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.section.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* TABELAS */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ========== TABELAS CLEAN UI ========== */
th,
td {
    padding: 20px 16px;
    text-align: left;
    border-bottom: 1px solid #E2E8F0;
}

th {
    background-color: transparent;
    color: #64748B;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E2E8F0;
}

tr:hover {
    background-color: #F8FAFC;
    transition: background-color 0.2s ease;
}

tbody tr {
    transition: all 0.2s ease;
}

/* Container de tabelas expansivo */
.table-container,
.table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    min-height: 400px;
    max-height: calc(100vh - 250px);
}

.table-container table,
.table-wrapper table {
    width: 100%;
}

/* Mapa Interativo Expansivo */
#mapa-container,
.mapa-container,
#mapa-view {
    height: calc(100vh - 80px) !important;
    width: 100%;
    min-height: 600px;
}

#mapa-canvas,
.mapa-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Classes Utilitárias para Layout Expansivo */
.container-fluid,
.full-width {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.h-full {
    height: 100%;
}

.flex-1 {
    flex: 1;
}

/* Garantir que todos os elementos internos ocupem 100% da largura */
.section>.card,
.section>div,
.section table,
.card-kpi,
.form-grid,
.config-tabs {
    width: 100% !important;
    max-width: 100% !important;
}

/* Remover margens laterais excessivas */
.section>* {
    margin-left: 0 !important;
    margin-right: 0 !important;
}


/* ========== BADGES PILL MODERNOS ========== */
.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
}

/* Badge Verde - Ativo/Sucesso */
.bg-green {
    background-color: #D1FAE5;
    color: #065F46;
}

/* Badge Vermelho - Erro/Inativo */
.bg-red {
    background-color: #FEE2E2;
    color: #991B1B;
}

/* Badge Amarelo - Pendente/Aviso */
.bg-yellow {
    background-color: #FEF3C7;
    color: #D97706;
}

/* Badge Azul - Informação */
.bg-blue {
    background-color: #DBEAFE;
    color: #1E40AF;
}

/* Badge Roxo - Especial */
.bg-purple {
    background-color: #EDE9FE;
    color: #6B21A8;
}

.status-danger {
    background-color: #FEF2F2;
    border-left: 4px solid #EF4444;
    padding: 12px;
    border-radius: 6px;
}

#nova-prevenda {
    overflow-y: auto;
    max-height: calc(100vh - 80px);
    padding-bottom: 80px;
}

/* FORMULÁRIOS */
.card-prevenda {
    background: white;
    border: 1px solid #eee;
    border-left: 4px solid var(--accent);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ========== CARDS CLEAN UI ========== */
.card {
    background: white;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    border: 1px solid #F1F5F9;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.full-width {
    grid-column: 1 / -1;
}

/* ========== FORMULÁRIOS CLEAN UI ========== */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
    letter-spacing: 0.2px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: #FFFFFF;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder {
    color: #94A3B8;
}

/* ========== BOTÕES MODERNOS ========== */
.btn {
    padding: 12px 24px;
    height: 48px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* Botão Verde - Sucesso/Salvar */
.btn-green {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-green:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Botão Azul - Primário */
.btn-blue {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-blue:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-small {
    padding: 8px 16px;
    height: 36px;
    font-size: 0.85rem;
}

/* ========== BOTÕES DE AÇÃO COM ÍCONES (Editar/Excluir) ========== */
.action-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    color: #94A3B8;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.action-btn:hover {
    background-color: #F1F5F9;
    transform: scale(1.1);
}

.action-btn.edit:hover {
    color: #3B82F6;
    background-color: #DBEAFE;
}

.action-btn.delete:hover {
    color: #EF4444;
    background-color: #FEE2E2;
}

.action-btn.view:hover {
    color: #8B5CF6;
    background-color: #EDE9FE;
}

/* ========== SEGMENTED CONTROL (Pessoa Física/Jurídica) ========== */
.segmented-control {
    display: inline-flex;
    background-color: #F1F5F9;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 20px;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748B;
    background-color: transparent;
    margin-bottom: 0;
    letter-spacing: 0.3px;
}

.segmented-control input[type="radio"]:checked+label {
    background-color: white;
    color: #1E293B;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.segmented-control label:hover {
    color: #1E293B;
}


/* LEGENDAS E STATUS */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

/* MODAL */

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    width: 95%;
    max-width: 1200px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.radio-box {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    /* Style Reset for Container */
    background: transparent;
    border: none;
    padding: 0;
}

.radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    background: #fff;
    border: 2px solid #e0e0e0;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 180px;
    /* Tamanho fixo e menor */
    text-align: center;
    color: #555;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-size: 0.9em;
}

.radio-label:hover {
    border-color: #bdc3c7;
    transform: translateY(-2px);
}

/* Estilo Ativo (Moderno) */
.radio-label:has(input:checked) {
    border-color: var(--accent);
    background-color: #f0f9ff;
    color: var(--accent);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
}

.radio-label input[type="radio"] {
    accent-color: var(--accent);
    transform: scale(1.3);
    margin: 0;
}

.radio-label input[type="radio"] {
    transform: scale(1.2);
    margin: 0;
}

.close-btn {
    float: right;
    cursor: pointer;
    font-size: 1.5rem;
    border: none;
    background: none;
    line-height: 1;
}

/* CONTRATO A4 */
#area-contrato {
    display: none;
    margin-top: 20px;
}

.folha-a4 {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    margin: 0 auto;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    color: black;
    line-height: 1.6;
    text-align: justify;
}

.assinaturas {
    margin-top: 80px;
    display: flex;
    justify-content: space-between;
}

.linha {
    border-top: 1px solid black;
    width: 40%;
    text-align: center;
    padding-top: 5px;
}

/* CONFIG TABS */
.config-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #eee;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: #7f8c8d;
    font-weight: 600;
    position: relative;
    transition: all 0.3s;
    border-radius: 4px 4px 0 0;
}

.tab-btn:hover {
    color: var(--primary);
    background: #f8f9fa;
}

.tab-btn.active {
    color: var(--accent);
    background: white;
    border-bottom: 3px solid var(--accent);
}

.config-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.config-content:first-of-type {
    display: block;
}


/* ========== CARD RADIO BUTTONS (Seleção Visual) ========== */
.card-radio-group {
    display: flex;
    gap: 15px;
    width: 100%;
}

.card-radio-option {
    flex: 1;
    position: relative;
}

.card-radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.card-radio-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
    color: #4B5563;
    font-weight: 500;
}

.card-radio-option input[type="radio"]:checked+label {
    background-color: #EFF6FF;
    border-color: #3B82F6;
    color: #1D4ED8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.card-radio-option label:hover {
    border-color: #9CA3AF;
    background-color: #F9FAFB;
}

/* Utilitários de Botão */
.w-auto {
    width: auto !important;
}

.max-w-250 {
    max-width: 250px;
}

/* TELA DE LOGIN PROFISSIONAL */
#tela-login {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #2c3e50 100%);
    /* Default */
    display: flex;
    /* Flexbox para centralizar */
    justify-content: center;
    /* Centro Horizontal */
    align-items: center;
    /* Centro Vertical */
    z-index: 9999;
}

/* Container interno do login */
#tela-login>div {
    background: white !important;
    padding: 40px !important;
    border-radius: 15px !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3) !important;
    width: 380px !important;
    max-width: 90% !important;
    text-align: center !important;
    animation: fadeIn 0.5s ease-out;
}

#tela-login h2 {
    margin-top: 0;
    color: var(--primary);
    margin-bottom: 20px;
}
/* BOTES PADRONIZADOS */
.btn { height: 48px; padding: 0 24px; border-radius: 8px; border: none; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; font-size: 0.95rem; gap: 8px; }
.btn-small { height: 36px; padding: 0 16px; font-size: 0.85rem; }
/* CARDS DE SELEO (RADIO REPLACEMENT) */
.card-radio-group { display: flex; gap: 15px; }
.card-radio-option { flex: 1; position: relative; }
.card-radio-option input[type='radio'] { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 2; }
.card-radio-option label { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 15px; border: 2px solid #E5E7EB; border-radius: 10px; background-color: #fff; cursor: pointer; transition: all 0.2s; height: 100%; color: #6B7280; font-weight: 500; }
.card-radio-option input[type='radio']:checked + label { border-color: #3B82F6; background-color: #EFF6FF; color: #1D4ED8; font-weight: 600; box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2); }
.card-radio-option label:hover { border-color: #9CA3AF; }
.w-auto { width: auto !important; }
.max-w-250 { max-width: 250px; }
.flex-end { justify-content: flex-end; }

/* Tabelas Full Width */
table { width: 100% !important; border-collapse: collapse; }
.section { width: 100% !important; max-width: 100% !important; }

.config-content .card { padding: 32px !important; margin-top: 20px; }

#main-app-container { position: relative; }

/* Menu lateral altura total */
.sidebar {
    min-height: 100vh !important;
    height: 100vh !important;
}
