/* La foto de perfil no debe recibir estilos de la bandera */
.avatar-sm { border: none !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; }

/* Estilo exclusivo para la bandera de la barra superior */
#flag-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-left: 8px;
  vertical-align: middle;
}

/* Imagen dentro del wrapper: mayor resolución y nitidez */
#flag-icon-wrapper img {
  width: 44px !important;
  height: 28px !important;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  image-rendering: auto;
}

/* Oculta por completo cualquier rastro del traductor de Google */
#google_translate_element,
.goog-te-banner-frame,
.goog-te-balloon-frame,
.goog-te-gadget,
.goog-te-gadget-simple,
.goog-te-combo,
.goog-logo-link,
.goog-te-spinner-pos,
.goog-te-menu2,
.goog-tooltip {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  pointer-events: none !important;
}
body { top: 0px !important; } /* Evita empujes del banner */

.hot-badge {
  background: linear-gradient(135deg, #ff6a00, #ff0000);
  color: white;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  animation: hotPulse 1.4s infinite ease-in-out;
  box-shadow: 0 0 10px rgba(255, 100, 0, 0.6);
}

@keyframes hotPulse {
  0%   { transform: scale(1); background: linear-gradient(135deg, #ff6a00, #ff0000); box-shadow: 0 0 8px rgba(255,80,0,0.5); }
  50%  { transform: scale(1.15); background: linear-gradient(135deg, #ff0000, #ff6a00); box-shadow: 0 0 18px rgba(255,50,0,0.8); }
  100% { transform: scale(1); background: linear-gradient(135deg, #ff6a00, #ff0000); box-shadow: 0 0 8px rgba(255,80,0,0.5); }
}

/* Estilo app móvil */
:root{ --app-max-width:420px; }

body, html { height: 100%; margin:0; background:#f8fafc; }

#app-shell { min-height:100svh; display:flex; flex-direction:column; }

main.container.content { flex:1 1 auto; overflow:auto; padding-bottom:92px; }

/* Botones */
.btn, .tab-btn, .menu-btn {
  padding: 14px 16px !important;
  font-size: 17px !important;
  border-radius:14px !important;
  display:flex; align-items:center; gap:6px;
}

/* Login / Registro flotantes */
dialog.auth-modal {
  max-width: 90%;
  width: 360px;
  border-radius:16px;
  padding:20px;
  border:none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
dialog::backdrop {
  background: rgba(0,0,0,0.4);
}

/* Perfil organizado */
.profile-section {
  display:flex; flex-wrap:wrap; gap:12px;
}
.profile-section .card {
  flex:1 1 calc(50% - 12px);
  box-sizing:border-box;
}

/* Vista pública y productos */
.products { display:flex; flex-wrap:wrap; gap:12px; }
.product {
  flex:1 1 calc(50% - 12px);
  box-sizing:border-box;
  border-radius:12px;
  padding:12px;
  background:white;
  display:flex; flex-direction:column; gap:8px;
}
.product-actions {
  display:flex; justify-content:space-between; gap:8px;
}

/* Ocultar header nav en móvil */
@media (max-width: 640px) {
  header nav { display:none !important; }
}

/* Fix background colors for consistent theme */
html, body, main.container.content {
  background: var(--background);
}


/* Bottom nav styling (adaptive to theme) */
#bottom-nav {
  display:flex;
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:12px;
  z-index:70;
  gap:8px;
  background: var(--card);
  border:1px solid var(--border);
  padding:8px;
  border-radius:16px;
  box-shadow: 0 8px 20px rgba(2,6,23,0.25);
  width: calc(100% - 28px);
  max-width: var(--app-max-width);
  justify-content:space-between;
  align-items:center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color:var(--text);
}

#bottom-nav .nav-item {
  flex:1; text-align:center; font-weight:700;
  font-size:13px; display:flex; flex-direction:column;
  gap:4px; align-items:center; justify-content:center;
  padding:6px; border-radius:12px; background:transparent;
  border:none; color:inherit;
}
#bottom-nav .nav-item svg, 
#bottom-nav .nav-item i { width:22px; height:22px; display:block; }
#bottom-nav .nav-item.active {
  background: linear-gradient(135deg,var(--brand),var(--brand-2));
  color:white;
}

.star.active { color: gold; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overscroll-behavior: none;
  font-family: 'Arial', sans-serif;
  background-color: #121212;
  color: #ffffff;
}

/* Navbar y botones estilo app */
.navbar {
  position: fixed;
  bottom: 0;
  width: 100%;
  background-color: #1e1e1e;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
  z-index: 999;
}

.navbar a, header a {
  color: #00ff7f;
  text-decoration: none;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Imágenes de producto */
.product-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6);
  transition: transform 0.3s ease;
}

.product-image:active {
  transform: scale(0.95);
}

/* Modal para detalles de imagen */
.image-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
}

.image-modal img {
  max-width: 90%;
  max-height: 80%;
  border-radius: 16px;
}

.image-modal.active {
  display: flex;
}

/* Modal de producto — diseño moderno, flexible y amplio */
dialog#product-modal {
  max-width: 980px;
  width: 100%;
  border: none;
  background: var(--card);
  color: var(--text);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
dialog#product-modal .chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg,var(--brand),var(--brand-2));
  color: #fff;
  border: none;
}
dialog#product-modal .chat-header #m-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .2px;
}
dialog#product-modal .modal-actions .btn {
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-weight: 800;
}
dialog#product-modal .modal-actions .btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

dialog#product-modal > div:not(.chat-header) {
  padding: 16px;
  display: grid;
  gap: 16px;
}
dialog#product-modal .grid.cols-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

