/* ===========================
   Reset básico
   =========================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f3f0;
  color: #111827;
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Contenedor general */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===========================
   BARRA SUPERIOR
   =========================== */
.top-bar {
  background: #111827;
  color: #e5e7eb;
  font-size: 0.78rem;
}

.top-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.top-bar-right {
  opacity: 0.8;
}

/* ===========================
   HEADER / NAVBAR
   =========================== */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}

/* Logo */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 0%, #22c55e, #16a34a);
  color: #ffffff;
  font-size: 1.1rem;
}

.logo-text small {
  font-weight: 400;
  font-size: 0.9rem;
  color: #6b7280;
}

/* Nav principal */
.main-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.92rem;
}

.main-nav a {
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover {
  border-bottom-color: #16a34a;
}

/* Acciones header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.header-link {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.header-link:hover {
  border-color: #e5e7eb;
  text-decoration: none;
}

.user-name {
  font-size: 0.86rem;
  color: #4b5563;
}

/* Botones */
.btn-pill {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  border: none;
  background: #16a34a;
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
}

.btn-pill:hover {
  background: #15803d;
  text-decoration: none;
}

/* ===========================
   LAYOUT PRINCIPAL
   =========================== */
.site-main {
  padding: 16px 0 40px;
}

.main-container {
  margin-top: 4px;
}

/* ===========================
   HERO / HOME
   =========================== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
  gap: 28px;
  align-items: flex-start;
  margin: 8px 0 24px;
}

.hero-kicker {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #16a34a;
  margin: 0 0 4px;
}

.hero h1 {
  font-size: clamp(1.7rem, 2.4vw + 1rem, 2.4rem);
  margin: 0 0 8px;
  color: #111827;
}

.hero-subtitle {
  margin: 0 0 14px;
  font-size: 0.98rem;
  color: #4b5563;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

/* Botones principales */
.btn-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  background: #16a34a;
  color: #ffffff;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-main:hover {
  background: #15803d;
  text-decoration: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-size: 0.94rem;
  cursor: pointer;
  text-decoration: none;
}

.btn-ghost:hover {
  background: #f9fafb;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.hero-tags span {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e5f9ef;
  color: #166534;
}

/* Parte derecha hero */
.hero-right {
  display: flex;
  justify-content: flex-end;
}

.hero-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 12px 30px rgba(15,23,42,0.12);
  border: 1px solid #e5e7eb;
  width: 100%;
  max-width: 360px;
}

.hero-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.hero-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hero-list li + li {
  margin-top: 8px;
}

