/* Estilos Personalizados para Sistema de Gestión Financiera */

/* === Animaciones === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === Utilidades de Animación === */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-in {
    animation: slideIn 0.4s ease-out;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

/* === Mejoras de Cards === */
.card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1) !important;
}

/* === Botones Mejorados === */
.btn {
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

/* === Tablas Responsivas === */
.table-hover tbody tr {
    transition: background-color 0.15s;
}

.table-hover tbody tr:hover {
    cursor: pointer;
}

/* === Badges Mejorados === */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* === Loading States === */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* === Toast Notifications === */
.toast-container {
    z-index: 9999;
}

.toast {
    min-width: 300px;
}

/* === Modo Oscuro - Ajustes Adicionales === */
[data-bs-theme="dark"] .list-group-item {
    background-color: #343a40;
    border-color: #495057;
    color: #dee2e6;
}

[data-bs-theme="dark"] .list-group-item:hover {
    background-color: #495057;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #343a40;
    color: #dee2e6;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #495057;
    border-color: #6c757d;
    color: #dee2e6;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #495057;
    border-color: #0d6efd;
    color: #dee2e6;
}

/* === Intro.js Personalizado === */
.introjs-tooltip {
    max-width: 450px;
}

.introjs-tooltiptext {
    font-size: 15px;
    line-height: 1.6;
}

.introjs-button {
    border: none;
    text-shadow: none;
}

.introjs-button:hover {
    background-color: #0d6efd;
    color: white;
}

/* === Filtros de Tabla === */
.filter-row {
    background-color: #f8f9fa;
}

[data-bs-theme="dark"] .filter-row {
    background-color: #2c3136;
}

.filter-row .filter-input {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    text-align: center;
    transition: all 0.2s;
}

.filter-row .filter-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    text-align: left;
    outline: none;
}

.filter-row .filter-input:not(:placeholder-shown) {
    text-align: left;
    background-color: #fff3cd;
    border-color: #ffc107;
}

[data-bs-theme="dark"] .filter-row .filter-input {
    background-color: #495057;
    border-color: #6c757d;
    color: #dee2e6;
}

[data-bs-theme="dark"] .filter-row .filter-input:not(:placeholder-shown) {
    background-color: #664d03;
    border-color: #ffc107;
}

/* === Búsqueda Global === */
#searchModal .modal-dialog {
    margin-top: 10vh;
}

#searchModal input {
    font-size: 1.2rem;
}

#searchResults .list-group-item {
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

#searchResults .list-group-item:hover {
    border-left-color: #0d6efd;
    transform: translateX(3px);
}

/* === Indicadores de Estado === */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.active {
    background-color: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.6);
}

.status-indicator.pending {
    background-color: #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.6);
}

.status-indicator.inactive {
    background-color: #6c757d;
}

/* === Progress Bars Mejorados === */
.progress {
    position: relative;
    overflow: visible;
}

.progress-bar {
    transition: width 0.6s ease;
}

.progress-bar[aria-valuenow="100"] {
    animation: pulse-animation 1.5s ease-in-out infinite;
}

/* === Tooltips Personalizados === */
.custom-tooltip {
    position: relative;
    display: inline-block;
}

.custom-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    font-size: 0.85rem;
}

.custom-tooltip:hover::after {
    opacity: 1;
}

/* === Scroll Suave === */
html {
    scroll-behavior: smooth;
}

/* === Skeleton Loading === */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

[data-bs-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #495057 25%, #6c757d 50%, #495057 75%);
    background-size: 200% 100%;
}

/* === Accesibilidad === */
.visually-hidden-focusable:focus {
    position: absolute;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
}

/* === Print Styles === */
@media print {
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .card {
        page-break-inside: avoid;
    }
}

/* === Responsive Adjustments === */
@media (max-width: 768px) {
    #searchModal .modal-dialog {
        margin: 5vh 1rem;
    }
    
    .introjs-tooltip {
        max-width: 90vw;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
}

/* === Utilidades Personalizadas === */
.text-shadow {
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.box-shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

.box-shadow {
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
}

.box-shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.175);
}

/* === Efectos Hover para Cards Interactivos === */
.card-interactive {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-interactive:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15) !important;
}

.card-interactive:active {
    transform: translateY(-2px);
}

/* === Iconos Animados === */
.icon-spin {
    animation: icon-spin 2s linear infinite;
}

@keyframes icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.icon-bounce {
    animation: icon-bounce 1s ease infinite;
}

@keyframes icon-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* === Dividers Mejorados === */
.divider-text {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #dee2e6;
}

.divider-text span {
    padding: 0 1rem;
    color: #6c757d;
    font-size: 0.9rem;
}

[data-bs-theme="dark"] .divider-text::before,
[data-bs-theme="dark"] .divider-text::after {
    border-bottom-color: #495057;
}

/* === Focus Visible (Mejor Accesibilidad) === */
*:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* === Transitions Suaves para Todo === */
* {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
