/* PrecioYa - Estilos públicos */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:       #1D9E75;
  --green-light: #E1F5EE;
  --green-mid:   #5DCAA5;
  --green-dark:  #085041;
  --green-deep:  #0F6E56;
  --purple-bg:   #EEEDFE;
  --purple-text: #3C3489;
  --blue-bg:     #E6F1FB;
  --blue-text:   #0C447C;
  --red:         #E24B4A;
  --red-bg:      #FCEBEB;
  --gray-bg:     #F8F8F6;
  --gray-border: rgba(0,0,0,0.1);
  --text:        #1a1a1a;
  --text-muted:  #666;
  --white:       #ffffff;
  --radius:      10px;
  --radius-lg:   14px;
  --shadow:      0 1px 3px rgba(0,0,0,0.07);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--gray-bg); color: var(--text); font-size: 15px; line-height: 1.6; }
.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* Navbar */
.navbar { background: var(--white); border-bottom: 1px solid var(--gray-border); position: sticky; top: 0; z-index: 100; }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-logo { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; }
.logo-text { font-size: 20px; font-weight: 600; color: var(--green); letter-spacing: -0.5px; }
.logo-city { font-size: 11px; color: var(--text-muted); }
.nav-links { display: flex; align-items: center; gap: 1.25rem; }
.nav-links a { color: var(--text-muted); font-size: 14px; display: flex; align-items: center; gap: 4px; }
.nav-links a:hover { color: var(--green); text-decoration: none; }
.btn-nav { background: var(--green); color: var(--white) !important; padding: 7px 16px; border-radius: var(--radius); font-size: 13px !important; font-weight: 500; }
.btn-nav:hover { background: var(--green-deep) !important; }