/* Card galería */
dialog#product-modal .carousel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  height: 100%;
}
dialog#product-modal .slides { height: 100%; }
dialog#product-modal .slide { height: 420px; }
@media (max-width: 640px) {
  dialog#product-modal .slide { height: 52vh; }
}

/* Columna de detalles */
dialog#product-modal .details-col {
  display: grid;
  gap: 10px;
  align-content: start;
}
dialog#product-modal .price {
  font-size: 26px;
  font-weight: 900;
}
dialog#product-modal #m-cat {
  font-size: 13px;
  border-radius: 10px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  width: max-content;
}
dialog#product-modal #m-desc {
  max-height: 260px;
  overflow: auto;
  white-space: pre-line;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

/* Ficha vendedor + ubicación */
dialog#product-modal .facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: center;
}
dialog#product-modal .fact {
  display: grid;
  gap: 4px;
}
dialog#product-modal .fact .label {
  font-size: 13px;
  color: var(--muted);
}
dialog#product-modal #m-distance {
  font-size: 14px;
  opacity: .9;
}

/* Responsive móvil: modal a pantalla completa, header sticky, contenido desplazable */
@media (max-width: 768px) {
  dialog#product-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100svh !important;
    max-height: 100svh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  dialog#product-modal .chat-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }
  dialog#product-modal > div:not(.chat-header) {
    height: calc(100svh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  dialog#product-modal .grid.cols-2 {
    grid-template-columns: 1fr;
  }
  dialog#product-modal .price { font-size: 22px; }
}

