/* ===================================================
   HUELLAS EN RED • Diseño Comunitario Claro y Moderno
   =================================================== */
:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;

  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-soft: #ccfbf1;

  --lost: #e11d48;
  --lost-soft: #ffe4e6;
  --found: #059669;
  --found-soft: #d1fae5;
  --adopt: #4f46e5;
  --adopt-soft: #e0e7ff;
  --happy: #d97706;
  --happy-soft: #fef3c7;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.16);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem;
  width: 100%;
}

/* TOPBAR */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--teal) 0%, #14b8a6 100%);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.25);
}

.brand-name {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.brand-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* BUTTONS */
.btn-primary {
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 0.65rem 1.15rem;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.btn-primary:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.link-btn {
  background: none;
  border: none;
  color: var(--teal);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

/* CAMPANITA NOTIFICACIONES */
.notif-wrapper {
  position: relative;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  font-size: 1.2rem;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: #e2e8f0;
}

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--lost);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
}

.notif-dropdown {
  position: absolute;
  top: 52px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  overflow: hidden;
}

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

.notif-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.notif-tab {
  flex: 1;
  padding: 0.65rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.notif-tab.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
  background: var(--surface);
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover {
  background: var(--surface-alt);
}

.notif-item.unread {
  background: #f0fdfa;
}

.notif-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.notif-body {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.notif-time {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* HERO */
.hero {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 55%, #fff7ed 100%);
  border-bottom: 1px solid var(--border);
  padding: 2rem 0;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  align-items: center;
}

.hero-pill {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--teal-dark);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero-text h1 {
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.65rem;
  letter-spacing: -0.5px;
}

.hero-text p {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
}

.stat-lbl {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.stat-lost .stat-num { color: var(--lost); }
.stat-found .stat-num { color: var(--found); }
.stat-adopt .stat-num { color: var(--adopt); }
.stat-happy .stat-num { color: var(--happy); }

/* FILTERS */
.main-content {
  padding-top: 1.5rem;
  padding-bottom: 4rem;
  flex: 1;
}

.filters-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.type-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.type-tab {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.type-tab.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.type-tab.tab-lost.active { background: var(--lost); border-color: var(--lost); }
.type-tab.tab-found.active { background: var(--found); border-color: var(--found); }
.type-tab.tab-adopt.active { background: var(--adopt); border-color: var(--adopt); }
.type-tab.tab-happy.active { background: var(--happy); border-color: var(--happy); }

.filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 0.65rem;
}

.filter-input, .filter-select, .form-input, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s;
}

.filter-input:focus, .filter-select:focus, .form-input:focus, .form-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* PETS GRID */
.pets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.pet-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pet-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.pet-photo-box {
  position: relative;
  height: 230px;
  background: #e2e8f0;
  overflow: hidden;
  cursor: pointer;
}

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

.pet-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: var(--text-muted);
  gap: 0.4rem;
}

.pet-photo-placeholder span {
  font-size: 3.5rem;
}

.photo-count-pill {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.status-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-perdido { background: var(--lost); color: #fff; }
.badge-encontrado { background: var(--found); color: #fff; }
.badge-adopcion { background: var(--adopt); color: #fff; }
.badge-resuelto { background: var(--happy); color: #fff; }

.pet-card-body {
  padding: 1rem 1.1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pet-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.pet-card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.pet-species-tag {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.pet-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.meta-chip {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
}

.pet-zone {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--teal-dark);
}

.pet-desc-preview {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pet-card-footer {
  padding: 0.8rem 1.1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-card-detail {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

.btn-card-detail:hover {
  background: #e2e8f0;
}

.btn-wa-mini {
  background: #25d366;
  color: #fff;
  text-decoration: none;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.84rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-wa-mini:hover {
  background: #1fb857;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-card {
  background: var(--surface);
  border-radius: 20px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 860px; }

.modal-header {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-alt);
}

.modal-header h2, .detail-header-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.35rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 1.35rem;
  overflow-y: auto;
  flex: 1;
}

/* FORM STYLES */
.form-section, .form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.form-label small {
  font-weight: 500;
  color: var(--text-muted);
}

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

.mt-2 { margin-top: 0.5rem; }

.help-text {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.pill-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.choice-pill {
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.choice-pill.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.color-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.color-chip {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.color-chip.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

/* PHOTO UPLOAD SLOTS */
.photos-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.photo-slot {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  height: 150px;
  overflow: hidden;
  position: relative;
  background: var(--surface-alt);
}

.photo-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
}

.photo-empty:hover {
  background: #f1f5f9;
}

.photo-plus {
  font-size: 1.8rem;
}

.photo-preview {
  width: 100%;
  height: 100%;
  position: relative;
}

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

.photo-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.contact-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-top: 0.5rem;
}

.contact-box h3 {
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* DETAIL MODAL */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.5rem;
}

.detail-gallery {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.detail-main-img {
  width: 100%;
  height: 310px;
  object-fit: cover;
  border-radius: 14px;
  background: #e2e8f0;
}

.detail-thumbs {
  display: flex;
  gap: 0.5rem;
}

.detail-thumb-btn {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.detail-thumb-btn.active {
  border-color: var(--teal);
}

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

.detail-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.85rem 0;
}

.spec-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.85rem;
}

.spec-box small {
  display: block;
  color: var(--text-muted);
  font-size: 0.74rem;
}

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

.messages-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.msg-form-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}

.msg-thread {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 320px;
  overflow-y: auto;
}

.msg-bubble {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fff;
}

.msg-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.msg-type-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.mtype-avistamiento { background: #fef3c7; color: #92400e; }
.mtype-adopcion { background: #e0e7ff; color: #3730a3; }
.mtype-es_mio { background: #ffe4e6; color: #9f1239; }
.mtype-consulta { background: #f1f5f9; color: #334155; }
.mtype-respuesta_dueno { background: #ccfbf1; color: #115e59; }

/* MY POSTS */
.my-post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 0.75rem;
  background: var(--surface-alt);
}

.my-post-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.my-post-info img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
}

.my-post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.recover-box {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 14px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
}

.recover-box p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0.75rem;
}

.recover-row {
  display: flex;
  gap: 0.5rem;
}

/* FOOTER & TOAST */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-admin-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1.35rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 400;
}

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; }
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: 1 / -1; }
  .detail-grid, .messages-section, .form-row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .brand-sub { display: none; }
  .btn-secondary span { font-size: 0.8rem; }
  .filters-grid { grid-template-columns: 1fr; }
  .recover-row { flex-direction: column; }
  .my-post-row { flex-direction: column; align-items: flex-start; }
}
