/* ================================
   Venezuela Te Busca - Styles
   ================================ */

:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #111827;
  --bg-card: #1a2234;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-red: #dc2626;
  --accent-orange: #f97316;
  --accent-yellow: #eab308;
  --accent-green: #22c55e;
  --border-color: #1e293b;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* SOURCE NOTICE */
.source-notice {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: #fff;
  text-align: center;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.source-notice a {
  color: #fef08a;
  text-decoration: underline;
  font-weight: 600;
}

.source-notice .source-time {
  font-size: 0.85rem;
  opacity: 0.9;
}

.source-notice a:hover {
  color: #fff;
}

/* HEADER */
header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo span {
  font-size: 1.5rem;
}

.logo small {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-primary, .btn-secondary {
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent-red);
  color: white;
}

.btn-primary:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

/* HERO */
.hero {
  text-align: center;
  padding: 4rem 1.5rem;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero-flag {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero h1 em {
  color: var(--accent-red);
  font-style: normal;
}

.hero > p {
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-num {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-orange);
}

.stat-num.found {
  color: var(--accent-green);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* FILTERS */
.filters-bar {
  background: var(--bg-secondary);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 70px;
  z-index: 90;
}

.filters-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-input, .filter-select {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.search-input {
  flex: 1;
  min-width: 250px;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.filter-select {
  min-width: 150px;
}

/* MAIN LIST */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.count-badge {
  background: var(--bg-card);
  padding: 0.375rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

/* CARD */
.card {
  background: var(--bg-card);
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent-red);
}

.card-photo {
  height: 200px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  position: relative;
}

.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.card-badge.desaparecido {
  background: var(--accent-red);
}

.card-badge.encontrado {
  background: var(--accent-green);
}

.card-body {
  padding: 1rem;
}

.card-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.card-location {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* PAGINATION */
#pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.page-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover, .page-btn.active {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

/* FOOTER */
footer {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

footer p {
  margin: 0.5rem 0;
}

footer a {
  color: var(--accent-red);
  text-decoration: none;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: 1rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

/* FORM */
.form-section {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row.single {
  display: block;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
  color: var(--text-secondary);
}

.form-label .req {
  color: var(--accent-red);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-red);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border: 2px dashed var(--border-color);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.photo-upload:hover {
  border-color: var(--accent-red);
  background: rgba(220, 38, 38, 0.1);
}

.photo-upload input {
  display: none;
}

.photo-upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.photo-upload-text {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.photo-upload-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.photo-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-submit {
  background: var(--accent-red);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit:hover {
  background: #b91c1c;
}

.btn-cancel {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
}

.btn-cancel:hover {
  background: var(--border-color);
}

/* DETAIL */
.detail-photo {
  height: 300px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
}

.detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-body {
  padding: 1.5rem;
}

.detail-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.detail-status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.detail-status-badge.desaparecido {
  background: var(--accent-red);
}

.detail-status-badge.encontrado {
  background: var(--accent-green);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.detail-item {
  background: var(--bg-card);
  padding: 0.75rem;
  border-radius: 0.5rem;
}

.detail-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.detail-item-value {
  font-weight: 600;
}

.detail-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 1.5rem 0 0.75rem;
  text-transform: uppercase;
}

.contact-box {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 0.5rem;
}

.detail-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  z-index: 2000;
  transition: transform 0.3s;
  border-left: 4px solid var(--accent-green);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* MAP TOGGLE BUTTON */
.map-toggle-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 500;
}

.map-toggle-btn {
  padding: 1rem 1.5rem;
  font-size: 1rem;
  border-radius: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* MAP CONTAINER */
.map-container {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: var(--bg-primary);
}

.map-container.active {
  display: block;
}

#map {
  width: 100%;
  height: 100%;
}

.map-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  z-index: 1001;
}

.map-close-btn:hover {
  background: var(--accent-red);
  border-color: var(--accent-red);
}

/* HEADER STATS */
.header-stats {
  display: flex;
  gap: 2rem;
}

.header-stat {
  text-align: center;
}

.header-stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-orange);
}

.header-stat-num.missing {
  color: var(--accent-orange);
}

.header-stat-num.found {
  color: var(--accent-green);
}

.header-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* MAIN CONTAINER */
.main-container {
  position: relative;
  height: calc(100vh - 225px);
}

#map {
  width: 100%;
  height: 100%;
}

/* MAP LEGEND */
.map-legend {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  z-index: 1000;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.map-legend-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.map-legend-item:last-child {
  margin-bottom: 0;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white;
}

.legend-dot.missing {
  background: var(--accent-orange);
}

.legend-dot.found {
  background: var(--accent-green);
}

/* EXCLUDED TABLE */
.excluded-table {
  position: absolute;
  bottom: 4rem;
  left: 1rem;
  background: var(--bg-card);
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  z-index: 1000;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  max-height: none;
}

.excluded-table-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.excluded-table table {
  width: 100%;
  border-collapse: collapse;
}

.excluded-table th,
.excluded-table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.excluded-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.7rem;
}

.excluded-table td:last-child {
  text-align: right;
  color: var(--accent-orange);
  font-weight: 600;
}

.excluded-table tfoot td {
  border-bottom: none;
  border-top: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--accent-orange);
}

.excluded-table-note {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
}

/* SEARCH OVERLAY */
.search-overlay {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 300px;
  z-index: 1000;
}

.search-overlay .search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
  box-shadow: var(--shadow);
}

.search-results {
  margin-top: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  display: none;
}

.search-results.active {
  display: block;
}

.search-result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.search-result-item:hover {
  background: var(--bg-secondary);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-name {
  font-weight: 600;
}

.search-result-location {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: var(--bg-secondary);
  z-index: 2000;
  transition: right 0.3s ease;
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sidebar.active {
  right: 0;
}

.sidebar-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sidebar-header h2 {
  font-size: 1rem;
  flex: 1;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.sidebar-filters {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.sidebar-card {
  background: var(--bg-card);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.sidebar-card:hover {
  border-color: var(--accent-red);
  transform: translateX(-4px);
}

.sidebar-card-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.sidebar-card-location {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.sidebar-card-gps {
  font-size: 0.75rem;
  color: var(--accent-orange);
  margin-top: 0.25rem;
}

/* MAP FOOTER */
.map-footer {
  background: var(--bg-secondary);
  padding: 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.map-footer p {
  margin: 0.25rem 0;
}

/* RESPONSIVE */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .stats-bar {
    gap: 1.5rem;
  }

  .stat-num {
    font-size: 2rem;
  }

  .form-row {
    flex-direction: column;
  }

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