footer {
    margin-top: 40px;
    padding: 24px 12px;
    text-align: center;
    font-size: 15px;
    color: #555;
  }

  footer nav {
    margin-top: 6px;
    align-content: center;
  }

  footer a {
    color: #0a89e4;
    font-weight: 600;
    text-decoration: none;
    margin: 0 6px;
    transition: color 0.2s ease;
  }

  footer a:hover {
    color: #005999;
    text-decoration: underline;
    text-align: center;
    align-content: center;
  }

  footer span {
    color: #999;
    margin: 0 4px;
  }


    :root{
      --bg:#0f172a;
      --panel:#0b1220;
      --muted:#94a3b8;
      --text:#e5e7eb;
      --brand:#22d3ee;
      --brand-2:#a78bfa;
      --ok:#10b981;
      --warn:#f59e0b;
      --err:#ef4444;
      --card:#0b1220;
      --border:#1f2937;
      --shadow: 0 10px 30px rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.02) inset;
      --radius:16px;
    }
    html[data-theme="light"]{
      --bg:#f8fafc;
      --panel:#ffffff;
      --muted:#475569;
      --text:#0f172a;
      --brand:#06b6d4;
      --brand-2:#7c3aed;
      --ok:#059669;
      --warn:#d97706;
      --err:#dc2626;
      --card:#ffffff;
      --border:#e2e8f0;
      --shadow: 0 6px 20px rgba(2,6,23,.06);
    }
    *{box-sizing:border-box}
    html,body{height:100%}
    body{
      margin:0; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
      background:
        radial-gradient(1200px 800px at 20% -10%, rgba(34,211,238,.06), transparent 60%),
        radial-gradient(1000px 700px at 120% 10%, rgba(167,139,250,.04), transparent 60%),
        var(--bg);
      color:var(--text);
      -webkit-font-smoothing:antialiased;
      -moz-osx-font-smoothing:grayscale;
    }
    header{
      position:sticky; top:0; z-index:40;
      background: linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,.02));
      backdrop-filter: blur(6px);
      border-bottom:1px solid var(--border);
    }
    .container{max-width:1100px; margin:0 auto; padding:12px}
    .row{display:flex; gap:10px; flex-wrap:wrap}
    .brand{display:flex; align-items:center; gap:10px; font-weight:800; letter-spacing:.2px; font-size:16px}
    .brand .dot{width:12px;height:12px;border-radius:50%; background:linear-gradient(135deg,var(--brand),var(--brand-2)); box-shadow:0 0 14px rgba(34,211,238,.25)}
    nav{margin-left:auto; display:flex; gap:12px; align-items:center}
    .tab-btn{appearance:none;border:1px solid var(--border); background:var(--card); color:var(--text); padding:14px 18px; border-radius:999px; cursor:pointer; transition:.12s transform, .12s background; font-size:16px; font-weight:800}
    .tab-btn[aria-current="page"]{background:linear-gradient(135deg, rgba(34,211,238,.12), rgba(167,139,250,.08)); border-color:transparent}
    .btn{display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:10px 14px; border-radius:12px; border:1px solid var(--border); background:var(--card); color:var(--text); cursor:pointer; font-size:15px; font-weight:800}
    .btn.primary{background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:#fff; border:none}
    .btn:disabled{opacity:.6; cursor:not-allowed}
    .content{padding:18px 12px}
    .user-chip{display:flex; align-items:center; gap:8px}
    .avatar-sm{width:34px;height:34px;border-radius:50%; border:1px solid var(--border); background:var(--card); object-fit:cover}
    .menu{position:relative}
    .menu-btn{border:1px solid var(--border); background:var(--card); color:var(--text); padding:12px 14px; border-radius:12px; cursor:pointer; font-size:14px; font-weight:700}
    .menu-panel{position:absolute; right:0; top:52px; background:var(--card); border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow); min-width:220px; display:none; z-index:50}
    .menu-panel.open{display:block}
    .menu-panel button{width:100%; text-align:left; padding:12px 14px; background:transparent; border:none; color:var(--text); cursor:pointer; font-size:15px}
    .menu-panel button:hover{background:rgba(0,0,0,.03)}
    .card{background:linear-gradient(180deg, rgba(255,255,255,.01), rgba(255,255,255,0)); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow)}
    .section{padding:16px}
    .section h2{margin:0 0 10px; font-size:22px}
    .muted{color:var(--muted)}
    .grid{display:grid; gap:12px}
    .grid.cols-2{grid-template-columns: repeat(2, minmax(0, 1fr))}
    .grid.cols-3{grid-template-columns: repeat(3, minmax(0, 1fr))}
    @media (max-width: 980px){ .grid.cols-3{grid-template-columns:1fr 1fr} }
    @media (max-width: 720px){ .grid.cols-2, .grid.cols-3{grid-template-columns:1fr} }
    input, select, textarea{width:100%; padding:14px 14px; border-radius:14px; border:1px solid var(--border); background:var(--card); color:var(--text); font-size:16px}
    textarea{min-height:96px; resize:vertical}
    .actions{display:flex; gap:10px; flex-wrap:wrap}
    .products{display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:16px}
    @media (max-width: 1024px){ .products{grid-template-columns: repeat(2, minmax(0, 1fr));} }
    @media (max-width: 640px){
  /* ==== Fix responsive perfil en móviles ==== */
  #tab-profile form,
  #profile-form,
  #profile-form .grid,
  #profile-form .grid.cols-2 {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }
  #profile-form input,
  #profile-form select,
  #profile-form textarea,
  #profile-form button {
    max-width: 100% !important;
  }
 .products{grid-template-columns: 1fr;} }
    .product{display:flex; flex-direction:column; overflow:hidden; border-radius:16px; border:1px solid var(--border); background:var(--card); cursor:pointer; transition:transform .12s}
    .product:hover{transform:translateY(-3px)}
    .product .media{position:relative; background:var(--panel); aspect-ratio:16/10; overflow:hidden; display:block}
    .product img, .product video{width:100%; height:100%; object-fit:cover; display:block}
    .product .info{padding:12px 14px; display:grid; gap:8px}
    .badge{font-size:13px; border-radius:999px; padding:6px 10px; color:var(--muted); background:transparent; border:1px solid var(--border); width:max-content}
    .price{font-variant-numeric:tabular-nums; font-weight:900}
    .empty{border:1px dashed var(--border); color:var(--muted); background:transparent; padding:22px; border-radius:12px; text-align:center; font-size:15px}
    .locked{display:grid; place-items:center; min-height:220px; border:1px dashed var(--border); border-radius:12px; background:transparent; color:var(--muted); position:relative}
    .locked .big-letter{font-size:120px; font-weight:900; line-height:1; opacity:.8}
    .locked .hint{position:absolute; bottom:12px; font-size:13px; color:var(--muted)}
    .carousel{position:relative; width:100%; height:100%; overflow:hidden; background:var(--panel)}
    .slides{display:flex; width:100%; height:100%; transition:transform .35s ease}
    .slide{min-width:100%; height:360px; display:grid; place-items:center; background:var(--panel)}
    .slide img, .slide video{width:100%; height:100%; object-fit:cover}
    .nav-btn{
        position:absolute; 
        top:50%; 
        transform:translateY(-50%); 
        border:none; 
        background:rgba(0,0,0,.45); 
        color:white; 
        width:42px; 
        height:42px; 
        border-radius:50%; 
        cursor:pointer; 
        display:flex; 
        align-items:center; 
        justify-content:center; 
        font-size:20px; 
        font-weight:bold; 
        box-shadow:0 2px 6px rgba(0,0,0,.4); 
        transition:background 0.2s, transform 0.2s;
    }
    .nav-btn:hover{
        background:rgba(0,0,0,.65);
        transform:translateY(-50%) scale(1.1);
    }
    .nav-btn.prev{left:10px} .nav-btn.next{right:10px}
    .dots{position:absolute; bottom:10px; left:0; right:0; display:flex; justify-content:center; gap:6px}
    .dot{width:8px; height:8px; border-radius:999px; background:rgba(255,255,255,.5); border:none; cursor:pointer}
    .dot.active{background:white}
    @media (max-width:640px){ .slide{height:260px} }
    /* Chat drawer is kept hidden, icon removed */
    .chat-drawer{position:fixed; right:12px; bottom:12px; width:360px; max-width:calc(100% - 24px); background:var(--card); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow); display:none; z-index:60}
    .chat-header{display:flex; align-items:center; justify-content:space-between; padding:12px 14px; border-bottom:1px solid var(--border)}
    .chat-body{height:340px; overflow:auto; padding:12px; display:flex; flex-direction:column; gap:8px}
    .bubble{max-width:80%; padding:10px 12px; border-radius:16px; font-size:14px; line-height:1.3}
    .bubble.me{align-self:flex-end; background:linear-gradient(135deg,var(--brand),var(--brand-2)); color:var(--text); font-weight:800}
    .bubble.them{align-self:flex-start; background:var(--panel); border:1px solid var(--border)}
    .chat-input{display:flex; gap:10px; padding:12px; border-top:1px solid var(--border)}
    .chat-input input{flex:1}
    .loading-backdrop{position:fixed; inset:0; background:rgba(0,0,0,.35); display:none; place-items:center; z-index:80; backdrop-filter: blur(1px)}
    .spinner{width:60px; height:60px; border:6px solid rgba(255,255,255,.2); border-top-color:#fff; border-radius:50%; animation:spin 1s linear infinite}
    @keyframes spin{to{transform:rotate(360deg)}}

    /* Auth modal respects theme */
    dialog{ border:none; padding:0; background:var(--card); color:var(--text); border-radius:16px; box-shadow:var(--shadow); max-width:520px; width:100% }
    dialog::backdrop{ background: rgba(0,0,0,.45); backdrop-filter: blur(1.5px) }

    /* Public profile contact icons */
    .pv-icons{ display:flex; gap:8px; margin-top:8px }
    .icon-btn{ display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:999px; border:1px solid var(--border); background:var(--card); text-decoration:none; font-size:18px }
    .icon-btn:hover{ transform: translateY(-1px) }
  
/* Footer profesional y responsive */
.footer-pro {
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 20px;
  font-size: 14px;
  color: var(--muted);
}
.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  gap: 10px;
}
.footer-container nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-container a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}
.footer-container a:hover {
  text-decoration: underline;
  color: var(--brand-2);
}

