/**
 * ============================================================================
 * TECNOFIX SOLUTIONS — CSS Responsive (Mobile-First Breakpoints)
 * ============================================================================
 * 
 * Adapta el layout para tablets y móviles. Los técnicos usarán
 * principalmente móvil/tablet, los admins PC.
 * 
 * BREAKPOINTS:
 *   - Tablet:  ≤ 1024px — Sidebar colapsable
 *   - Mobile:  ≤ 768px  — Stack vertical, sidebar overlay
 *   - Small:   ≤ 480px  — Ajustes de padding y tipografía
 * ============================================================================
 */

/* ═══════════════════════════════════════════════════════════════════════════
   TABLET — ≤ 1024px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  /* El sidebar se convierte en overlay */
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "content";
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    transform: translateX(-100%);
    z-index: var(--z-sidebar);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: flex;
  }

  /* Grids se reducen */
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  /* Tablas más compactas */
  .data-table th,
  .data-table td {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-xs);
  }

  /* Search bar más pequeña */
  .search-bar {
    max-width: 280px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — ≤ 768px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .app-content {
    padding: var(--space-md);
  }

  .app-header {
    padding: 0 var(--space-md);
  }

  /* Grids a una columna */
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-auto {
    grid-template-columns: 1fr;
  }

  /* Page header vertical */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1;
  }

  /* Modal full-width */
  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin: var(--space-md);
  }

  /* Search bar ocupa todo el ancho */
  .search-bar {
    max-width: 100%;
  }

  /* Header simplificado */
  .header-left {
    flex: 1;
  }

  .header-right .user-name-text {
    display: none;
  }

  /* Filter bar vertical */
  .filter-bar {
    flex-direction: column;
  }

  .filter-bar .form-select,
  .filter-bar .form-input {
    width: 100%;
  }

  /* Toasts */
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    bottom: var(--space-md);
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* Login container */
  .login-container {
    padding: var(--space-lg);
  }

  /* Pagination */
  .pagination {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SMALL MOBILE — ≤ 480px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .app-content {
    padding: var(--space-sm);
  }

  .card {
    padding: var(--space-md);
  }

  .card-value {
    font-size: var(--text-2xl);
  }

  .page-header h1 {
    font-size: var(--text-xl);
  }

  .login-logo h1 {
    font-size: var(--text-2xl);
  }

  /* Botones block en mobile */
  .btn-mobile-block {
    display: flex;
    width: 100%;
  }

  /* Sidebar más angosto */
  .app-sidebar {
    width: 85vw;
    max-width: 300px;
  }

  /* Modal ajustes */
  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT — Para impresión de reportes
   ═══════════════════════════════════════════════════════════════════════════ */
@media print {
  .app-sidebar,
  .app-header,
  .page-header-actions,
  .filter-bar,
  .pagination,
  .toast-container {
    display: none !important;
  }

  .app-layout {
    display: block;
  }

  .app-content {
    max-height: none;
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .data-table {
    font-size: 10pt;
  }
}
