:root {
    --bs-body-bg: #f8f9fa;
    --bs-body-color: #212529;
    --blue-dark: #003366;
    --blue-main: #004D99;
    --blue-light: #3385FF;
    --text-light: #FFFFFF;
    /* Adicionado cores para o extrato */
    --bs-success-dark: #146c43; /* Verde mais escuro para crédito */
    --bs-danger-dark: #a52834;  /* Vermelho mais escuro para débito */
    --bs-secondary-text: #6c757d; /* Cor para texto secundário */
}

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

body { font-family: 'Poppins', sans-serif; background-color: var(--bs-body-bg); color: var(--bs-body-color); }
.hidden { display: none !important; }

/* --- Seção de Login --- */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background-color: var(--bs-body-bg); }
.login-box { background-color: var(--text-light); color: var(--bs-body-color); padding: 3rem; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); text-align: center; width: 100%; max-width: 450px; border-top: 5px solid var(--blue-main); }
.login-box h1 { font-weight: 700; color: var(--blue-main); }
.login-box .subtitle { color: #6c757d; }

/* Login card styles for centered layout with border */
.login-card {
    background-color: var(--text-light);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid #d1d5db;
    overflow: hidden;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
}

/* --- Layout Principal & Dashboard --- */
.navbar { background-color: var(--blue-dark); }
.navbar-brand-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}
.navbar-brand {
    margin-bottom: 0;
    padding-bottom: 0;
}
.tenant-identifier-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, rgba(51, 133, 255, 0.2), rgba(0, 77, 153, 0.2));
    border: 1px solid rgba(51, 133, 255, 0.4);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}
.tenant-identifier-badge:hover {
    background: linear-gradient(135deg, rgba(51, 133, 255, 0.3), rgba(0, 77, 153, 0.3));
    border-color: rgba(51, 133, 255, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.tenant-icon {
    font-size: 0.85rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}
.tenant-label {
    text-transform: uppercase;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.main-content { min-height: calc(100vh - 70px); }
h2, h5 { color: var(--blue-main); font-weight: 500; }
.card { border: none; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.btn-primary { background-color: var(--blue-light); border-color: var(--blue-light); }
.btn-primary:hover { background-color: var(--blue-main); border-color: var(--blue-main); }
.feedback-card { border-left-width: 5px; }
.feedback-card.error { border-left-color: var(--bs-danger); }
.feedback-card.success { border-left-color: var(--bs-success); }
.modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 1050; }
.modal-content { background-color: white; color: var(--bs-body-color); padding: 2rem; border-radius: 8px; width: 100%; max-width: 500px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }

/* --- Dashboard "Marketplace" --- */
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.service-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}
.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.service-card .icon {
    font-size: 2.5rem;
    color: var(--blue-main);
    margin-bottom: 1rem;
}
.service-card h5 {
    font-weight: 700;
}
.service-card p {
    font-size: 0.9rem;
    color: #6c757d;
}

/* --- ESTILOS NOVOS E AJUSTADOS PARA EXTRATO E SALDO --- */
.text-credit {
    color: var(--bs-success-dark);
    font-weight: 500;
}
.text-debit {
    color: var(--bs-danger-dark);
    font-weight: 500;
}
.text-balance-positive {
    color: var(--bs-success-dark);
    font-weight: 600;
}
.text-balance-negative {
    color: var(--bs-danger-dark);
    font-weight: 600;
}

/* --- RESPONSIVE MODAL SIZING FOR DASHBOARD CARDS --- */
/* Custom responsive modal sizes for Client Lookup and Tax Simulator */
/* Mobile: Default Bootstrap sizes */
/* Desktop: Double the size for better visualization */

/* Client Lookup Modal - Responsive sizing */
#client-lookup-modal .modal-dialog {
    max-width: 500px; /* Mobile default */
}

@media (min-width: 768px) {
    #client-lookup-modal .modal-dialog {
        max-width: 800px; /* Tablet - increased from default */
    }
}

@media (min-width: 992px) {
    #client-lookup-modal .modal-dialog {
        max-width: 1400px; /* Desktop - approximately doubled for better visualization */
        max-height: 90vh;
    }
    
    #client-lookup-modal .modal-content {
        min-height: 600px;
    }
}

/* Tax Simulator Modal - Responsive sizing */
#tax-simulator-modal .modal-dialog {
    max-width: 500px; /* Mobile default */
}

@media (min-width: 768px) {
    #tax-simulator-modal .modal-dialog {
        max-width: 900px; /* Tablet - increased from default */
    }
}

@media (min-width: 992px) {
    #tax-simulator-modal .modal-dialog {
        max-width: 2000px; /* Desktop - significantly expanded for complex forms */
        max-height: 90vh;
    }
    
    #tax-simulator-modal .modal-content {
        min-height: 700px;
    }
    
    #tax-simulator-modal .modal-body {
        max-height: calc(90vh - 100px);
        overflow-y: auto;
    }
}

/* Password Reset Modal - Responsive sizing (also has modal-lg) */
#password-reset-modal .modal-dialog {
    max-width: 500px; /* Mobile default */
}

@media (min-width: 768px) {
    #password-reset-modal .modal-dialog {
        max-width: 800px; /* Tablet - increased from default */
    }
}

@media (min-width: 992px) {
    #password-reset-modal .modal-dialog {
        max-width: 1400px; /* Desktop - approximately doubled for better visualization */
        max-height: 90vh;
    }
    
    #password-reset-modal .modal-content {
        min-height: 600px;
    }
}

/* ===== TICKETS & KANBAN BOARD ===== */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    min-height: 500px;
}

.kanban-column {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.kanban-column-header h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.kanban-column-body {
    flex: 1;
    min-height: 300px;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.kanban-column-body.drag-over {
    background-color: #e7f3ff;
    border: 2px dashed #0d6efd;
}

.kanban-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.kanban-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: move;
}

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.kanban-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0.5rem 0;
    color: #212529;
}

.kanban-card-client {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0.25rem 0;
}

.kanban-card-date {
    font-size: 0.75rem;
    color: #6c757d;
    display: block;
    margin-top: 0.5rem;
}

/* Tickets Modal Responsive */
#tickets-modal .modal-dialog {
    max-width: 95vw;
}

@media (min-width: 992px) {
    #tickets-modal .modal-dialog {
        max-width: 1400px;
    }
    
    .kanban-board {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
    
    .kanban-column-body {
        min-height: 200px;
    }
}

/* --- AI Assistant Section --- */
.bg-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

/* Smooth transitions for manual form toggle */
#manual-form-container {
    transition: all 0.3s ease-in-out;
}

/* AI prompt textarea styling */
#ai-prompt-input {
    resize: vertical;
    min-height: 150px;
}

#ai-prompt-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Toggle button animation */
#toggle-manual-form-btn i {
    transition: transform 0.3s ease;
}

/* AI generation result animations */
#ai-generation-result {
    animation: fadeIn 0.3s ease-in;
}

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