/* Badge categoría más profesional */
.badge {
  font-size: 13px;
  border-radius: 8px;
  padding: 4px 8px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  font-weight: 600;
}
/* Botonera modal */
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
/* Modal de denuncia */
#report-modal textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
#report-modal .suggestions {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

/* Animación de la bolita */
.brand .dot {
  animation: pulseDot 2s infinite ease-in-out;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px rgba(34,211,238,0.5); }
  50% { transform: scale(1.3); box-shadow: 0 0 20px rgba(167,139,250,0.8); }
}

/* Modal de producto más profesional y responsive */
#product-modal {
  border-radius: 20px;
  overflow: hidden;
  animation: fadeInModal 0.3s ease;
}
@keyframes fadeInModal {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
#product-modal .chat-header {
  background: linear-gradient(135deg,var(--brand),var(--brand-2));
  color: white;
  font-weight: 800;
  border-bottom: none;
}
#product-modal .modal-actions .btn {
  border-radius: 10px;
  transition: transform 0.2s, background 0.2s;
}
#product-modal .modal-actions .btn:hover {
  transform: translateY(-2px);
  background: var(--brand);
  color: white;
}
#product-modal .grid {
  grid-template-columns: 1fr;
}
@media(min-width:768px){
  #product-modal .grid.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Carousel mejoras */
#product-modal .carousel {
  border-radius: 14px;
  overflow: hidden;
}
#product-modal .slide img, 
#product-modal .slide video {
  border-radius: 12px;
  transition: transform 0.3s ease;
}
#product-modal .slide img:hover, 
#product-modal .slide video:hover {
  transform: scale(1.05);
}

