/* Estilos responsivos personalizados para el Sistema de Permisos */

/* Importar configuración responsiva personalizable */
@import url('responsive-config.css');

/* Variables CSS para consistencia */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --sidebar-width: 280px;
    --navbar-height: 60px;
}

/* Mejoras generales de responsividad */
body {
    font-size: 14px;
}

@media (max-width: 768px) {
    body {
        font-size: 13px;
    }
}

/* Navbar responsivo mejorado */
.navbar-brand {
    font-size: 1.1rem;
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 0.9rem;
    }
}

/* Sidebar responsivo - SOLO si no hay offcanvas */
body:not(.has-offcanvas) .sidebar {
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    body:not(.has-offcanvas) .sidebar {
        transform: translateX(0);
        position: relative;
        top: 0;
        padding: 0;
        box-shadow: none;
    }
}

body:not(.has-offcanvas) .sidebar.show {
    transform: translateX(0);
}

/* Botón toggle para móviles - SOLO si no hay offcanvas */
body:not(.has-offcanvas) .sidebar-toggle {
    display: block;
    position: fixed;
    top: 70px;
    left: 15px;
    z-index: 1000;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

@media (min-width: 768px) {
    body:not(.has-offcanvas) .sidebar-toggle {
        display: none;
    }
}

/* Contenido principal responsivo */
.main-content {
    transition: margin-left 0.3s ease;
}

@media (min-width: 768px) {
    .main-content {
        margin-left: 0;
    }
}

/* Tablas responsivas mejoradas */
.table-responsive {
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

@media (max-width: 768px) {
    .table-responsive table {
        font-size: 0.8rem;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 150px;
    }
    
    /* Ocultar columnas menos importantes en móvil */
    .table-responsive .d-none.d-md-table-cell {
        display: none !important;
    }
}

/* Cards responsivos */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
    margin-bottom: 1rem;
}

@media (max-width: 576px) {
    .card {
        margin-bottom: 0.75rem;
    }
    
    .card-body {
        padding: 1rem 0.75rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
}

/* Formularios responsivos */
.form-control, .form-select {
    font-size: 0.9rem;
}

@media (max-width: 576px) {
    .form-control, .form-select {
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* Modales responsivos */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1rem 0.75rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
}

/* Badges y alertas responsivos */
.badge {
    font-size: 0.75rem;
}

@media (max-width: 576px) {
    .alert {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Estadísticas/métricas responsivas */
.stats-card {
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .stats-card .card-body {
        text-align: center;
    }
    
    .stats-card h4 {
        font-size: 1.5rem;
    }
    
    .stats-card p {
        font-size: 0.85rem;
    }
}

/* DataTables responsive mejoras */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 1rem;
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        margin: 0 2px;
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Navegación breadcrumb responsiva */
.breadcrumb {
    background-color: transparent;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

@media (max-width: 576px) {
    .breadcrumb {
        font-size: 0.8rem;
    }
}

/* Dropdown notificaciones responsivo */
.dropdown-menu {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

@media (max-width: 576px) {
    .dropdown-menu {
        font-size: 0.85rem;
    }
    
    .dropdown-item {
        padding: 0.5rem 1rem;
    }
}

/* Utilidades de espaciado responsivo */
@media (max-width: 576px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .row {
        margin-left: -0.375rem;
        margin-right: -0.375rem;
    }
    
    .row > * {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
    }
}

/* Estados de permisos - colores responsivos */
.badge-pendiente {
    background-color: var(--warning-color) !important;
    color: #000 !important;
}

.badge-aprobado {
    background-color: var(--success-color) !important;
    color: #fff !important;
}

.badge-rechazado {
    background-color: var(--danger-color) !important;
    color: #fff !important;
}

/* Botones de acción responsivos */
@media (max-width: 576px) {
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
    }
    
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .action-buttons .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus states mejorados */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Print styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .dropdown {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
}

/* Dark mode support (futuro) */
@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a1a1a;
        --bs-body-color: #ffffff;
    }
}

/* Animaciones suaves */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}