/* ========================================
   RESPONSIVE DESIGN - NotIA Design System
   ======================================== */

/* ========================================
   BREAKPOINTS
   ======================================== */

/* Extra small devices (phones, 576px and down) */
@media (max-width: 575.98px) {
  /* Variables para móvil */
  :root {
    --sidebar-width: 100%;
    --sidebar-collapsed-width: 100%;
    --font-size-base: 0.875rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
  }

  /* Layout principal */
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    z-index: 1050;
    transition: left 0.3s ease;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  /* Header del dashboard */
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .dashboard-header .btn-group {
    width: 100%;
    justify-content: space-between;
  }

  .dashboard-header .btn {
    flex: 1;
    margin: 0 0.25rem;
  }

  /* Tarjetas de estadísticas */
  .stats-cards .col-md-3 {
    margin-bottom: 1rem;
  }

  .card {
    margin-bottom: 1rem;
  }

  /* Tablas responsivas */
  .table-responsive {
    font-size: 0.75rem;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
  }

  /* Botones en móvil */
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  .btn-group .btn {
    width: auto;
    margin-bottom: 0;
  }

  /* Formularios */
  .form-control {
    font-size: 16px; /* Previene zoom en iOS */
  }

  /* Navegación */
  .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  /* Alertas */
  .alert {
    font-size: 0.875rem;
    padding: 0.75rem;
  }

  /* Modales */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  /* Texto responsivo */
  .text-display {
    font-size: 1.5rem;
  }

  .text-lead {
    font-size: 0.875rem;
  }

  h1, .h1 { font-size: 1.5rem; }
  h2, .h2 { font-size: 1.25rem; }
  h3, .h3 { font-size: 1.125rem; }
  h4, .h4 { font-size: 1rem; }
  h5, .h5 { font-size: 0.875rem; }
  h6, .h6 { font-size: 0.75rem; }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  /* Variables para móvil horizontal */
  :root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 1050;
    transition: left 0.3s ease;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 1.5rem;
  }

  /* Dashboard header */
  .dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .dashboard-header .btn-group {
    width: auto;
  }

  /* Tarjetas de estadísticas */
  .stats-cards .col-md-3 {
    margin-bottom: 1rem;
  }

  /* Botones */
  .btn {
    width: auto;
    margin-bottom: 0.5rem;
  }

  /* Tablas */
  .table-responsive {
    font-size: 0.875rem;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Variables para tablet */
  :root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
  }

  .sidebar {
    position: relative;
    width: 250px;
    height: 100vh;
  }

  .main-content {
    margin-left: 0;
    padding: 2rem;
  }

  /* Dashboard */
  .dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  /* Tarjetas de estadísticas */
  .stats-cards .col-md-3 {
    margin-bottom: 1.5rem;
  }

  /* Grupos */
  .grupos-grid .col-md-3 {
    margin-bottom: 1.5rem;
  }

  /* Tablas */
  .table-responsive {
    font-size: 0.875rem;
  }

  /* Formularios */
  .form-row .col-md-6 {
    margin-bottom: 1rem;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  /* Variables para desktop pequeño */
  :root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
  }

  .sidebar {
    position: relative;
    width: 280px;
    height: 100vh;
  }

  .main-content {
    margin-left: 0;
    padding: 2rem;
  }

  /* Dashboard */
  .dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  /* Tarjetas de estadísticas */
  .stats-cards .col-md-3 {
    margin-bottom: 2rem;
  }

  /* Grupos */
  .grupos-grid .col-md-3 {
    margin-bottom: 2rem;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  /* Variables para desktop grande */
  :root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
  }

  .sidebar {
    position: relative;
    width: 280px;
    height: 100vh;
  }

  .main-content {
    margin-left: 0;
    padding: 2.5rem;
  }

  /* Dashboard */
  .dashboard-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  /* Contenedor principal */
  .container-fluid {
    max-width: 1400px;
    margin: 0 auto;
  }
}

/* ========================================
   COMPONENTES RESPONSIVOS
   ======================================== */

/* Cards responsivas */
@media (max-width: 768px) {
  .card {
    margin-bottom: 1rem;
  }

  .card-header {
    padding: 1rem;
  }

  .card-body {
    padding: 1rem;
  }

  .card-footer {
    padding: 0.75rem 1rem;
  }
}

/* Botones responsivos */
@media (max-width: 576px) {
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn-group .btn {
    border-radius: 0.375rem !important;
    margin-bottom: 0.5rem;
  }

  .btn-group .btn:last-child {
    margin-bottom: 0;
  }
}