/* Animación fade para el modal de vendedor también */
#seller-modal {
  border-radius: 20px;
  overflow: hidden;
  animation: fadeInModal 0.3s ease;
}
#seller-modal .chat-header {
  background: linear-gradient(135deg,var(--brand-2),var(--brand));
  color: white;
  border-bottom: none;
}

/* Ajuste modal producto: etiqueta solo al tamaño del texto */
#product-modal #m-cat {
  display: inline-block !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  width: auto !important;
  min-width: fit-content !important;
  max-width: 10% !important;
  white-space: nowrap !important;
  background: var(--panel);
  font-weight: 600;
  font-size: 14px;
}

/* High-specificity override to truly hide forms when logged out */
#profile-form.hidden-important{ display: none !important; }
#product-form.hidden-important{ display: none !important; }

/* ====== Ajustes de "app" SOLO en móviles (no afecta desktop) ====== */
@media (max-width: 640px) {
  /* ==== Fix responsive perfil en móviles ==== */
  #tab-profile form,
  #profile-form,
  #profile-form .grid,
  #profile-form .grid.cols-2 {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: wrap !important;
    width: 100% !important;
  }
  #profile-form input,
  #profile-form select,
  #profile-form textarea,
  #profile-form button {
    max-width: 100% !important;
  }

  /* Asegurar que los títulos no se tapen y tengan aire */
  #tab-market h2,
  #tab-add h2,
  #tab-profile h2 {
    margin-top: 10px !important;
    margin-bottom: 10px !important;
    line-height: 1.2;
    word-break: break-word;
  }

  /* Barra de filtros en "Explorar productos": apilar elementos y que se lean bien */
  #tab-market > .grid > .grid {
    display: grid !important;
    grid-template-columns: 1fr !important; /* Fuerza 1 columna */
    gap: 10px !important;
  }
  #tab-market > .grid > .grid input,
  #tab-market > .grid > .grid select,
  #tab-market > .grid > .grid button {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Evitar que algo se salga: forzar wrap en grids genéricos con muchas columnas */
  .grid.cols-2 { grid-template-columns: 1fr !important; }
  .grid.cols-3 { grid-template-columns: 1fr !important; }
  .grid.cols-4 { grid-template-columns: 1fr !important; }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Modal de producto a pantalla completa, con contenido desplazable */
  dialog#product-modal,
  dialog#seller-modal,
  dialog#auth-modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100svh !important;
    max-height: 100svh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }
  #product-modal .chat-header,
  #seller-modal .chat-header {
    position: sticky;
    top: 0;
    z-index: 10;
  }
  /* El contenedor que sigue al header del modal: que sea scroll */
  #product-modal > div:not(.chat-header) {
    height: calc(100svh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* En el detalle del producto, apilar y asegurar visibilidad de contactos y distancia */
  #product-modal .price { font-size: 22px; font-weight: 800; }
  #m-distance { display: block !important; font-size: 14px; margin-top: 6px; opacity: .9; }
  #m-owner-link { gap: 10px !important; }
  #m-owner-photo { width: 36px !important; height: 36px !important; }
  #product-modal .grid.cols-2 { grid-template-columns: 1fr !important; }

  /* Carrusel: que la imagen ocupe 100% sin desbordar */
  #product-modal .carousel,
  #product-modal .slides,
  #product-modal .slide img,
  #product-modal .slide video {
    width: 100% !important;
    height: auto !important;
    max-height: 52vh;
    object-fit: cover;
  }

  /* Asegurar legibilidad general en móvil */
  body { font-size: 16px; }
  .muted { font-size: 14px; }
}

