:root {
  --bg-body: #070709;
  --bg-surface: #0f0f13;
  --bg-card: #14141a;
  --bg-card-hover: #1b1b22;
  --border: #22222d;
  --border-focus: #3e3e50;
  --text-main: #f5f5f7;
  --text-secondary: #9090a0;
  --text-muted: #585868;
  --accent-green: #10b981;
  --accent-green-hover: #059669;
  --accent-green-glow: rgba(16, 185, 129, 0.28);
  --accent-green-soft: rgba(16, 185, 129, 0.12);
  --success: #10b981;
  --tiktok-color: #00f2fe;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* NAVBAR */
.navbar {
  background-color: rgba(15, 15, 19, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
}

.nav-container {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.brand-gx {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 4px;
}

.brand-gx .gx-green {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--accent-green);
  letter-spacing: -1.5px;
  line-height: 1;
  text-shadow: 0 0 20px var(--accent-green-glow);
}

.brand-gx .store-text {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-main);
  text-transform: uppercase;
}

.badge-country {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-secondary);
  margin-left: 6px;
  font-weight: 700;
}

.nav-socials {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.social-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  flex-shrink: 0;
}

.social-circle-btn:hover {
  transform: translateY(-2px) scale(1.05);
}

.social-circle-btn.tiktok:hover {
  border-color: #fe2c55;
  color: #fe2c55;
  box-shadow: 0 4px 14px rgba(254, 44, 85, 0.25);
}

.social-circle-btn.whatsapp {
  background: rgba(37, 211, 102, 0.15);
  border-color: rgba(37, 211, 102, 0.4);
  color: #25d366;
}

.social-circle-btn.whatsapp:hover {
  background: #25d366;
  color: #000;
  border-color: #25d366;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.35);
}

/* LAYOUT */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1.2rem;
  flex: 1;
  width: 100%;
}

/* HERO */
.hero {
  margin-bottom: 2rem;
  text-align: left;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.hero h1 span {
  color: var(--accent-green);
}

.hero p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
  line-height: 1.5;
}

/* TRUST BANNER */
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.trust-item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.trust-icon {
  font-size: 1.4rem;
}

.trust-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.trust-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* FILTROS */
.filter-bar {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.input-search, .select-filter, .input-control, select, textarea, input[type="text"], input[type="number"], input[type="password"] {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.input-search {
  flex: 1;
  min-width: 240px;
}

.input-search:focus, .select-filter:focus, .input-control:focus, select:focus, textarea:focus, input:focus {
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px var(--accent-green-glow);
}

/* GRID DE PRODUCTOS */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--border-focus);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6);
}

.card-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background-color: #0b0b0e;
  overflow: hidden;
}

.card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card-img {
  transform: scale(1.06);
}

/* ESTILO PARA PRODUCTO AGOTADO */
.card-img-dimmed {
  opacity: 0.38;
  filter: grayscale(85%);
}

.soldout-center-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(229, 9, 20, 0.92);
  color: #fff;
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.8), 0 0 15px rgba(229, 9, 20, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.badge-container {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  z-index: 2;
  max-width: 85%;
}

.badge-count {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}

.badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-condition {
  background-color: rgba(15, 15, 19, 0.9);
  color: var(--text-main);
  border: 1px solid var(--border);
  backdrop-filter: blur(4px);
}

.badge-storage {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
  backdrop-filter: blur(4px);
}

.badge-battery {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.35);
  backdrop-filter: blur(4px);
}

.card-content {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-brand {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
  letter-spacing: 1px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0.3rem 0 0.5rem 0;
  color: var(--text-main);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.card-price {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--accent-green);
}

/* =========================================================
   MODAL DE DETALLE Y GALERÍA (TOTALMENTE RESPONSIVO)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: rgba(20, 20, 26, 0.85);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  transition: var(--transition);
  backdrop-filter: blur(6px);
}

.modal-close:hover {
  background: var(--accent-green);
  color: #fff;
  border-color: var(--accent-green);
}

.modal-gallery-col {
  background: #09090c;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  width: 100%;
}

.modal-main-img-wrap {
  width: 100%;
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: #000;
  position: relative;
  border: 1px solid var(--border);
  touch-action: pan-y pinch-zoom;
  user-select: none;
}

.modal-main-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(15, 15, 19, 0.75);
  border: 1px solid var(--border);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
  z-index: 10;
  backdrop-filter: blur(6px);
}

.gallery-arrow:hover {
  background: var(--accent-green);
  border-color: var(--accent-green);
  transform: translateY(-50%) scale(1.1);
}

.gallery-arrow.prev { left: 8px; }
.gallery-arrow.next { right: 8px; }

.modal-thumbs-grid {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  width: 100%;
}

.thumb-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  background: #000;
  opacity: 0.5;
  transition: var(--transition);
  flex-shrink: 0;
}

.thumb-img:hover, .thumb-img.active {
  opacity: 1;
  border-color: var(--accent-green);
}

.modal-info-col {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.modal-price {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent-green);
  margin: 0.4rem 0 1rem 0;
}

.modal-specs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.spec-item {
  background: var(--bg-card);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.spec-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 800;
}

.spec-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

/* SELLO DE VERIFICACIÓN GX */
.gx-verified-box {
  background: var(--accent-green-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.2rem;
}

.verified-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.verified-badge-icon {
  background: var(--accent-green);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
}

.verified-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
}

.verified-items-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.verified-check-item {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.verified-check-item span {
  color: var(--accent-green);
  font-weight: 800;
}

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--accent-green);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--accent-green-hover);
  box-shadow: 0 6px 20px var(--accent-green-glow);
  transform: translateY(-2px);
}

