/* =============================================
   MEJORAS DE RESPONSIVE DESIGN - SIPREST
   ============================================= */

/* =============================================
   TARJETAS DEL DASHBOARD
   ============================================= */

/* Mejoras para tablets */
@media (max-width: 992px) {
    .small-box {
        margin-bottom: 20px;
    }
    
    .small-box .inner h4 {
        font-size: 1.8rem;
    }
}

/* Mejoras para móviles */
@media (max-width: 768px) {
    .small-box {
        margin-bottom: 15px;
    }
    
    .small-box .inner h4 {
        font-size: 1.5rem;
    }
    
    .small-box .inner p {
        font-size: 0.9rem;
    }
    
    .small-box .icon {
        font-size: 60px;
    }
}

/* =============================================
   TABLAS RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    /* Mejorar visualización de DataTables en móviles */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: center;
        margin-bottom: 10px;
    }
    
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        margin-top: 10px;
    }
    
    /* Botones de DataTables más grandes para táctil */
    .dt-buttons .btn {
        padding: 8px 12px;
        margin: 2px;
    }
}

@media (max-width: 576px) {
    /* Scroll horizontal para tablas pequeñas */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Reducir padding en celdas */
    .table td,
    .table th {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    /* Botones de acción más compactos */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* =============================================
   LOADING SKELETON
   ============================================= */

.skeleton-loading {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    display: inline-block;
    min-width: 80px;
    min-height: 20px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* =============================================
   SPINNER DE CARGA
   ============================================= */

.loading-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* =============================================
   BOTONES CON LOADING STATE
   ============================================= */

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

/* =============================================
   MEJORAS DE NAVEGACIÓN MÓVIL
   ============================================= */

@media (max-width: 768px) {
    /* Sidebar más accesible en móviles */
    .main-sidebar {
        width: 250px;
    }
    
    /* Espaciado del contenido */
    .content-wrapper {
        padding: 10px;
    }
    
    /* Breadcrumbs más compactos */
    .breadcrumb {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

/* =============================================
   CARDS Y PANELES
   ============================================= */

@media (max-width: 768px) {
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
}

/* =============================================
   FORMULARIOS RESPONSIVE
   ============================================= */

@media (max-width: 576px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    label {
        font-size: 0.9rem;
    }
}

/* =============================================
   MODALES RESPONSIVE
   ============================================= */

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header,
    .modal-footer {
        padding: 0.75rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
}

/* =============================================
   ACCESIBILIDAD TÁCTIL
   ============================================= */

/* Asegurar que elementos táctiles tengan tamaño mínimo de 44x44px */
@media (max-width: 768px) {
    .btn,
    .page-link,
    .close,
    .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* =============================================
   GRÁFICOS RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .chart {
        height: 250px !important;
    }
    
    canvas {
        max-width: 100%;
        height: auto !important;
    }
}

/* =============================================
   UTILIDADES
   ============================================= */

/* Ocultar en móviles */
.hidden-mobile {
    @media (max-width: 768px) {
        display: none !important;
    }
}

/* Mostrar solo en móviles */
.visible-mobile {
    display: none !important;
    
    @media (max-width: 768px) {
        display: block !important;
    }
}

/* Texto responsive */
.text-responsive {
    @media (max-width: 768px) {
        font-size: 0.9rem;
    }
    
    @media (max-width: 576px) {
        font-size: 0.85rem;
    }
}