/* Ajuste para contenedores de etiquetas (ej: electronica) */
.etiqueta, .tag, .categoria-label {
  display: inline-block !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  width: auto !important;
  min-width: fit-content !important;
  height: auto !important;
  white-space: nowrap !important;
}

/* Ajuste refinado de contenedores de etiquetas */
.etiqueta, .tag, .categoria-label, .badge, #m-cat {
  display: inline-block !important;
  padding: 2px 6px !important;
  border-radius: 6px !important;
  box-sizing: border-box !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  line-height: 1.2em !important;
  white-space: nowrap !important;
}

.hidden-important { display: none !important; }

dialog[open].custom-alert {
  z-index: 99999 !important;
}
dialog[open].custom-alert::backdrop {
  z-index: 99998 !important;
}

/* Estilos de estrellas — adaptables a tema claro/oscuro mediante variables */
:root{
  --star-empty: rgba(255,255,255,0.55); /* vacío en tema oscuro */
  --star-filled: #f59e0b; /* dorado */
  --star-hover: #fbbf24;
  --star-shadow: rgba(0,0,0,0.18);
  --star-size: 20px;
}

/* En tema claro los "vacíos" deben verse (gris oscuro) */
html[data-theme="light"]{
  --star-empty: rgba(15,23,42,0.45); /* gris oscuro sobre fondo claro */
  --star-shadow: rgba(255,255,255,0.06);
}

/* Base: estrellas ligeramente apagadas pero visibles en ambos temas */
.star {
  display: inline-block;
  font-size: var(--star-size);
  line-height: 1;
  color: var(--star-empty);
  transition: color 180ms ease, transform 180ms ease, text-shadow 220ms ease;
  will-change: transform, color;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  text-shadow: 0 0 0 rgba(0,0,0,0);
}

/* Hover (al pasar el ratón) — se pone amarillo suave y con 'glow' */
.star.hover,
.rating .star:hover,
.rating .star.hover {
  color: var(--star-hover);
  transform: scale(1.12);
  text-shadow: 0 6px 18px rgba(251,191,36,0.14);
}

/* Seleccionada — color amarillo más brillante con pequeño 'pop' */
.star.selected,
.star.active {
  color: var(--star-filled);
  transform: scale(1.08);
  text-shadow: 0 8px 28px rgba(245,158,11,0.22);
  animation: starPop 360ms cubic-bezier(.2,.9,.3,1);
}

/* Pequeña animación al marcar */
@keyframes starPop {
  0%   { transform: scale(0.85); opacity: 0.85; }
  50%  { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1.08); opacity: 1; }
}

/* Asegurar que el área de estrellas tenga separación y centro si se necesita */
.rating { display: inline-flex; gap:6px; align-items:center; }

/* Asegurar contraste suficiente cuando el fondo cambia (soporte extra) */
.rating .star[style*="color:"] { color: inherit !important; }