.hero-list-item {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hero-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-thumb-placeholder {
  font-size: 0.75rem;
  color: #6b7280;
}

.hero-thumb-info {
  flex: 1;
}

.hero-product-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.hero-product-meta {
  font-size: 0.78rem;
  color: #6b7280;
}

/* ===========================
   CATEGORÍAS TIPO CHIPS
   =========================== */
.categories-strip {
  margin: 8px 0 18px;
}

.categories-strip h2 {
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.categories-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
}

/* ===========================
   SECCIÓN PRODUCTOS / GRID
   =========================== */
.product-grid-section {
  margin-top: 10px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.section-header h2,
.section-header h1 {
  font-size: 1.25rem;
  margin: 0;
}

.section-subtitle {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.link-more {
  font-size: 0.85rem;
  color: #16a34a;
}

/* GRID */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

/* CARD PRODUCTO */
.product-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 0 0 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  transition: transform .12s, box-shadow .12s;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15,23,42,.16);
}

/* Imagen superior */
.product-card-media {
  position: relative;
  height: 190px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-placeholder-img {
  width: 100%;
  height: 100%;
  font-size: 0.9rem;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Badge tipo */
.badge-type {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 999px;
  color: #111827;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(209,213,219,.9);
}

.badge-type-regalo {
  color: #166534;
  border-color: #bbf7d0;
  background: rgba(22,163,74,.1);
}

.badge-type-trueque {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: rgba(37,99,235,.08);
}

.badge-type-venta {
  color: #b45309;
  border-color: #fed7aa;
  background: rgba(248,180,80,.1);
}

/* Cuerpo card */
.product-card-body {
  padding: 10px 12px 4px;
}

.product-card-body h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.product-meta {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: #6b7280;
}

.product-location-badge {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: #374151;
}

.product-description {
  margin: 0;
  font-size: 0.8rem;
  color: #4b5563;
}

/* Acciones card */
.product-card-actions {
  padding: 8px 12px 10px;
  margin-top: auto;
  display: flex;
  justify-content: flex-start;
}

.product-card-actions-row {
  justify-content: space-between;
  gap: 6px;
}

/* Botones secundarios */
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 0.85rem;
  background: #ffffff;
  cursor: pointer;
}

.btn-outline:hover {
  background: #f3f4f6;
  text-decoration: none;
}

.btn-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  font-size: 0.78rem;
  background: #ffffff;
  cursor: pointer;
}

.btn-small:hover {
  background: #f3f4f6;
  text-decoration: none;
}

.btn-danger {
  border-color: #fecaca;
  color: #b91c1c;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* ===========================
   FILTROS (explorar)
   =========================== */
.filters-bar {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.filters-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters-group select {
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-size: 0.85rem;
}

.filters-search input {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  min-width: 200px;
  font-size: 0.85rem;
}

/* ===========================
   DETALLE PRODUCTO
   =========================== */
.product-detail {
  background: #ffffff;
  border-radius: 20px;
  padding: 16px 16px 18px;
  box-shadow: 0 12px 30px rgba(15,23,42,.12);
  border: 1px solid #e5e7eb;
}

.product-detail-header h1 {
  margin: 0 0 5px;
  font-size: 1.3rem;
}

.product-detail-header .product-meta {
  margin-bottom: 4px;
}

.detail-owner-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

/* Galería */
.product-images {
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-images img {
  max-width: 220px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.product-placeholder-large {
  height: 140px;
  border-radius: 12px;
  background: #f3f4f6;
}

/* Texto detalle */
.product-detail-body p {
  font-size: 0.92rem;
  line-height: 1.45;
}

.product-location {
  margin-top: 4px;
  font-size: 0.86rem;
  color: #4b5563;
}

.product-owner {
  margin-top: 4px;
  font-size: 0.86rem;
  color: #6b7280;
}

.product-detail-footer {
  margin-top: 12px;
}

/* ===========================
   FORMULARIOS (login, registro, publicar)
   =========================== */
.auth-form {
  max-width: 420px;
  margin: 18px auto;
  background: #ffffff;
  padding: 18px 18px 20px;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(15,23,42,.12);
  border: 1px solid #e5e7eb;
}

.auth-form h1 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

.auth-form form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form label {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-form input,
.auth-form select,
.auth-form textarea {
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 7px 10px;
  font-size: 0.9rem;
}

.auth-form textarea {
  resize: vertical;
  min-height: 80px;
}

.auth-switch {
  margin-top: 8px;
  font-size: 0.8rem;
  text-align: center;
}

.alert {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.alert-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* ===========================
   FOOTER
   =========================== */
.site-footer {
  border-top: 1px solid #e5e7eb;
  padding: 14px 0 18px;
  background: #f9fafb;
  font-size: 0.8rem;
  color: #6b7280;
}

.footer-content p {
  margin: 2px 0;
}

/* ===========================
   ADMIN
   =========================== */
.admin-body {
  background: #0f172a;
}

.admin-header {
  background: #020617;
  color: #e5e7eb;
}

.admin-dashboard {
  background: #ffffff;
  border-radius: 18px;
  padding: 16px;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-right {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .header-content {
    flex-wrap: wrap;
    gap: 8px;
  }
  .main-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .header-actions {
    order: 2;
    margin-left: auto;
  }
}

@media (max-width: 540px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filters-search input {
    width: 100%;
  }
}
