/* Stylesheet for Ubícalo - Emergency Response App (Light Mode) */
:root {
  --bg-color: #f8fafc;         /* Slate 50 - Fondo limpio */
  --card-bg: #ffffff;          /* Blanco puro para tarjetas */
  --card-border: #cbd5e1;      /* Slate 300 - Bordes claros definidos */
  --text-primary: #0f172a;     /* Slate 900 - Alta legibilidad */
  --text-secondary: #475569;   /* Slate 600 - Subtítulos y etiquetas */
  --primary: #0284c7;          /* Sky 600 - Color primario */
  --primary-hover: #0369a1;    /* Sky 700 - Hover primario */
  --accent: #ea580c;           /* Orange 600 - Acciones secundarias */
  --accent-hover: #c2410c;     /* Orange 700 - Hover de acciones */
  --success: #16a34a;          /* Green 600 - Exitos/En Línea */
  --warning: #d97706;          /* Amber 600 - Heridos leves */
  --danger: #dc2626;           /* Red 600 - Alertas/Graves */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  padding-bottom: 0;
  background-image: 
    radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(234, 88, 12, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Header & Glassmorphism */
header {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

header.header-hidden {
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #0f172a, #334155);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Connection Status Banner */
#status-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  transition: var(--transition);
}

#status-banner.online {
  background-color: #d1fae5; /* verde suave */
  color: #065f46; /* verde oscuro */
  border-bottom: 1px solid #a7f3d0;
}

#status-banner.offline {
  background-color: #fee2e2; /* rojo suave */
  color: #991b1b; /* rojo oscuro */
  border-bottom: 1px solid #fca5a5;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.95; }
  50% { opacity: 0.8; }
  100% { opacity: 0.95; }
}

/* Main Container */
.container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: 1300px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Card Styling */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  border-left: 4px solid var(--primary);
  padding-left: 0.75rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

input, select, textarea {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  padding: 0.75rem;
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.btn-accent {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-accent:hover:not(:disabled) {
  background-color: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.2);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: var(--text-primary);
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #e2e8f0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Notification banner (Toast) */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  color: white;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: none;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateY(100px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 9999px;
  text-transform: uppercase;
}

.badge-ileso { 
  background-color: #d1fae5; 
  color: #065f46; 
  border: 1px solid #a7f3d0; 
}
.badge-herido_leve { 
  background-color: #fef3c7; 
  color: #92400e; 
  border: 1px solid #fde68a; 
}
.badge-herido_grave { 
  background-color: #ffedd5; 
  color: #9a3412; 
  border: 1px solid #fed7aa; 
}
.badge-desaparecido { 
  background-color: #e0f2fe; 
  color: #075985; 
  border: 1px solid #bae6fd; 
}
.badge-fallecido { 
  background-color: #fee2e2; 
  color: #991b1b; 
  border: 1px solid #fca5a5; 
}

/* Dashboard and Lists */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.5rem;
}

/* Offline Queue indicator */
.queue-badge {
  background: var(--accent);
  color: white;
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 0.5rem;
  display: none;
}

/* Tables and Search */
.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .search-bar {
    flex-direction: column;
  }
}

.table-responsive {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--card-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

th {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.875rem;
  background-color: #f1f5f9;
  border-bottom: 2px solid #cbd5e1;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: #f8fafc;
}

/* Login box */
.login-container {
  max-width: 400px;
  margin: 6rem auto;
  padding: 0 1.5rem;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.nav-links a:hover {
  color: var(--primary);
}

.sync-notice {
  font-size: 0.875rem;
  color: var(--accent);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

/* Footer Styling */
footer {
  margin-top: 4rem;
  padding: 3rem 1.5rem;
  background: #f1f5f9;
  border-top: 1px solid var(--card-border);
  text-align: center;
  border-radius: 1rem 1rem 0 0;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
}

.footer-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.footer-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Badge classes para estados adicionales */
.badge-reconocido { 
  background-color: #f3e8ff; 
  color: #6b21a8; 
  border: 1px solid #e9d5ff; 
}
.badge-encontrado { 
  background-color: #d1fae5; 
  color: #065f46; 
  border: 1px solid #a7f3d0; 
}
.badge-localizado { 
  background-color: #ccfbf1; 
  color: #115e59; 
  border: 1px solid #99f6e4; 
}

/* Carrusel de Fotos Público */
.carousel-section {
  margin-bottom: 2rem;
}

.carousel-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.carousel-container {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1rem 0.25rem;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* Ocultar barra de scroll en navegadores pero dar indicación táctil */
.carousel-container::-webkit-scrollbar {
  height: 6px;
}
.carousel-container::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
}

.carousel-card {
  flex: 0 0 160px;
  scroll-snap-align: start;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.carousel-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.carousel-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background-color: #f1f5f9;
  border-bottom: 1px solid var(--card-border);
}

.carousel-info {
  padding: 0.75rem;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.carousel-name {
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-location {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modales Públicos para Identificación Colaborativa */
.modal-public {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  z-index: 1500;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-public-content {
  background: #ffffff;
  border-radius: 1rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--card-border);
  animation: slideIn 0.25s ease-out;
}

.modal-public-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-public-body {
  padding: 1.5rem;
}

.modal-public-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--card-border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Grilla de Resultados de Búsqueda Pública */
.public-search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.search-result-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.search-result-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  background-color: var(--bg-color);
}

.search-result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}

.search-result-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-details {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

