:root {
    /* Paleta principal moderna */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --secondary: #06b6d4;
    --secondary-light: #22d3ee;
    --secondary-dark: #0891b2;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    
    /* Estados */
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Grises modernos */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Background */
    --body-bg: linear-gradient(135deg, #f5f7fa 0%, #e9ecf1 100%);
    --card-bg: #ffffff;
    
    /* Sombras modernas */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Bordes */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: var(--body-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

.app-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  box-shadow: var(--shadow-lg);
  color: white;
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}

.app-header h1 {
    color: white;
    font-weight: 700;
    font-size: 1.875rem;
    letter-spacing: -0.025em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header .subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}

.stats-badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 0.625rem 1.125rem;
    transition: all var(--transition-base);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stats-badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.stats-badge .stats-number {
    font-weight: 700;
    font-size: 1.25rem;
    color: white;
    letter-spacing: -0.025em;
}

.stats-badge .stats-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
}

.app-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    margin-bottom: 2rem;
}

.app-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

.app-card .card-header {
    background: linear-gradient(to bottom, var(--gray-50), white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.25rem 1.5rem;
}

.app-card .card-title {
    font-weight: 600;
    margin-bottom: 0;
    color: var(--gray-900);
    font-size: 1.125rem;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-card .card-title svg {
    color: var(--primary);
}

.app-card .card-body {
    padding: 1.75rem;
}

.filter-form .form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
}

.filter-form .form-control {
    border-radius: var(--radius-md);
    border: 1.5px solid var(--gray-300);
    padding: 0.625rem 0.875rem;
    transition: all var(--transition-fast);
    font-size: 0.9375rem;
    background-color: white;
}

.filter-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
    background-color: white;
}

.filter-form .form-control:hover:not(:focus) {
    border-color: var(--gray-400);
}

.filter-buttons {
    margin-top: 1.75rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.table thead th {
    background: linear-gradient(to bottom, var(--gray-100), var(--gray-50));
    color: var(--gray-900);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-300);
    padding: 1rem 0.875rem;
    white-space: nowrap;
}

.table thead th:hover {
    background: linear-gradient(to bottom, var(--gray-200), var(--gray-100));
}

.table tbody tr {
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.04);
    transform: scale(1.001);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.table tbody td {
    vertical-align: middle;
    padding: 1rem 0.875rem;
    font-size: 0.9375rem;
}

.amount-cell {
    font-weight: 600;
    text-align: right;
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}

.chart-wrapper {
    margin-bottom: 2rem;
}

.chart-container {
    position: relative;
    height: 320px;
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
    letter-spacing: 0.01em;
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.btn-secondary {
    background: white;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-700);
    transition: all var(--transition-base);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-900);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.2);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    color: var(--primary);
    width: 3rem;
    height: 3rem;
}

.select2-container .select2-search--inline .select2-search__field {
    height: 35px!important;

}


.select2-container {
    width: 100% !important;
}
.select2-container--default .select2-selection--multiple {
    border-radius: var(--radius-md);
    border: 1.5px solid var(--gray-300);
    min-height: 42px;
    transition: all var(--transition-fast);
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.select2-container--default .select2-selection--multiple:hover:not(.select2-container--focus .select2-selection--multiple) {
    border-color: var(--gray-400);
}

.select2-container--bootstrap-5 .select2-selection {
    border-color: #dee2e6;
    min-height: 38px;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered {
    padding: 0 8px;
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    margin: 4px 4px 4px 0;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.2);
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove {
    color: rgba(255, 255, 255, 0.8);
    margin-right: 4px;
    transition: color var(--transition-fast);
}

.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: white;
}

.select2-container--bootstrap-5 .select2-search--inline .select2-search__field {
    margin-top: 6px;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: #dee2e6;
}

.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
    background-color: #0d6efd;
}

@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .stats-badge {
        padding: 0.4rem 0.8rem;
    }
}

/* Navegación entre páginas */
.page-navigation {
    margin-top: 1rem;
}

.page-navigation .nav-link {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    padding: 0.875rem 1.75rem;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    letter-spacing: 0.01em;
}

.page-navigation .nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.page-navigation .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.page-navigation .nav-link svg {
    flex-shrink: 0;
}

/* Estilos para badges modernos */
.badge {
    border-radius: var(--radius-md);
    padding: 0.375rem 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    transition: all var(--transition-fast);
}

.badge.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.badge.bg-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.badge.bg-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.badge.bg-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.3);
}

.badge.bg-info {
    background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%) !important;
    box-shadow: 0 2px 4px rgba(6, 182, 212, 0.2);
}

.badge.bg-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(6, 182, 212, 0.3);
}

.badge.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.badge.bg-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.3);
}

.badge.bg-warning {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
    color: #78350f !important;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.badge.bg-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.3);
}

.badge.bg-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%) !important;
    box-shadow: 0 2px 4px rgba(107, 114, 128, 0.2);
}

.badge.bg-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(107, 114, 128, 0.3);
}

/* Tabla de competidores */
#competitors-table th {
    background: linear-gradient(to bottom, var(--gray-100), var(--gray-50));
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-900);
    border-bottom: 2px solid var(--gray-300);
}

#competitors-table code {
    background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%);
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary-dark);
    border: 1px solid rgba(79, 70, 229, 0.1);
}

/* Tabla sticky header */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Responsive navigation */
@media (max-width: 768px) {
    .page-navigation .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .page-navigation .nav-link svg {
        width: 14px;
        height: 14px;
        margin-right: 0.25rem;
    }
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.card {
    height: 100%;
    margin-bottom: 1rem;
}

.card-body {
    display: flex;
    flex-direction: column;
}

.card-title {
    margin-bottom: 1rem;
}

canvas {
    max-height: 100%;
}