/**
 * mobile-responsive.css
 * Estilos adicionales para responsive en celular
 * Mantiene el diseño desktop original, solo adapta para móvil
 */

/* ==================== RESET Y BASE ==================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  height: 100%;
}

/* ==================== PWA STATUS BAR ==================== */

.pwa-status {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background-color: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.3s ease;
}

.pwa-status.offline {
  background-color: #fff3cd;
  border-bottom-color: #ffc107;
  display: flex;
}

.pwa-status.online {
  background-color: #d4edda;
  border-bottom-color: #28a745;
  display: flex;
}

.pwa-status.syncing {
  background-color: #cce5ff;
  border-bottom-color: #0066ff;
  display: flex;
}

.pwa-status i {
  font-size: 16px;
}

.pwa-status.offline i { color: #ff9800; }
.pwa-status.online i { color: #28a745; }
.pwa-status.syncing i { animation: spin 1s linear infinite; }

#pwaStatusText {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==================== INPUTS TOUCH-FRIENDLY ==================== */

input, textarea, select {
  font-size: 16px; /* Previene zoom automático en iOS */
  -webkit-appearance: none;
  appearance: none;
}

input:focus, textarea:focus, select:focus {
  outline: none;
}

/* ==================== MEDIA QUERIES - MÓVIL ==================== */

@media (max-width: 767px) {
  /* Body ajustado para móvil pero sin padding excesivo */
  body {
    display: flex !important;
    padding: 16px !important;
    padding-top: 16px !important;
    height: auto !important;
    background: #ffffff !important;
    justify-content: center !important;
    align-items: center !important;
  }

  /* Login adjustado para móvil */
  .login-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 20px 16px !important;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 0 16px !important;
  }

  /* Formulario del técnico - ajustar padding para móvil */
  form {
    width: 100% !important;
    margin: 16px auto !important;
    padding: 20px 16px !important;
    max-width: 860px !important;
  }

  h1 {
    font-size: 1.3rem !important;
    margin: 0 !important;
  }

  h2 {
    font-size: 0.85rem !important;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  textarea,
  select {
    width: 100% !important;
    padding: 10px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }

  .btn-login, 
  .btn-register, 
  .btn-start, 
  button,
  input[type="submit"] {
    width: 100% !important;
    padding: 10px !important;
    font-size: 0.9rem !important;
    border-radius: 8px;
  }

  .tools-grid, .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    padding: 0 8px !important;
    margin: 0 auto !important;
    max-width: 1200px !important;
  }

  .tool-card {
    padding: 16px !important;
    border-radius: 10px;
    min-height: auto;
  }

  .header {
    flex-direction: column;
    padding: 12px !important;
    gap: 8px;
    margin-bottom: 12px !important;
  }

  .user-info {
    width: 100%;
  }

  .btn-logout {
    width: auto;
  }

  .tool-icon {
    font-size: 2rem !important;
    margin-bottom: 8px !important;
  }

  .tool-title {
    font-size: 0.9rem !important;
  }

  .tool-desc {
    font-size: 0.75rem !important;
  }

  /* Panel de conexión - ajustar para móvil */
  #conexionFlotante {
    top: 10px !important;
    right: 10px !important;
    z-index: 100;
  }

  #badgeConexion {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.1rem !important;
  }

  /* Flecha de regresar - hacer más visible en móvil */
  .btn-back-header {
    left: 10px !important;
    font-size: 1.3rem !important;
    padding: 8px !important;
  }

  /* Header en móvil */
  header {
    padding: 12px 8px !important;
  }

  header h1 {
    font-size: 1rem !important;
    line-height: 1.2;
  }

  header img {
    width: 40px !important;
    height: 40px !important;
  }
}

/* ==================== MEDIA QUERIES - TABLET ==================== */

@media (min-width: 768px) and (max-width: 1023px) {
  .tools-grid, .dashboard-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  body {
    padding: 50px 24px 20px 24px;
  }
}

/* ==================== MEDIA QUERIES - DESKTOP ==================== */

@media (min-width: 1024px) {
  /* DESKTOP: Mantener estilos originales sin cambios */
  body {
    display: flex !important;
    padding: 0 !important;
    padding-top: 1rem;
    height: 100vh;
    align-items: center !important;
    justify-content: center !important;
  }

  form {
    width: 96%;
    max-width: 860px;
    background: white;
    margin: 22px auto;
    padding: 26px;
    border-radius: 18px;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.06);
  }

  .login-card {
    width: auto;
    max-width: 500px;
    padding: 40px;
    margin: auto;
  }

  header {
    padding: 22px 12px;
  }

  header h1 {
    font-size: 1.25rem;
  }

  header img {
    width: 56px;
    height: 56px;
  }

  /* Panel de conexión - estilo desktop */
  #conexionFlotante {
    top: 14px;
    right: 14px;
  }

  #badgeConexion {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
  }

  /* Flecha de regresar - estilo desktop */
  .btn-back-header {
    left: 20px;
    font-size: 1.5rem;
    padding: 10px;
  }

  .tools-grid, .dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}
