/* Mejoras de responsive design */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .badge {
        font-size: 0.7rem;
    }
    
    .offcanvas {
        width: 100%;
    }
    
    .chart-container {
        height: 200px !important;
    }
    
    .form-label {
        font-size: 0.9rem;
    }
    
    .form-control, .form-select {
        font-size: 0.9rem;
        padding: 0.375rem 0.5rem;
    }
    
    .input-group-text {
        font-size: 0.9rem;
        padding: 0.375rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .table th, .table td {
        padding: 0.25rem;
    }
    
    .btn-group {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn {
        flex: 1;
    }
    
    .d-flex.flex-wrap {
        flex-direction: column;
    }
    
    .mt-4 {
        margin-top: 1rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    h4 {
        font-size: 1rem;
    }
    
    h5 {
        font-size: 0.95rem;
    }
    
    h6 {
        font-size: 0.9rem;
    }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 400px) {
    .navbar-brand {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .nav-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .table-responsive table {
        min-width: 500px;
    }
}

/* Ajustes para pantallas grandes */
@media (min-width: 1200px) {
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .chart-container {
        height: 300px !important;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Modo oscuro (si se implementa) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a202c !important;
        color: #e2e8f0 !important;
    }
    
    .card {
        background-color: #2d3748 !important;
        color: #e2e8f0 !important;
        border-color: #4a5568 !important;
    }
    
    .table {
        color: #e2e8f0 !important;
    }
    
    .table-striped > tbody > tr:nth-of-type(odd) {
        background-color: rgba(255, 255, 255, 0.05) !important;
    }
    
    /* Asegurar que el texto sea visible en modo oscuro */
    .card-body,
    .card-header,
    .navbar-nav .nav-link,
    .navbar-brand,
    h1, h2, h3, h4, h5, h6,
    .form-label,
    .btn,
    p {
        color: #e2e8f0 !important;
    }
    
    /* Corregir especificamente el texto con poca visibilidad */
    .text-muted {
        color: #a0aec0 !important;
    }
    
    /* Corregir texto de ayuda en formularios */
    .form-text {
        color: #cbd5e0 !important;
    }
    
    /* Mejorar visibilidad de botones outline en modo dark */
    .btn-outline-primary {
        color: #90cdf4 !important;
        border-color: #90cdf4 !important;
        background-color: rgba(144, 205, 244, 0.1) !important;
    }
    
    .btn-outline-primary:hover,
    .btn-outline-primary:focus {
        color: #1a202c !important;
        background-color: #90cdf4 !important;
        border-color: #90cdf4 !important;
    }
    
    .btn-outline-secondary {
        color: #cbd5e0 !important;
        border-color: #cbd5e0 !important;
        background-color: rgba(203, 213, 224, 0.1) !important;
    }
    
    .btn-outline-secondary:hover,
    .btn-outline-secondary:focus {
        color: #1a202c !important;
        background-color: #cbd5e0 !important;
        border-color: #cbd5e0 !important;
    }
    
    .btn-outline-success {
        color: #68d391 !important;
        border-color: #68d391 !important;
        background-color: rgba(104, 211, 145, 0.1) !important;
    }
    
    .btn-outline-success:hover,
    .btn-outline-success:focus {
        color: #1a202c !important;
        background-color: #68d391 !important;
        border-color: #68d391 !important;
    }
    
    .btn-outline-danger {
        color: #fc8181 !important;
        border-color: #fc8181 !important;
        background-color: rgba(252, 129, 129, 0.1) !important;
    }
    
    .btn-outline-danger:hover,
    .btn-outline-danger:focus {
        color: #1a202c !important;
        background-color: #fc8181 !important;
        border-color: #fc8181 !important;
    }
    
    .btn-outline-warning {
        color: #f6e05e !important;
        border-color: #f6e05e !important;
        background-color: rgba(246, 224, 94, 0.1) !important;
    }
    
    .btn-outline-warning:hover,
    .btn-outline-warning:focus {
        color: #1a202c !important;
        background-color: #f6e05e !important;
        border-color: #f6e05e !important;
    }
    
    .btn-outline-info {
        color: #63b3ed !important;
        border-color: #63b3ed !important;
        background-color: rgba(99, 179, 237, 0.1) !important;
    }
    
    .btn-outline-info:hover,
    .btn-outline-info:focus {
        color: #1a202c !important;
        background-color: #63b3ed !important;
        border-color: #63b3ed !important;
    }
    
    .navbar-dark .navbar-brand,
    .navbar-dark .navbar-nav .nav-link {
        color: rgba(255, 255, 255, 0.9) !important;
    }
    
    .navbar-dark .navbar-nav .nav-link:hover,
    .navbar-dark .navbar-nav .nav-link:focus {
        color: white !important;
    }
    
    /* Asegurar visibilidad de enlaces */
    a:not(.btn) {
        color: #63b3ed !important;
    }
    
    a:not(.btn):hover {
        color: #90cdf4 !important;
    }
    
    /* Asegurar visibilidad de elementos de formulario */
    .form-control, .form-select {
        background-color: #4a5568 !important;
        color: #e2e8f0 !important;
        border-color: #718096 !important;
    }
    
    .form-control:focus, .form-select:focus {
        background-color: #4a5568 !important;
        color: #e2e8f0 !important;
        border-color: #63b3ed !important;
        box-shadow: 0 0 0 0.2rem rgba(99, 179, 237, 0.25) !important;
    }
    
    /* Asegurar visibilidad de tablas */
    .table-light {
        background-color: #4a5568 !important;
        color: #e2e8f0 !important;
    }
    
    .table-light th {
        color: #e2e8f0 !important;
        border-color: #718096 !important;
    }
    
    /* Asegurar visibilidad de encabezados de tarjetas */
    .card-header {
        background-color: #4a5568 !important;
        border-color: #718096 !important;
    }
    
    /* Asegurar visibilidad de texto en tarjetas de estadísticas */
    .card.border-start h6,
    .card.border-start h3 {
        color: #e2e8f0 !important;
    }
    
    /* Asegurar visibilidad de títulos de sección */
    .mb-0,
    .mb-4 h2 {
        color: #e2e8f0 !important;
    }
    
    /* Asegurar visibilidad de texto en gráficos */
    canvas {
        filter: brightness(1.2);
    }
}