/* ==========================================
   RED DE EMERGENCIA SISMO CALI - MASCOPOLIS
   Estilos de Rediseño, PWA, IA & Panel Admin
   ========================================== */

:root {
  /* Color Palette - Emergency Crisis & Rescue */
  --primary: #ef4444;
  /* Rojo Alerta Sismo */
  --primary-hover: #dc2626;
  --primary-light: rgba(239, 68, 68, 0.15);
  --secondary: #f97316;
  /* Naranja Rescate */
  --secondary-hover: #ea580c;
  --accent-yellow: #eab308;
  --accent-blue: #0284c7;
  --accent-green: #10b981;
  --purple-ai: #8b5cf6;


  /* Theme Light Defaults */
  --bg-main: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: #ffffff;
  --border-color: rgba(226, 232, 240, 0.9);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  --glass-shadow: 0 20px 40px -15px rgba(239, 68, 68, 0.12), 0 0 15px rgba(0, 0, 0, 0.05);
  --modal-bg: rgba(15, 23, 42, 0.8);
  --input-bg: #f1f5f9;

  /* Radius & Transitions */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-main: #0b0f19;
  --bg-card: rgba(23, 32, 54, 0.85);
  --bg-card-hover: rgba(30, 41, 69, 0.95);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --modal-bg: rgba(0, 0, 0, 0.85);
  --input-bg: #1e293b;
  --glass-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

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

/* Emergency Header Bar */
.emergency-top-bar {
  background: linear-gradient(90deg, #dc2626, #ea580c, #b91c1c);
  color: white;
  padding: 0.75rem 0;
  font-size: 0.92rem;
  font-weight: 700;
  border-bottom: 2px solid #7f1d1d;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.emergency-top-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.siren-dot {
  width: 12px;
  height: 12px;
  background-color: #ffffff;
  border-radius: 50%;
  display: inline-block;
  animation: sirenPulse 0.8s infinite alternate;
  margin-right: 0.5rem;
}

@keyframes sirenPulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9);
  }

  100% {
    transform: scale(1.2);
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
}

/* Header Navbar */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.3rem;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-ai {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}

.btn-emergency-lost {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
}

.btn-emergency-found {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: white;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--input-bg);
}

/* Hero Section */
.hero {
  padding: 2.5rem 0 2rem;
  background: radial-gradient(circle at top right, rgba(239, 68, 68, 0.12), transparent 50%),
    radial-gradient(circle at bottom left, rgba(249, 115, 22, 0.12), transparent 50%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.7rem;
  line-height: 1.15;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
}

.action-buttons-hero {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.stat-item h3 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.hero-image-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  border: 2px solid rgba(239, 68, 68, 0.3);
}

.hero-image-card img {
  width: 100%;
  height: 330px;
  object-fit: cover;
  display: block;
}

.hero-badge {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  color: white;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Controls Bar */
.controls-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tabs {
  display: flex;
  background: var(--input-bg);
  padding: 0.35rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-and-zone {
  display: flex;
  gap: 0.75rem;
  flex-grow: 1;
  max-width: 520px;
}

.zone-select {
  padding: 0.65rem 0.9rem;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

.search-box {
  position: relative;
  flex-grow: 1;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
  margin-bottom: 4rem;
}

/* Pet Card */
.pet-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.pet-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 25px 50px -12px rgba(239, 68, 68, 0.2);
}

.card-img-wrapper {
  position: relative;
  height: 230px;
  overflow: hidden;
}

.card-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.pet-card:hover .card-img-wrapper img {
  transform: scale(1.06);
}

.status-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.badge-lost-emergency {
  background: rgba(220, 38, 38, 0.95);
  color: white;
}

.badge-rescued-shelter {
  background: rgba(234, 88, 12, 0.95);
  color: white;
}

.badge-reunited {
  background: rgba(16, 185, 129, 0.95);
  color: white;
}

.zone-tag {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: white;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-body {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.pet-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.pet-name {
  font-size: 1.3rem;
  font-weight: 800;
}

.pet-breed {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

.medical-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  margin: 0.6rem 0 0.8rem;
  width: fit-content;
}

.med-injured {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.med-safe {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.med-scared {
  background: rgba(234, 88, 12, 0.15);
  color: #d97706;
  border: 1px solid rgba(234, 88, 12, 0.3);
}

.pet-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

.card-footer .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.55rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-bg);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

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

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 1.5rem;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}

/* Admin Dashboard Table & Cards */
.admin-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  background: var(--input-bg);
  font-weight: 800;
  color: var(--text-main);
}

.admin-table tr:hover {
  background: var(--input-bg);
}

.admin-action-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 700;
}

/* AI Matcher Special Card Styles */
.ai-match-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(109, 40, 217, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.match-bar-bg {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.3rem;
}

.match-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #10b981);
  border-radius: 4px;
}

/* Leaflet Map Height */
#mapContainer {
  height: 380px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  z-index: 1;
}

/* Printable Poster Card */
.flyer-poster {
  background: #ffffff;
  color: #0f172a;
  border: 4px solid #dc2626;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.flyer-header {
  background: #dc2626;
  color: white;
  padding: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: -1.5rem -1.5rem 1rem -1.5rem;
}

.flyer-img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 3px solid #0f172a;
  margin: 0.5rem 0;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  padding: 0.9rem 1.3rem;
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 700;
  animation: slideIn 0.3s ease;
}

.toast-danger {
  border-left: 4px solid var(--primary);
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .search-and-zone {
    flex-direction: column;
    max-width: 100%;
  }

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

  .form-group.full-width {
    grid-column: span 1;
  }
}

/* ========== PHOTO UPLOAD STYLES ========== */
.photo-upload-area {
  position: relative;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--input-bg);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-upload-area:hover {
  border-color: var(--primary);
  background: rgba(239, 68, 68, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.15);
}

.photo-upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(239, 68, 68, 0.1);
  border-width: 3px;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25), inset 0 0 30px rgba(239, 68, 68, 0.05);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  width: 100%;
}

.upload-placeholder i {
  animation: pulse-camera 2s ease-in-out infinite;
}

@keyframes pulse-camera {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

.photo-preview {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.photo-preview:hover {
  opacity: 0.85;
}

/* Upload Progress Bar */
.upload-progress-container {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.upload-bar {
  width: 100%;
  height: 8px;
  background: var(--input-bg);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.upload-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #f97316, #10b981);
  border-radius: 4px;
  transition: width 0.5s ease;
  animation: shimmer-bar 1.5s ease-in-out infinite;
  background-size: 200% 100%;
}

@keyframes shimmer-bar {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.upload-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}