/* =============================================================================
   Guard Kiosk Shell - estilo aislado para rol seguridad_patrimonial.
   Pensado para celular, tablet y monitor de caseta. Sin sidebar, sin distracciones.
   ============================================================================= */

.guard-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: #0f172a;
  -webkit-tap-highlight-color: transparent;
  /* Safe-area para iOS notch / android gesture bar */
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.guard-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #1e3a8a, #1e40af);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
}

.guard-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.guard-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.guard-brand-text {
  min-width: 0;
}

.guard-brand-name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.3px;
}

.guard-brand-sub {
  font-size: 12px;
  opacity: 0.75;
  font-weight: 500;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guard-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.guard-user-greet {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.95;
  white-space: nowrap;
}

.guard-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px; /* tap target minimo iOS/Android */
}

.guard-logout-btn:hover { background: rgba(255, 255, 255, 0.25); }
.guard-logout-btn:active { background: rgba(255, 255, 255, 0.35); transform: scale(0.97); }

.guard-main {
  flex: 1;
  width: 100%;
  background: transparent;
}

/* Spinner reutilizable (paginas charger lo esperan) */
.guard-shell .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #cbd5e1;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: guard-spin 0.8s linear infinite;
}
@keyframes guard-spin { to { transform: rotate(360deg); } }

/* Toasts: las paginas charger usan Alpine.store('ui').toast. Si no esta presente,
   damos un fallback visual via alert(). Tambien aseguramos que el contenedor de
   toasts global se vea por encima de todo. */
.guard-shell .toast-container,
body > .toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* Boton generico btn que algunas paginas reutilizan (Refrescar etc) */
.guard-shell .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
}
.guard-shell .btn:disabled { opacity: 0.6; cursor: not-allowed; }
.guard-shell .btn:active { transform: scale(0.97); }

/* === Responsive === */

/* Tablet 768px+ : header puede crecer un poco */
@media (min-width: 768px) {
  .guard-topbar { padding: 16px 28px; }
  .guard-brand-name { font-size: 20px; }
  .guard-brand-sub { font-size: 13px; }
  .guard-logo { width: 48px; height: 48px; font-size: 17px; }
  .guard-user-greet { font-size: 15px; }
}

/* Desktop / monitor de caseta 1024px+ : centro el contenido pero el header full-width */
@media (min-width: 1024px) {
  .guard-topbar { padding: 18px 40px; }
}

/* Mobile chico 380px o menor : esconder el nombre del usuario para ahorrar espacio */
@media (max-width: 380px) {
  .guard-user-greet { display: none; }
  .guard-topbar { padding: 12px 12px; gap: 8px; }
  .guard-brand-name { font-size: 16px; }
  .guard-logo { width: 40px; height: 40px; font-size: 14px; }
}

/* Modo landscape en tablet/celular: bajar padding del header un poco */
@media (max-height: 480px) and (orientation: landscape) {
  .guard-topbar { padding: 8px 16px; }
  .guard-brand-name { font-size: 16px; }
  .guard-brand-sub { display: none; }
  .guard-logo { width: 36px; height: 36px; }
}

/* Modo oscuro automatico si el sistema lo pide. Mantiene el header oscuro
   pero ajusta el fondo del contenido. */
@media (prefers-color-scheme: dark) {
  .guard-shell { background: #0f172a; color: #f1f5f9; }
}