/* Forcing auth/login/register boxes to follow html[data-theme] */
html[data-theme="light"] #auth-modal { background: #ffffff !important; color: #0f172a !important; border: 1px solid #e2e8f0 !important; }
html[data-theme="light"] dialog#auth-modal input, html[data-theme="light"] dialog#auth-modal select, html[data-theme="light"] dialog#auth-modal textarea { background: #ffffff !important; color: #0f172a !important; border: 1px solid #cbd5e1 !important; }
html[data-theme="light"] #login-form, html[data-theme="light"] #register-form { color: #0f172a !important; background: transparent !important; }
html[data-theme="dark"] #auth-modal { background: var(--card) !important; color: var(--text) !important; border: 1px solid var(--border) !important; }
html[data-theme="dark"] dialog#auth-modal input, html[data-theme="dark"] dialog#auth-modal select, html[data-theme="dark"] dialog#auth-modal textarea { background: var(--panel) !important; color: var(--text) !important; border: 1px solid var(--border) !important; }
#auth-modal { transition: background .18s ease, color .18s ease, border-color .18s ease; }
#auth-modal .close-btn { background: transparent; border: none; }

@media (max-width: 768px) {
  #right-ads { display: none !important; }
}

#auth-modal {
  padding: 22px 20px;
  border-radius: 18px;
  max-width: 480px;
  width: calc(100% - 36px);
  box-sizing: border-box;
  position: relative;
}
/* Botón X */
#auth-modal .close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  transition: transform .15s ease, color .15s ease;
}
#auth-modal .close-btn:hover { transform: scale(1.1); }
/* Inputs */
#auth-modal input[type="email"],
#auth-modal input[type="password"],
#auth-modal input[type="text"],
#auth-modal input[type="tel"],
#auth-modal input[type="url"] {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
#auth-modal input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59,130,246,0.25);
  transform: translateY(-1px);
}
/* Tema claro */
@media (prefers-color-scheme: light) {
  #auth-modal { background: #ffffff; border: 1px solid #e2e8f0; color: #1e293b; }
  #auth-modal .close-btn { color: #334155; }
  #auth-modal .close-btn:hover { color: #ef4444; }
  #auth-modal input { background: #ffffff; border: 1px solid #cbd5e1; color: #1e293b; }
}
/* Tema oscuro */
@media (prefers-color-scheme: dark) {
  #auth-modal { background: #1e293b; border: 1px solid #334155; color: #f1f5f9; }
  #auth-modal .close-btn { color: #f1f5f9; }
  #auth-modal .close-btn:hover { color: #f87171; }
  #auth-modal input { background: #0f172a; border: 1px solid #334155; color: #f1f5f9; }
}

#splash-loader {
    position: fixed;
    inset: 0;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    color: var(--text, #e5e7eb);
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    gap: 18px;
   background-color: #000000; }

  #splash-logo {
    max-width: 220px;
    width: 60%;
    height: auto;
  }
  .loader-circle {
    width: 70px;
    height: 70px;
    border: 6px solid rgba(255,255,255,0.2);
    border-top-color: var(--brand, #22d3ee);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

/* Oculta por completo cualquier rastro del traductor de Google */
#google_translate_element,
.goog-te-banner-frame,
.goog-te-balloon-frame,
.goog-te-gadget,
.goog-te-gadget-simple,
.goog-te-combo,
.goog-logo-link,
.goog-te-spinner-pos,
.goog-te-menu2,
.goog-tooltip {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  pointer-events: none !important;
}
body { top: 0px !important; } /* Evita empujes del banner */

.points-card {
    max-width: 420px;
    margin: 2rem auto;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    padding: 2rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  }
  .points-card h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: #333;
  }
  .points-card label {
    display: block;
    margin-top: 1rem;
    font-weight: 600;
    color: #555;
  }
  .points-card select {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
    border-radius: 8px;
    border: 1px solid #ccc;
  }
  .points-card button {
    width: 100%;
    padding: 0.8rem;
    margin-top: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease;
  }
  .points-card button.alt {
    background: #2ecc71;
    color: #fff;
  }
  .points-card button.alt:hover {
    background: #27ae60;
  }

/* Ocultar navegación inferior en escritorio y mostrar en móviles */
  #bottom-nav { display: none !important; }
  /* Quitar relleno inferior extra en escritorio (solo necesario en móviles) */
  main.container.content { padding-bottom: 0 !important; }
  @media (max-width: 640px) {
    #bottom-nav { display: flex !important; }
    main.container.content { padding-bottom: 92px !important; }
  }

@media (max-width: 768px) {
  /* Hide top tabs strictly on phones */
  #top-tabs-nav, nav.top-tabs-nav { display: none !important; }

  /* App-like big brand */
  .brand {
    font-size: 28px !important;
    font-weight: 900 !important;
    letter-spacing: .2px !important;
  }
  .brand .muted {
    font-weight: 800 !important;
  }
}

/* Fix seguro para modal de producto en móviles */
@media (max-width: 640px) {
  dialog#product-modal[open] {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  dialog#product-modal[open] .chat-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    flex-shrink: 0 !important;
  }
  dialog#product-modal[open] > div:not(.chat-header) {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  }
  /* Forzar 1 columna en móviles */
  dialog#product-modal[open] .grid.cols-2 {
    grid-template-columns: 1fr !important;
  }
  /* Carrusel ajustado */
  dialog#product-modal[open] .slide {
    height: auto !important;
    min-height: 220px !important;
  }
  dialog#product-modal[open] .carousel,
  dialog#product-modal[open] .slides,
  dialog#product-modal[open] .slide img,
  dialog#product-modal[open] .slide video {
    width: 100% !important;
    height: auto !important;
    max-height: 45dvh !important;
    object-fit: cover !important;
  }
  #m-distance { display: block !important; margin-top: 6px !important; }
  #m-address { display: block !important; }
}