/* Formularios responsivos */
@media (max-width: 768px) {
  .form-group {
    margin-bottom: 1rem;
  }

  .form-control {
    font-size: 16px; /* Previene zoom en iOS */
  }

  .input-group {
    flex-direction: column;
  }

  .input-group .input-group-text {
    border-radius: 0.375rem 0.375rem 0 0;
    border-right: 1px solid var(--border-color);
  }

  .input-group .form-control {
    border-radius: 0 0 0.375rem 0.375rem;
    border-left: 1px solid var(--border-color);
  }
}

/* Tablas responsivas */
@media (max-width: 768px) {
  .table-responsive {
    border: none;
  }

  .table {
    font-size: 0.75rem;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
    white-space: nowrap;
  }

  /* Ocultar columnas menos importantes en móvil */
  .table .d-none-mobile {
    display: none !important;
  }
}

/* Navegación responsiva */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    z-index: 1050;
    transition: left 0.3s ease;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .nav-link {
    padding: 1rem;
    font-size: 1rem;
  }

  .nav-link i {
    margin-right: 0.75rem;
  }
}

/* ========================================
   UTILIDADES RESPONSIVAS
   ======================================== */

/* Ocultar en móvil */
.d-none-mobile {
  display: block !important;
}

@media (max-width: 768px) {
  .d-none-mobile {
    display: none !important;
  }
}

/* Mostrar solo en móvil */
.d-mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .d-mobile-only {
    display: block !important;
  }
}

/* Ocultar en tablet */
.d-none-tablet {
  display: block !important;
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .d-none-tablet {
    display: none !important;
  }
}

/* Mostrar solo en tablet */
.d-tablet-only {
  display: none !important;
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .d-tablet-only {
    display: block !important;
  }
}

/* Ocultar en desktop */
.d-none-desktop {
  display: block !important;
}

@media (min-width: 992px) {
  .d-none-desktop {
    display: none !important;
  }
}

/* Mostrar solo en desktop */
.d-desktop-only {
  display: none !important;
}

@media (min-width: 992px) {
  .d-desktop-only {
    display: block !important;
  }
}

/* ========================================
   ESPACIADO RESPONSIVO
   ======================================== */

/* Padding responsivo */
.p-responsive {
  padding: 1rem;
}

@media (min-width: 768px) {
  .p-responsive {
    padding: 1.5rem;
  }
}

@media (min-width: 992px) {
  .p-responsive {
    padding: 2rem;
  }
}

/* Margin responsivo */
.m-responsive {
  margin: 1rem;
}

@media (min-width: 768px) {
  .m-responsive {
    margin: 1.5rem;
  }
}

@media (min-width: 992px) {
  .m-responsive {
    margin: 2rem;
  }
}

/* ========================================
   TIPOGRAFÍA RESPONSIVA
   ======================================== */

/* Títulos responsivos */
@media (max-width: 576px) {
  .text-responsive {
    font-size: 0.875rem;
  }
}

@media (min-width: 577px) and (max-width: 768px) {
  .text-responsive {
    font-size: 1rem;
  }
}

@media (min-width: 769px) {
  .text-responsive {
    font-size: 1.125rem;
  }
}

/* ========================================
   LAYOUT RESPONSIVO
   ======================================== */

/* Grid responsivo */
.grid-responsive {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 576px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 992px) {
  .grid-responsive {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Flexbox responsivo */
.flex-responsive {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .flex-responsive {
    flex-direction: row;
  }
}

/* ========================================
   ANIMACIONES RESPONSIVAS
   ======================================== */

/* Desactivar animaciones en móvil para mejor rendimiento */
@media (max-width: 768px) {
  .card:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  .table tbody tr:hover {
    transform: none;
  }
  
  .nav-link:hover {
    transform: none;
  }
}

/* ========================================
   TOUCH FRIENDLY
   ======================================== */

/* Elementos táctiles */
@media (max-width: 768px) {
  .btn {
    min-height: 44px; /* Tamaño mínimo recomendado para touch */
    padding: 0.75rem 1rem;
  }
  
  .nav-link {
    min-height: 44px;
    padding: 0.75rem 1rem;
  }
  
  .form-control {
    min-height: 44px;
    padding: 0.75rem;
  }
  
  .card {
    min-height: 44px;
  }
}

/* ========================================
   ORIENTACIÓN
   ======================================== */

/* Landscape en móvil */
@media (max-width: 768px) and (orientation: landscape) {
  .sidebar {
    width: 250px;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .dashboard-header {
    flex-direction: row;
  }
  
  .stats-cards .col-md-3 {
    margin-bottom: 0.5rem;
  }
}

/* Portrait en tablet */
@media (min-width: 768px) and (max-width: 991.98px) and (orientation: portrait) {
  .sidebar {
    width: 200px;
  }
  
  .main-content {
    padding: 1.5rem;
  }
}
