/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  flex-direction: row;
  min-height: 100vh; /* === CAMBIO: usar min-height en lugar de height para evitar recortes en mobile */
}

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  padding: 15px;
  z-index: 1000;
}
.sidebar h3 { color: #243447; margin-bottom: 10px; }
.sidebar ul { list-style: none; }
.sidebar ul li { margin-bottom: 10px; }
.sidebar ul li a { text-decoration: none; color: #333; }
.sidebar ul li a:hover { color: #FF9900; font-weight: bold; }

/* ===== Logo en Sidebar ===== */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.sidebar-logo img {
  max-height: 40px;
  display: block;
}
.sidebar-logo span {
  font-size: 20px;
  font-weight: bold;
  color: #243447;
}

/* ===== Caja de ubicación ===== */
.location-box {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.location-box h3 {
  margin-bottom: 6px;
  font-size: 15px;
  color: #243447;
}
.location-box p {
  font-size: 13px;
  color: #444;
}
.location-box .change-location {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: #FF9900;
  text-decoration: none;
  font-weight: bold;
}
.location-box .change-location:hover {
  text-decoration: underline;
}

/* ===== Categorías ===== */
#category-list li {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
#category-list li:hover {
  background: #f5f5f5;
}
#category-list li.active {
  background: #FF9900;
  color: #fff;
  font-weight: bold;
}

/* ===== Layout principal ===== */
.main-layout {
  flex: 1;
  margin-left: 260px;
  width: calc(100% - 260px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.content {
  flex: 1;
  padding: 20px;
  width: 100%;
  margin-top: 60px; /* === CAMBIO: navbar altura coherente */
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  background: #243447;
  color: #fff;
  padding: 10px 20px;
  position: fixed;
  top: 0;
  left: 260px;
  width: calc(100% - 260px);
  height: 50px;
  z-index: 1000;
  flex-wrap: wrap;
}
.navbar .nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
  align-items: center;
}
.navbar .nav-links li a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.navbar .nav-links li a:hover { color: #FF9900; }

/* ===== Hamburguesa (solo móvil) ===== */
.hamburger {
  font-size: 22px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  margin-right: 10px;
  display: none;
}
@media (max-width: 1024px) {
  .hamburger { display: block; }
  .navbar {
    width: 100%;
    left: 0;
  }
  .navbar .nav-links { display: none; }
}
@media (min-width: 1025px) {
  .navbar .nav-links { display: flex !important; }
}

/* ===== Buscadores ===== */
.search-bar-side {
  display: flex; align-items: center;
  background: #E6E6E6; border-radius: 20px;
  padding: 6px 10px; margin-bottom: 15px;
}
.search-bar-side .search-icon { color: #606770; margin-right: 8px; font-size: 16px; }
.search-bar-side input {
  border: none; background: transparent; outline: none; flex: 1;
  font-size: 14px; color: #333;
}
.search-bar-mobile {
  display: none;
  align-items: center;
  background: #E6E6E6;
  border-radius: 20px;
  padding: 6px 10px;
  margin: 10px;
}
.search-bar-mobile .search-icon { color: #606770; margin-right: 8px; font-size: 16px; }
.search-bar-mobile input {
  border: none; background: transparent; outline: none; flex: 1;
  font-size: 14px; color: #333;
}
@media (max-width: 1024px) {
  .search-bar-mobile { display: flex; }
  .search-bar-side { display: none; }
}

/* ===== Botón Publicar ===== */
.publicar-btn { margin-bottom: 20px; }
.publicar-btn a {
  display: block; text-align: center; background: #FF9900; color: #fff;
  font-weight: bold; padding: 10px; border-radius: 6px; text-decoration: none;
}
.publicar-btn a:hover { background: #cc7a00; }

/* ===== Tarjetas ===== */
.container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}
.card {
  background: #fff; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  overflow: hidden; transition: transform 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 320px; /* === CAMBIO: evitar altura 0 que rompe orden en mobile */
}
.card:hover { transform: translateY(-5px); }
.card img { width: 100%; height: 180px; object-fit: cover; flex-shrink:0; }
.card-content { padding: 15px; flex:1; display:flex; flex-direction:column; }
.card-content h3 { font-size: 16px; margin-bottom: 8px; color: #222; }
.card-content p { font-size: 14px; margin-bottom: 5px; }
.card-content .price { color: #FF9900; font-weight: bold; }

/* ===== Formularios ===== */
form {
  background: #fff; padding: 20px; border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1); max-width: 400px; margin: 0 auto;
}
form label { display: block; margin-top: 10px; font-weight: bold; }
form input, form textarea {
  width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ddd; border-radius: 5px;
}
form button {
  width: 100%; margin-top: 15px; padding: 12px; background: #243447; color: #fff;
  border: none; border-radius: 5px; font-weight: bold; cursor: pointer;
}
form button:hover { background: #1b2834; }

/* ===== Botón Google ===== */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  margin-top: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  font-weight: bold;
  color: #000;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.google-btn img {
  width: 20px;
  height: 20px;
}
.google-btn:hover {
  background: #f5f5f5;
  color: #FF9900;
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid #ddd;
  margin: 15px 0;
}

/* Olvidaste contraseña */
.forgot {
  margin-top: 15px;
  text-align: center;
  width: 100%;
}
.forgot a {
  font-size: 14px;
  color: #243447;
  text-decoration: none;
  display: inline-block;
}
.forgot a:hover {
  text-decoration: underline;
  color: #FF9900;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  body { flex-direction: column; }
  .sidebar {
    position: fixed; top: 60px; left: 0;
    width: 75%; height: calc(100% - 60px);
    background: #fff;
    transform: translateX(-100%); transition: transform 0.3s ease;
    z-index: 999;
  }
  .sidebar.active { transform: translateX(0); }
  .main-layout { margin-left: 0; width: 100%; }
  .navbar {
    width: 100%; left: 0;
  }
  .content { margin-top: 60px; padding: 10px; }
  .container { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .card { min-height: auto; } /* permitir ajuste */
}
@media (max-width: 480px) {
  .container { grid-template-columns: 1fr !important; }
  .card img { height: 160px; } /* imagen más baja en mobile */
}

/* ===== Modal Ubicación ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: #fff;
  padding: 20px 20px 30px;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.close-modal {
  position: absolute;
  top: 10px; right: 15px;
  font-size: 22px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
}
.close-modal:hover { color: #FF9900; }
.modal-content h3 {
  margin-bottom: 15px;
  color: #243447;
}
.modal-content label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
}
.modal-content input[type="text"] {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  border: 1px solid #ddd;
  border-radius: 5px;
}
/* Slider */
#radius { width: 100%; margin: 10px 0; }
#radius-value {
  font-size: 14px;
  color: #FF9900;
  font-weight: bold;
  margin-top: -5px;
}
.modal-content button {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  background: #243447;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}
.modal-content button:hover { background: #1b2834; }

/* Ajustes visuales del mapa en el modal */
#map {
  width: 100%;
  min-height: 250px;
  border-radius: 6px;
  border: 1px solid #ddd;
  margin-top: 10px;
  margin-bottom: 15px;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  font-size: 14px;
  color: #666;
  padding: 15px;
  margin-top: 40px;
  background: #f5f5f5;
  border-top: 1px solid #ddd;
}

/* ===== Páginas Legales ===== */
.legal-container {
  background: #fff;
  padding: 30px;
  margin: 30px auto;
  max-width: 900px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.legal-container h1 {
  font-size: 28px;
  margin-bottom: 20px;
  color: #243447;
  border-bottom: 2px solid #FF9900;
  padding-bottom: 10px;
}
.legal-container h2 {
  font-size: 20px;
  margin-top: 25px;
  margin-bottom: 10px;
  color: #243447;
}
.legal-container p {
  font-size: 15px;
  margin-bottom: 12px;
  color: #333;
  line-height: 1.6;
}
.legal-container ul {
  margin-left: 20px;
  margin-bottom: 15px;
}
.legal-container ul li {
  margin-bottom: 8px;
  font-size: 15px;
}
.legal-container a {
  color: #FF9900;
  text-decoration: none;
  font-weight: bold;
}
.legal-container a:hover {
  text-decoration: underline;
}

/* ===== Anuncio rígido ===== */
.anuncio {
  background: #fff;
  border: 1px solid #ddd;
  margin: 0 0 15px 0;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.anuncio .banner img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

/* ===== Login & Registro ===== */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f5f5;
  padding: 20px;
}
.auth-logo {
  max-width: 160px;
  margin-bottom: 20px;
}
.auth-box {
  background: #fff;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 380px;
}
.auth-box h2 {
  margin-bottom: 20px;
  color: #243447;
  text-align: center;
}
.auth-box form label {
  font-weight: bold;
  margin-top: 10px;
  display: block;
}
.auth-box form input {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ddd;
  border-radius: 5px;
}
.auth-box form button {
  width: 100%;
  margin-top: 15px;
  padding: 12px;
  background: #243447;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}
.auth-box form button:hover { background: #1b2834; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid #ddd;
  margin: 20px 0;
}

/* Google button */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background: #fff;
  font-weight: bold;
  color: #000;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.google-btn img { width: 20px; height: 20px; }
.google-btn:hover {
  background: #f5f5f5;
  color: #FF9900;
}

/* Forgot password */
.forgot { margin-top: 15px; text-align: center; }
.forgot a {
  font-size: 14px;
  color: #243447;
  text-decoration: none;
}
.forgot a:hover { text-decoration: underline; color: #FF9900; }

/* Botón destacado para registrarse (desde login) */
.register-btn {
  display: block;
  text-align: center;
  margin-top: 15px;
  padding: 12px;
  background: #FF9900;
  color: #fff;
  font-weight: bold;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.2s;
}
.register-btn:hover { background: #cc7a00; }

/* ===== Centrado específico para Login y Registro ===== */
body:has(.auth-container) {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f5f5f5;
  flex-direction: column;
  height: auto;
  min-height: 100vh;
}
@media (min-width: 1025px) {
  .auth-container { justify-content: flex-start; height: 100vh; }
  .auth-box {
    max-height: 90vh;
    overflow-y: auto;
    margin-top: 20px;
  }
}

/* ===== Link activo en navbar ===== */
.navbar .nav-links li a.active {
  background: #FF9900;
  color: #fff !important;
  padding: 6px 12px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: bold;
}

/* ===== Mi Cuenta ===== */
.account-container { max-width: 1000px; margin: 0 auto; }
.account-header {
  display: flex; align-items: center; gap: 20px;
  padding: 20px; background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}
.account-photo {
  width: 90px; height: 90px;
  border-radius: 50%; object-fit: cover;
}
.badge {
  display: inline-block; margin-top: 8px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 13px; font-weight: bold;
}
.badge.normal { background: #ddd; color: #333; }
.badge.premium { background: gold; color: #000; }
.account-tabs {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.account-tabs .tab {
  background: #f0f0f0; border: none; padding: 10px 16px;
  border-radius: 6px; cursor: pointer; font-weight: bold;
}
.account-tabs .tab.active { background: #FF9900; color: #fff; }
.account-tabs .tab:hover { background: #e0e0e0; }
.tab-content {
  display: none; background: #fff; padding: 20px;
  border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.tab-content.active { display: block; }
.mis-publicaciones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
}
.pub-card {
  background: #fff; padding: 12px; border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: flex; gap: 12px; align-items: center;
}
.pub-card img {
  width: 80px; height: 80px;
  border-radius: 6px; object-fit: cover;
}
.pub-card h4 { margin-bottom: 5px; font-size: 16px; }
.btn-small {
  padding: 6px 10px; font-size: 13px;
  border: none; border-radius: 4px;
  margin-right: 6px; cursor: pointer;
}
.btn-small:hover { opacity: 0.9; }
.btn-small.danger { background: #e63946; color: #fff; }
.btn-small:not(.danger) { background: #243447; color: #fff; }

/* ===== Modal Detalle Publicación ===== */
.modal-content.detalle {
  max-width: 1100px; width: 95%;
  max-height: 90vh; display: flex; flex-direction: row;
  gap: 20px; overflow-y: auto;
}
#detalle-body { display: flex; flex: 1; gap: 20px; }
.detalle-galeria {
  flex: 1.2; min-width: 350px;
  display: flex; flex-direction: column;
}
.detalle-galeria img#main-photo {
  width: 100%; max-height: 70vh;
  object-fit: cover; border-radius: 10px;
}
.detalle-thumbs {
  display: flex; gap: 8px; margin-top: 10px;
  overflow-x: auto; padding-bottom: 5px;
}
.detalle-thumbs img {
  width: 80px; height: 80px;
  object-fit: cover; border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer; transition: border 0.2s;
}
.detalle-thumbs img:hover { border-color: #FF9900; }
.detalle-info {
  flex: 1; min-width: 280px; overflow-y: auto;
}
.detalle-info h2 { margin-bottom: 8px; }
.detalle-info .price {
  color: #FF9900; font-size: 22px;
  font-weight: bold; margin-bottom: 12px;
}
.detalle-info button, .detalle-info a {
  display: inline-block; margin-top: 10px;
  padding: 10px 14px; border-radius: 6px;
  border: none; cursor: pointer; font-weight: bold;
}
.detalle-info button.fav-btn { background: #eee; }
.detalle-info a {
  text-decoration: none; background: #FF9900; color: #fff;
}
@media (max-width: 768px) {
  .modal-content.detalle { flex-direction: column; }
  #detalle-body { flex-direction: column; }
}
.detalle-info h2 {
  font-size: 22px; font-weight: bold;
  margin-bottom: 10px; color: #243447;
}
.detalle-info .price {
  font-size: 24px; font-weight: bold;
  color: #FF9900; margin-bottom: 14px;
}
.detalle-info p {
  font-size: 15px; margin-bottom: 8px; color: #444;
}
.detalle-info .fav-btn {
  background: #f5f5f5; color: #e63946;
  border: 1px solid #ddd;
  padding: 10px 16px; border-radius: 8px;
  font-size: 15px; cursor: pointer;
  transition: all 0.2s ease;
}
.detalle-info .fav-btn:hover {
  background: #ffe0e0; border-color: #e63946;
}
.detalle-info .btn-primary,
.detalle-info a.btn-primary {
  background: #FF9900; color: #fff;
  padding: 12px 18px; border-radius: 8px;
  font-size: 15px; font-weight: bold;
  border: none; cursor: pointer;
  transition: background 0.2s ease;
}
.detalle-info .btn-primary:hover { background: #cc7a00; }
.detalle-actions {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 15px;
}

/* ===== Conversaciones (Mensajes) ===== */
.chat-container {
  display: flex;
  height: calc(100vh - 100px);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}
.chat-list {
  width: 280px;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  background: #fafafa;
}
.search-messages {
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.search-messages input {
  width: 100%; padding: 8px 12px;
  border-radius: 20px; border: 1px solid #ddd;
  font-size: 14px;
}
.conversation {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-bottom: 1px solid #eee;
  cursor: pointer;
}
.conversation:hover { background: #f5f5f5; }
.avatars { display: flex; align-items: center; gap: 6px; }
.user-circle {
  width: 36px; height: 36px;
  border-radius: 50%; background: #243447;
  color: #fff; font-size: 14px; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
}
.product-circle {
  width: 36px; height: 36px;
  border-radius: 50%; overflow: hidden; position: relative;
}
.product-circle img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.product-circle .badge {
  position: absolute; top: -4px; right: -4px;
  background: red; color: #fff; font-size: 12px;
  padding: 2px 6px; border-radius: 50%; font-weight: bold;
}
.conversation-info h4 { margin: 0; font-size: 15px; font-weight: bold; }
.conversation-info p {
  margin: 0; font-size: 13px; color: #666;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-box {
  flex: 1; display: flex; flex-direction: column;
}
.chat-header {
  padding: 15px; border-bottom: 1px solid #ddd; font-weight: bold;
}
.messages {
  flex: 1; padding: 15px; overflow-y: auto; background: #fff;
}
.message { margin-bottom: 12px; }
.message .bubble {
  display: inline-block; padding: 8px 14px;
  border-radius: 18px; background: #eee; max-width: 70%;
}
.message.self { text-align: right; }
.message.self .bubble {
  background: #FF9900; color: #fff;
}
.message-form {
  display: flex; border-top: 1px solid #ddd;
  background: #fff; padding: 10px;
}
.message-form input {
  flex: 1; padding: 10px;
  border-radius: 20px; border: 1px solid #ddd;
  outline: none; font-size: 14px;
}
.message-form button {
  background: #243447; color: #fff;
  border: none; padding: 10px 20px;
  margin-left: 8px; border-radius: 20px;
  cursor: pointer; font-weight: bold;
}
.message-form button:hover { background: #1b2834; }

/* ===== Responsive Chat ===== */
@media (max-width: 768px) {
  .chat-container { flex-direction: column; }
  .chat-list { width: 100%; max-height: 200px; }
  .chat-box { flex: 1; }
}
