/* ============================================
   VARIÁVEIS E TEMAS GLOBAIS
   ============================================ */

:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    
    --transition-all: all 0.3s ease;
}

/* ============================================
   RESET E ESTILOS BASE
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #212529;
    line-height: 1.6;
}

/* ============================================
   COMPONENTES GLOBAIS
   ============================================ */

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-all);
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

/* Botões */
.btn {
    border-radius: 0.375rem;
    font-weight: 600;
    transition: var(--transition-all);
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-primary:hover {
    transform: translateY(-1px);
}

/* Forms */
.form-control,
.form-select {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    transition: var(--transition-all);
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--danger-color);
}

.form-control.is-valid,
.form-select.is-valid {
    border-color: var(--success-color);
}

.form-label {
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Tabelas */
.table {
    font-size: 0.9rem;
}

.table thead th {
    background-color: #f8f9fa;
    border-color: #dee2e6;
    font-weight: 600;
    color: #495057;
}

.table tbody tr {
    transition: var(--transition-all);
}

.table tbody tr:hover {
    background-color: #f5f7fa;
}

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-ativo {
    background-color: #d4edda;
    color: #155724;
}

.badge-vencido {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-vencendo {
    background-color: #fff3cd;
    color: #856404;
}

.badge-suspenso {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Alertas */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--info-color);
}

/* ============================================
   SPINNER E LOADING
   ============================================ */

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

.loading-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============================================
   NOTIFICAÇÕES
   ============================================ */

.notification-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.notification {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    margin-bottom: 10px;
    animation: popIn 0.4s ease;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    pointer-events: auto;
    min-width: 300px;
    border-left: 4px solid #ccc;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.8);
        opacity: 0;
    }
}

.notification.error {
    border-left: 4px solid var(--danger-color);
}

.notification.success {
    border-left: 4px solid var(--success-color);
}

.notification.warning {
    border-left: 4px solid var(--warning-color);
}

.notification.info {
    border-left: 4px solid var(--info-color);
}

.notification-icon {
    font-size: 1.25rem;
    min-width: 20px;
    text-align: center;
}

.notification.error .notification-icon {
    color: var(--danger-color);
}

.notification.success .notification-icon {
    color: var(--success-color);
}

.notification.warning .notification-icon {
    color: var(--warning-color);
}

.notification.info .notification-icon {
    color: var(--info-color);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .table {
        font-size: 0.8rem;
    }
    
    .form-label {
        font-size: 0.85rem;
    }
    
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    .notification-container {
        max-width: 95%;
        left: 2.5%;
        right: 2.5%;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */

.text-muted {
    color: #6c757d;
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-info {
    color: var(--info-color);
}

.mb-0 {
    margin-bottom: 0;
}

.mt-auto {
    margin-top: auto;
}

.cursor-pointer {
    cursor: pointer;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   ANIMAÇÕES
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   TOOLTIPS CUSTOMIZADOS
   ============================================ */

[data-bs-toggle="tooltip"] {
    cursor: help;
    border-bottom: 1px dotted rgba(0, 0, 0, 0.3);
}

.tooltip.show {
    opacity: 1;
}

.tooltip-inner {
    background-color: #2c3e50;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
    max-width: 250px;
    padding: 0.75rem;
    text-align: left;
}

/* ============================================
   IMPRESSÃO
   ============================================ */

@media print {
    .navbar,
    .btn,
    .notification-container,
    .modal {
        display: none !important;
    }
    
    body {
        background-color: white;
    }
    
    .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* ============================================
   ABAS (TABS)
   ============================================ */

.nav-tabs {
    border-bottom: none;
    gap: 0;
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.nav-tabs .nav-link {
    color: #000000 !important;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid #0d6efd;
    border-radius: 0;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: none;
    font-size: 0.95rem;
}

.nav-tabs .nav-link:hover {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
    background-color: transparent;
}

.nav-tabs .nav-link.active {
    color: #ffffff;
    background-color: #0d6efd;
    border: none;
    border-bottom: none;
    border-radius: 0.375rem;
    padding: 0.75rem 1.5rem;
}

.tab-content {
    margin-top: 1rem;
}

.tab-pane {
    animation: slideInUp 0.3s ease;
}

/* ============================================
   ACCORDIONS - RELATÓRIOS
   ============================================ */

.accordion {
    margin-bottom: 1rem;
}

.accordion .accordion-button {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border: 1px solid #e9ecef;
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
}

.accordion .accordion-button:not(.collapsed) {
    background-color: #e7f3ff;
    color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
    border-color: #b6d4fe;
}

.accordion .accordion-button:hover {
    background-color: #f0f2f5;
    color: #212529;
}

.accordion .accordion-button:not(.collapsed):hover {
    background-color: #d4e9ff;
}

.accordion .accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
    border-color: #86b7fe;
}

.accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23667eea'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.accordion-body {
    padding: 1.25rem;
    border-top: 1px solid #e9ecef;
    background-color: #ffffff;
}

.accordion-body table {
    margin-bottom: 0;
}

.accordion-item {
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.accordion-item:not(:first-child) {
    margin-top: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .accordion .accordion-button {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }
    
    .accordion-body {
        padding: 1rem;
    }
}

/* ============================================
   PAGINAÇÃO - RELATÓRIOS
   ============================================ */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
    flex-wrap: wrap;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    border: 1px solid #e9ecef;
}

.pagination-container button {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.pagination-container button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.pagination-container button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background-color: #e9ecef !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
}

.pagination-container span {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
}

.pagination-container .btn-outline-secondary {
    color: #6c757d;
    border-color: #dee2e6;
    background-color: #ffffff;
}

.pagination-container .btn-outline-secondary:not(:disabled):hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #495057;
}

.pagination-container .btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
    background-color: transparent;
    font-weight: 600;
    cursor: default;
}

/* Responsive adjustments for pagination */
@media (max-width: 576px) {
    .pagination-container {
        gap: 0.3rem;
        padding: 0.75rem 0;
    }
    
    .pagination-container button {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .pagination-container span {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
}