.btn-whatsapp-large {
  background-color: #25d366;
  color: #000;
  font-size: 1rem;
  padding: 0.9rem;
}

.btn-whatsapp-large:hover {
  background-color: #22bf5b;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
  transform: translateY(-2px);
}

/* ESTILO PARA BOTÓN CUANDO ESTÁ AGOTADO */
.btn-soldout-large {
  background-color: #1a1a24;
  color: #78788a;
  border: 1px solid var(--border);
  cursor: not-allowed;
  font-size: 0.95rem;
  padding: 0.9rem;
  pointer-events: none;
  opacity: 0.85;
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--bg-card);
  border-color: var(--border-focus);
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background-color: #ef4444;
  color: #fff;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

/* PANEL ADMIN */
.admin-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  width: 100%;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.admin-card h2 {
  font-size: 1.35rem;
  font-weight: 800;
}

.editing-banner {
  background: var(--accent-green-soft);
  border: 1px solid var(--accent-green);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.2rem;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.previews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
  background: var(--bg-surface);
}

.admin-table th, .admin-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.admin-table th {
  background-color: #0a0a0e;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.admin-table img, .table-thumb {
  width: 50px !important;
  height: 50px !important;
  min-width: 50px !important;
  max-width: 50px !important;
  object-fit: cover !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border) !important;
  display: block;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-online { background-color: var(--success); }
.status-offline { background-color: var(--text-muted); }

.login-wrapper {
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: none;
  z-index: 2000;
  font-size: 0.88rem;
}

/* FOOTER */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 3rem 1.2rem 1.5rem 1.2rem;
  margin-top: 3.5rem;
}

.footer-content {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
}

.footer-col p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent-green);
}

.footer-bottom {
  max-width: 1240px;
  margin: 0 auto;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.hidden-admin-trigger {
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s;
  text-decoration: none;
}

.hidden-admin-trigger:hover {
  color: var(--accent-green);
}

/* =========================================================
   REGLAS RESPONSIVAS PARA TABLETS Y CELULARES
   ========================================================= */
@media (max-width: 850px) {
  .modal-backdrop {
    padding: 0.6rem;
  }
  
  .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 94vh;
  }
  
  .modal-gallery-col {
    padding: 1.2rem 1rem;
  }

  .modal-main-img-wrap {
    height: 280px;
  }

  .modal-info-col {
    padding: 1.2rem 1rem;
  }

  .modal-specs-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }
}

@media (max-width: 580px) {
  .navbar {
    padding: 0.75rem 1rem;
  }
  
  .brand-gx .gx-green {
    font-size: 1.65rem;
  }
  
  .brand-gx .store-text {
    font-size: 0.95rem;
  }
  
  .badge-country {
    font-size: 0.65rem;
    padding: 1px 4px;
  }
  
  .social-circle-btn {
    width: 34px;
    height: 34px;
  }
  
  .social-circle-btn svg {
    width: 16px;
    height: 16px;
  }

  .modal-backdrop {
    padding: 0.35rem;
  }

  .modal-content {
    max-height: 96vh;
    border-radius: var(--radius-md);
  }

  .modal-gallery-col {
    padding: 0.85rem;
  }

  .modal-main-img-wrap {
    height: 220px;
  }

  .thumb-img {
    width: 48px;
    height: 48px;
  }

  .modal-info-col {
    padding: 1rem 0.85rem 1.4rem 0.85rem;
  }

  .modal-price {
    font-size: 1.65rem;
    margin: 0.3rem 0 0.8rem 0;
  }

  .modal-specs-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .verified-items-list {
    grid-template-columns: 1fr;
  }

  .admin-card {
    padding: 1.2rem;
  }
}