/* ===== MEJORAS DE RESPONSIVIDAD PARA iOS - BOOTSTRAP Y COREUI ===== */

/* Media queries específicas para iOS */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    /* Para dispositivos Retina */
    .container,
    .container-fluid {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .row {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Media queries para iPhone */
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 568px)
    and (-webkit-min-device-pixel-ratio: 2) {
    
    /* Ajustes para contenedores Bootstrap */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .container-fluid {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    /* Ajustes para columnas Bootstrap */
    .col-md-6 {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    .col-md-4 {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    .col-md-3 {
        width: 50% !important;
        margin-bottom: 10px;
    }
    
    .col-md-2 {
        width: 50% !important;
        margin-bottom: 10px;
    }
    
    .col-lg-3 {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    .col-lg-4 {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    .col-lg-6 {
        width: 100% !important;
        margin-bottom: 15px;
    }
    
    /* Ajustes para formularios Bootstrap */
    .form-control {
        font-size: 16px !important; /* Evita zoom en iOS */
        -webkit-appearance: none;
        border-radius: 6px;
        min-height: 44px; /* Tamaño mínimo para elementos táctiles */
    }
    
    .form-select {
        font-size: 16px !important;
        -webkit-appearance: none;
        border-radius: 6px;
        min-height: 44px;
    }
    
    .form-label {
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 8px;
    }
    
    /* Ajustes para botones Bootstrap */
    .btn {
        min-height: 44px;
        -webkit-appearance: none;
        border-radius: 6px;
        font-size: 14px;
        padding: 8px 16px;
    }
    
    .btn-sm {
        min-height: 36px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .btn-lg {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 24px;
    }
    
    /* Ajustes para cards Bootstrap */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .card-header {
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 600;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .card-footer {
        padding: 12px 16px;
    }
    
    /* Ajustes para tablas Bootstrap */
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    .table-responsive {
        font-size: 11px;
        margin-bottom: 10px;
    }
    
    /* Ajustes para navegación Bootstrap */
    .navbar {
        padding: 8px 0;
    }
    
    .navbar-brand {
        font-size: 16px;
    }
    
    .navbar-nav .nav-link {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Ajustes para paginación Bootstrap */
    .pagination {
        gap: 5px;
    }
    
    .page-link {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Ajustes para modales Bootstrap */
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    /* Ajustes para alertas Bootstrap */
    .alert {
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 6px;
    }
    
    /* Ajustes para badges Bootstrap */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Ajustes para tooltips Bootstrap */
    .tooltip {
        font-size: 11px;
    }
    
    /* Ajustes para popovers Bootstrap */
    .popover {
        font-size: 12px;
    }
}

/* Media queries para iPhone Plus y dispositivos más grandes */
@media only screen 
    and (min-device-width: 414px) 
    and (max-device-width: 736px)
    and (-webkit-min-device-pixel-ratio: 3) {
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .col-md-6 {
        width: 100% !important;
        margin-bottom: 20px;
    }
    
    .col-md-4 {
        width: 100% !important;
        margin-bottom: 20px;
    }
    
    .col-md-3 {
        width: 50% !important;
        margin-bottom: 15px;
    }
    
    .form-control {
        font-size: 16px !important;
        min-height: 44px;
    }
    
    .form-select {
        font-size: 16px !important;
        min-height: 44px;
    }
    
    .btn {
        min-height: 44px;
        font-size: 15px;
        padding: 10px 18px;
    }
    
    .card-header {
        padding: 15px 18px;
        font-size: 15px;
    }
    
    .card-body {
        padding: 18px;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
        font-size: 12px;
    }
}

/* Media queries para iPad */
@media only screen 
    and (min-device-width: 768px) 
    and (max-device-width: 1024px)
    and (-webkit-min-device-pixel-ratio: 2) {
    
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .col-md-6 {
        width: 50% !important;
        margin-bottom: 20px;
    }
    
    .col-md-4 {
        width: 50% !important;
        margin-bottom: 20px;
    }
    
    .col-md-3 {
        width: 33.333% !important;
        margin-bottom: 15px;
    }
    
    .col-lg-3 {
        width: 25% !important;
        margin-bottom: 15px;
    }
    
    .col-lg-4 {
        width: 33.333% !important;
        margin-bottom: 15px;
    }
    
    .col-lg-6 {
        width: 50% !important;
        margin-bottom: 20px;
    }
    
    .form-control {
        font-size: 16px !important;
        min-height: 44px;
    }
    
    .form-select {
        font-size: 16px !important;
        min-height: 44px;
    }
    
    .btn {
        min-height: 44px;
        font-size: 16px;
        padding: 12px 20px;
    }
    
    .card-header {
        padding: 18px 20px;
        font-size: 16px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table th,
    .table td {
        padding: 12px 10px;
        font-size: 13px;
    }
}

/* Ajustes específicos para Safari en iOS */
@supports (-webkit-touch-callout: none) {
    .container,
    .container-fluid {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .form-control,
    .form-select {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-content {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Ajustes para orientación landscape en iOS */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .col-md-6 {
        width: 50% !important;
        margin-bottom: 10px;
    }
    
    .col-md-4 {
        width: 50% !important;
        margin-bottom: 10px;
    }
    
    .col-md-3 {
        width: 33.333% !important;
        margin-bottom: 8px;
    }
    
    .form-control {
        font-size: 16px !important;
        min-height: 40px;
        padding: 6px 10px;
    }
    
    .form-select {
        font-size: 16px !important;
        min-height: 40px;
        padding: 6px 10px;
    }
    
    .btn {
        min-height: 40px;
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .card-header {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .table {
        font-size: 11px;
    }
    
    .table th,
    .table td {
        padding: 6px 4px;
        font-size: 10px;
    }
    
    .navbar {
        padding: 6px 0;
    }
    
    .navbar-brand {
        font-size: 14px;
    }
    
    .navbar-nav .nav-link {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Mejoras para elementos interactivos específicos en iOS */
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 568px)
    and (-webkit-min-device-pixel-ratio: 2) {
    
    /* Ajustes para dropdowns Bootstrap */
    .dropdown-menu {
        font-size: 14px;
        border-radius: 6px;
    }
    
    .dropdown-item {
        padding: 8px 16px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Ajustes para tabs Bootstrap */
    .nav-tabs .nav-link {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Ajustes para accordion Bootstrap */
    .accordion-button {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .accordion-body {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    /* Ajustes para list group Bootstrap */
    .list-group-item {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Ajustes para breadcrumbs Bootstrap */
    .breadcrumb {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .breadcrumb-item {
        font-size: 12px;
    }
    
    /* Ajustes para progress bars Bootstrap */
    .progress {
        height: 20px;
        border-radius: 6px;
    }
    
    .progress-bar {
        font-size: 12px;
        line-height: 20px;
    }
    
    /* Ajustes para spinners Bootstrap */
    .spinner-border {
        width: 1.5rem;
        height: 1.5rem;
    }
    
    .spinner-border-sm {
        width: 1rem;
        height: 1rem;
    }
}

/* Ajustes para CoreUI específicos en iOS */
@media only screen 
    and (min-device-width: 320px) 
    and (max-device-width: 568px)
    and (-webkit-min-device-pixel-ratio: 2) {
    
    /* Ajustes para sidebar CoreUI */
    .sidebar {
        -webkit-overflow-scrolling: touch;
    }
    
    .sidebar-nav .nav-link {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Ajustes para header CoreUI */
    .header {
        padding: 8px 0;
    }
    
    .header-brand {
        font-size: 16px;
    }
    
    /* Ajustes para footer CoreUI */
    .footer {
        padding: 12px 0;
        font-size: 12px;
    }
    
    /* Ajustes para wrapper CoreUI */
    .wrapper {
        min-height: 100vh;
    }
    
    /* Ajustes para body CoreUI */
    .body {
        padding: 10px;
    }
}

/* Ajustes para impresión en iOS */
@media print and (-webkit-min-device-pixel-ratio: 2) {
    .container {
        padding-left: 5px;
        padding-right: 5px;
    }
    
    .col-md-6,
    .col-md-4,
    .col-md-3,
    .col-lg-3,
    .col-lg-4,
    .col-lg-6 {
        width: 100% !important;
        margin-bottom: 10px;
    }
    
    .form-control,
    .form-select {
        font-size: 12pt !important;
        border: 1px solid #000 !important;
        background: transparent !important;
    }
    
    .btn {
        font-size: 12pt !important;
        border: 1px solid #000 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
    
    .table {
        font-size: 10pt !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
        padding: 4px 6px !important;
        font-size: 9pt !important;
    }
}