/* Hero */
.hero { background: var(--white); padding: 2.5rem 0 2rem; border-bottom: 1px solid var(--gray-border); }
.hero-city { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; background: var(--purple-bg); color: var(--purple-text); padding: 4px 12px; border-radius: 999px; font-weight: 500; margin-bottom: 1rem; }
.hero h1 { font-size: 26px; font-weight: 600; margin-bottom: .35rem; }
.hero p { color: var(--text-muted); font-size: 15px; margin-bottom: 1.5rem; }
.search-form { display: flex; gap: 8px; }
.search-form input { flex: 1; height: 48px; border: 1.5px solid var(--gray-border); border-radius: var(--radius); padding: 0 16px; font-size: 15px; background: var(--gray-bg); transition: border-color .15s; }
.search-form input:focus { outline: none; border-color: var(--green); background: var(--white); }
.search-form button { height: 48px; padding: 0 24px; background: var(--green); color: var(--white); border: none; border-radius: var(--radius); font-size: 15px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.search-form button:hover { background: var(--green-deep); }

/* Categorías */
.cats-bar { background: var(--white); border-bottom: 1px solid var(--gray-border); overflow-x: auto; scrollbar-width: none; }
.cats-bar::-webkit-scrollbar { display: none; }
.cats-inner { display: flex; gap: 6px; padding: .75rem 1.25rem; width: max-content; }
.cat-pill { display: flex; align-items: center; gap: 5px; padding: 6px 14px; border: 1px solid var(--gray-border); border-radius: 999px; font-size: 13px; cursor: pointer; background: var(--white); color: var(--text-muted); white-space: nowrap; text-decoration: none; transition: all .15s; }
.cat-pill:hover, .cat-pill.active { background: var(--green-light); border-color: var(--green-mid); color: var(--green-dark); text-decoration: none; }
.cat-pill i { font-size: 14px; }

/* Layout principal */
.main-grid { display: grid; grid-template-columns: 1fr 280px; gap: 1.5rem; padding: 1.5rem 0 3rem; align-items: start; }
@media (max-width: 720px) { .main-grid { grid-template-columns: 1fr; } }

/* Tarjetas de producto */
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.results-header h2 { font-size: 15px; font-weight: 500; color: var(--text-muted); }
.sort-select { font-size: 13px; border: 1px solid var(--gray-border); border-radius: var(--radius); padding: 5px 10px; background: var(--white); color: var(--text); }

.product-card { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: .75rem; display: flex; gap: 14px; position: relative; transition: border-color .15s; }
.product-card:hover { border-color: var(--green-mid); }
.rank-badge { position: absolute; top: -10px; left: 14px; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.rank-1 { background: var(--green-light); color: var(--green-dark); }
.rank-2 { background: #F1EFE8; color: #444; }
.rank-3 { background: #F1EFE8; color: #666; }
.plan-badge-card { position: absolute; top: -10px; right: 14px; }

.prod-img { width: 72px; height: 72px; border-radius: var(--radius); object-fit: cover; background: var(--gray-bg); flex-shrink: 0; }
.prod-img-placeholder { width: 72px; height: 72px; border-radius: var(--radius); background: var(--gray-bg); display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0; }
.prod-body { flex: 1; min-width: 0; }
.prod-name { font-size: 15px; font-weight: 500; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-store { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.prod-price-row { display: flex; align-items: baseline; gap: 8px; }
.prod-price { font-size: 22px; font-weight: 600; color: var(--green-deep); }
.prod-was { font-size: 13px; color: var(--red); text-decoration: line-through; }
.prod-discount { font-size: 11px; background: var(--green-light); color: var(--green-dark); padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.prod-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.btn-sm { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--gray-border); background: transparent; cursor: pointer; color: var(--text-muted); text-decoration: none; transition: all .15s; }
.btn-sm:hover { background: var(--gray-bg); text-decoration: none; }
.btn-wa { color: var(--green-dark); border-color: var(--green-mid); background: var(--green-light); }
.btn-wa:hover { background: #9FE1CB; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.badge-premium { background: var(--purple-bg); color: var(--purple-text); }
.badge-base { background: var(--blue-bg); color: var(--blue-text); }
.badge-free { background: #F1EFE8; color: #5F5E5A; }

/* Sidebar */
.sidebar-widget { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem; }
.widget-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 1rem; }

/* Ofertas */
.offer-item { display: flex; gap: 10px; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--gray-border); }
.offer-item:last-child { border-bottom: none; padding-bottom: 0; }
.offer-emoji { font-size: 24px; flex-shrink: 0; }
.offer-info { flex: 1; min-width: 0; }
.offer-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offer-store { font-size: 11px; color: var(--text-muted); }
.offer-prices { text-align: right; flex-shrink: 0; }
.offer-now { font-size: 14px; font-weight: 600; color: var(--green-deep); display: block; }
.offer-was-sm { font-size: 11px; color: var(--red); text-decoration: line-through; }

/* Comercios en sidebar */
.store-item { display: flex; align-items: center; gap: 10px; padding: .5rem 0; border-bottom: 1px solid var(--gray-border); text-decoration: none; color: var(--text); }
.store-item:last-child { border-bottom: none; }
.store-item:hover { text-decoration: none; color: var(--green); }
.store-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.store-item-name { font-size: 13px; font-weight: 500; }
.store-item-info { font-size: 11px; color: var(--text-muted); }

/* Página vacía */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 48px; display: block; margin-bottom: 1rem; color: var(--green-mid); }
.empty-state h3 { font-size: 17px; font-weight: 500; margin-bottom: .5rem; color: var(--text); }

/* Flash */
.flash { padding: .85rem 1.25rem; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.flash-success { background: var(--green-light); color: var(--green-dark); }
.flash-error { background: var(--red-bg); color: #A32D2D; }

/* Footer */
.footer { background: var(--white); border-top: 1px solid var(--gray-border); padding: 2rem 0; margin-top: 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: flex-start; }
.footer-brand p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { font-size: 13px; color: var(--text-muted); }
.footer-links a:hover { color: var(--green); }
.footer-copy { font-size: 12px; color: var(--text-muted); width: 100%; }

/* Formularios públicos */
.form-card { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-lg); padding: 2rem; max-width: 520px; margin: 2rem auto; }
.form-card h1 { font-size: 20px; font-weight: 600; margin-bottom: .25rem; }
.form-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--gray-border); border-radius: var(--radius); font-size: 14px; background: var(--gray-bg); color: var(--text); transition: border-color .15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--green); background: var(--white); }
.form-group textarea { resize: vertical; min-height: 90px; }
.btn-primary { width: 100%; height: 44px; background: var(--green); color: var(--white); border: none; border-radius: var(--radius); font-size: 15px; font-weight: 500; cursor: pointer; margin-top: .5rem; }
.btn-primary:hover { background: var(--green-deep); }
.form-link { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 1rem; }

/* Página de comercio */
.store-hero { background: var(--white); border-bottom: 1px solid var(--gray-border); padding: 2rem 0; }
.store-hero-inner { display: flex; gap: 1.5rem; align-items: center; }
.store-logo-lg { width: 80px; height: 80px; border-radius: var(--radius-lg); background: var(--green-light); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: var(--green-dark); flex-shrink: 0; }
.store-hero-info h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.store-hero-info p { color: var(--text-muted); font-size: 14px; }
.store-contact-btns { display: flex; gap: 8px; margin-top: .75rem; flex-wrap: wrap; }

/* Página de producto */
.product-detail { background: var(--white); border: 1px solid var(--gray-border); border-radius: var(--radius-lg); padding: 2rem; margin: 2rem 0; }
.product-detail-img { width: 200px; height: 200px; border-radius: var(--radius-lg); object-fit: cover; background: var(--gray-bg); }

/* Responsive */
@media (max-width: 600px) {
  .hero h1 { font-size: 20px; }
  .search-form { flex-direction: column; }
  .search-form button { width: 100%; justify-content: center; }
  .nav-links a:not(.btn-nav) { display: none; }
}