#points-modal { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.85); z-index:99999; align-items:center; justify-content:center; animation:fadeIn 0.4s ease; }
  #points-modal .box { background:linear-gradient(145deg,#1e1e1e,#2a2a2a); color:#f1f1f1; padding:24px; border-radius:18px; width:380px; max-width:92%; box-shadow:0 0 25px rgba(0,0,0,0.7), 0 0 10px rgba(0,170,255,0.4); transform:scale(0.9); animation:popIn 0.35s ease forwards; }
  #points-modal h3 { margin:0 0 12px; font-size:20px; font-weight:900; text-align:center; color:#0af; letter-spacing:1px; }
  #points-modal .small { font-size:13px; color:#bbb; margin-top:6px; text-align:center; }
  #points-modal .notice { margin-top:12px; font-size:13px; color:#aaa; text-align:center; }
  .points-quick { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; margin-top:12px; }
  .points-quick button{ padding:10px 14px; border-radius:10px; border:1px solid #0af; background:#111; cursor:pointer; font-weight:700; color:#0af; transition:all 0.25s ease; }
  .points-quick button:hover { background:#0af; color:#fff; transform:translateY(-2px); box-shadow:0 0 12px rgba(0,170,255,0.6); }
  input#points-input { background:#111; border:1px solid #444; color:#fff; padding:8px; border-radius:8px; width:100%; margin-top:10px; font-size:15px; }
  .btn.primary { background:linear-gradient(90deg,#0af,#08c); color:#fff; border:none; padding:10px 14px; border-radius:10px; font-weight:700; transition:all 0.25s ease; }
  .btn.primary:hover { background:linear-gradient(90deg,#08c,#0af); transform:translateY(-2px); box-shadow:0 0 15px rgba(0,170,255,0.6); }
  @keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
  @keyframes popIn { from {opacity:0; transform:scale(0.9);} to {opacity:1; transform:scale(1);} }

/* Estrellas corregidas: solo marcadas por la cuenta actual deben ser doradas */
.star { color: var(--star-empty, gray); }
.star.active { color: var(--star-filled, gold); }

@keyframes pulseHot {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.15); opacity: 0.8; }
}
.product { position: relative; }

/* HOT badge styling (top-right) */

@keyframes hotPulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: .95; }
  100% { transform: scale(1); opacity: 1; }
}
.product { position: relative; overflow: visible; }
/* Ensure rating stars default to 'empty' look unless active for the current user */
.rating .star { color: var(--star-empty, rgba(255,255,255,0.45)); }
.rating .star.active, .rating .star.selected { color: var(--star-filled, #f59e0b); transform: none; }

/* HOT badge for highly rated products */
.hot-badge{
  position:absolute;
  top:8px;
  right:8px;
  background: linear-gradient(90deg,#ff4d4f,#ff7a18);
  color:white;
  font-weight:800;
  padding:6px 8px;
  border-radius:8px;
  box-shadow: 0 6px 18px rgba(255,90,60,0.28);
  z-index: 20;
  font-size:12px;
  letter-spacing:0.6px;
  pointer-events: none;
}
.product { position: relative; overflow: visible; }