/* ============================================================
   VELOMOTOR - Estilos del shop y admin
   ============================================================ */

:root {
  --vm-primary:    #e63946;
  --vm-primary-dk: #c1121f;
  --vm-dark:       #1a1a2e;
  --vm-mid:        #16213e;
  --vm-light:      #f8f9fa;
  --vm-gray:       #6c757d;
  --vm-border:     #dee2e6;
  --vm-success:    #28a745;
  --vm-warning:    #ffc107;
  --vm-danger:     #dc3545;
  --vm-radius:     8px;
  --vm-shadow:     0 2px 8px rgba(0,0,0,.10);
  --vm-font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Reset acotado */
.vm-tienda-wrap *, .vm-tienda-wrap *::before, .vm-tienda-wrap *::after { box-sizing: border-box; }

body {
  background: #f5f5f5 !important;
  overflow-x: hidden;
}

.vm-tienda-main a { color: var(--vm-primary); text-decoration: none; }
.vm-tienda-main a:hover { text-decoration: underline; }

/* ── Badge del carrito en navbar real ───────────────────── */
.vm-tienda-badge {
  position: absolute !important;
  top: 8px !important;
  right: 2px !important;
  background: #e8830c !important;
  color: #fff !important;
  border-radius: 50% !important;
  width: 18px !important;
  height: 18px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}
.vm-tienda-badge--hidden { display: none !important; }

/* ── Header autónomo ────────────────────────────────────── */
.vm-site-header {
  background: #111 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 9999 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.5) !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}
.vm-site-nav {
  max-width: 1200px;
  margin: 0 auto !important;
  padding: 0 1.5rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 64px !important;
  list-style: none !important;
}
.vm-site-logo {
  display: flex !important;
  align-items: center !important;
  text-decoration: none !important;
  flex-shrink: 0;
}
.vm-site-logo img {
  height: 38px !important;
  width: auto !important;
  display: block !important;
  max-width: 160px !important;
  object-fit: contain !important;
}
.vm-site-nav__links {
  display: flex !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  align-items: center !important;
}
.vm-site-nav__links li {
  display: list-item !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.vm-site-nav__links li a {
  color: #fff !important;
  text-decoration: none !important;
  padding: .5rem .9rem !important;
  font-size: .9rem;
  letter-spacing: .5px;
  transition: color .2s;
  display: block;
}
.vm-site-nav__links li a:hover { color: #f4a800 !important; text-decoration: none !important; }
.vm-nav-cart {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  color: #fff !important;
  padding: .5rem .75rem !important;
  text-decoration: none !important;
}
.vm-nav-cart svg { display: block !important; }
.vm-nav-cart__badge {
  position: absolute !important;
  top: 0px !important;
  right: 0px !important;
  background: #f4a800 !important;
  color: #111 !important;
  border-radius: 50% !important;
  width: 18px !important;
  height: 18px !important;
  font-size: .7rem !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}
.vm-nav-cart__badge--hidden { display: none !important; }
.vm-hamburger {
  display: none !important;
  flex-direction: column;
  gap: 5px;
  background: none !important;
  border: none !important;
  cursor: pointer;
  padding: .25rem;
}
.vm-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}
@media (max-width: 768px) {
  .vm-hamburger { display: flex !important; }
  .vm-site-nav__links {
    display: none !important;
    position: absolute !important;
    top: 64px !important;
    left: 0 !important;
    right: 0 !important;
    background: #111 !important;
    flex-direction: column !important;
    padding: 1rem 0 !important;
    z-index: 9999 !important;
    width: 100% !important;
  }
  .vm-site-nav__links.vm-open { display: flex !important; }
  .vm-site-nav__links li { width: 100% !important; text-align: center !important; }
}

/* ── Footer del sitio ────────────────────────────────────── */
.vm-site-footer {
  background: #111;
  color: #ccc;
  margin-top: 4rem;
  padding: 2.5rem 1.5rem;
  font-size: .85rem;
}
.vm-site-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  justify-content: space-between;
}
.vm-site-footer__logo { height: 32px; filter: brightness(0) invert(1); margin-bottom: .5rem; }
.vm-site-footer__brand p { color: #999; }
.vm-site-footer__newsletter p { margin-bottom: .3rem; }
.vm-site-footer__newsletter a { color: #f4a800; }
.vm-site-footer__social {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.vm-site-footer__social a { color: #ccc; transition: color .2s; }
.vm-site-footer__social a:hover { color: #f4a800; }
.vm-site-footer__phone { font-size: .9rem; white-space: nowrap; }

/* ── WhatsApp flotante ──────────────────────────────────── */
.vm-whatsapp-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  width: 52px;
  height: 52px;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  transition: transform .2s;
}
.vm-whatsapp-btn:hover { transform: scale(1.1); }
.vm-whatsapp-btn img { width: 30px; height: 30px; }

/* ── Área de contenido de la tienda ────────────────────── */
.vm-tienda-wrap {
  width: 100%;
  padding-top: 80px; /* compensa navbar-fixed-top */
  min-height: 60vh;
  background: #f5f5f5;
}

.vm-tienda-main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
  box-sizing: border-box;
}

/* ── Header ─────────────────────────────────────────────── */
.vm-header {
  background: var(--vm-dark);
  color: #fff;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.vm-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.vm-logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 1px;
}
.vm-cart-icon {
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
}
.vm-cart-badge {
  background: var(--vm-primary);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
}

/* ── Main ───────────────────────────────────────────────── */
.vm-main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.vm-page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--vm-dark);
}

/* ── Botones ────────────────────────────────────────────── */
.vm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .5rem 1.2rem;
  border-radius: var(--vm-radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  text-decoration: none;
  gap: .4rem;
}
.vm-btn--primary  { background: var(--vm-primary); color: #fff !important; }
.vm-btn--primary:hover   { background: var(--vm-primary-dk); color: #fff !important; text-decoration: none; }
.vm-btn--primary:visited { background: var(--vm-primary); color: #fff !important; }
.vm-btn--primary:active  { background: var(--vm-primary-dk); color: #fff !important; }
.vm-btn--outline  { background: transparent; color: var(--vm-primary); border-color: var(--vm-primary); }
.vm-btn--outline:hover { background: var(--vm-primary); color: #fff; }
.vm-btn--danger   { background: var(--vm-danger); color: #fff; border-color: var(--vm-danger); }
.vm-btn--danger:hover { background: #b02a37; }
.vm-btn--disabled { background: #ccc; color: #888; cursor: not-allowed; border-color: #ccc; }
.vm-btn--sm  { padding: .3rem .8rem; font-size: .8rem; }
.vm-btn--lg  { padding: 1rem 2.5rem; font-size: 1.3rem; }
.vm-btn--full { width: 100%; font-size: 1.5rem !important; padding: 1.2rem !important; }

/* ── Grid de productos ──────────────────────────────────── */
.vm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.vm-card {
  background: #fff;
  border-radius: var(--vm-radius);
  box-shadow: var(--vm-shadow);
  overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.vm-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.13); }
.vm-card__img-link { display: block; height: 200px; overflow: hidden; }
.vm-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.vm-card:hover .vm-card__img { transform: scale(1.04); }
.vm-card__body { padding: 1rem; display: flex; flex-direction: column; flex: 1; gap: .5rem; }
.vm-card__title { font-size: 1.15rem; font-weight: 600; }
.vm-card__title a { color: var(--vm-dark); }
.vm-card__title a:visited { color: var(--vm-dark); }
.vm-card__price { font-size: 1.35rem; font-weight: 700; color: var(--vm-primary); }
.vm-add-form { margin-top: auto; }
.vm-add-form .vm-btn { font-size: 1.15rem; padding: .7rem 1.5rem; width: 100%; }

/* ── Detalle de producto ────────────────────────────────── */
.vm-back-link { display: inline-block; margin-bottom: 1rem; color: var(--vm-gray); text-decoration: none; }
.vm-back-link:hover { text-decoration: underline; }
.vm-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 700px) { .vm-detail { grid-template-columns: 1fr; } }

/* ── Galería / Carousel ─────────────────────────────────── */
.vm-detail__gallery { position: relative; }
.vm-carousel { position: relative; border-radius: var(--vm-radius); overflow: hidden; background: #f0f0f0; aspect-ratio: 4/3; }
.vm-carousel__slide { display: none; width: 100%; height: 100%; }
.vm-carousel__slide.active { display: block; }
.vm-carousel__img { width: 100%; height: 100%; object-fit: contain; }
.vm-carousel__btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.45); color: #fff; border: none;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.4rem; cursor: pointer; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.vm-carousel__btn:hover { background: rgba(0,0,0,.7); }
.vm-carousel__btn--prev { left: 8px; }
.vm-carousel__btn--next { right: 8px; }
.vm-carousel__thumbs {
  display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap;
  max-height: 100px; overflow-y: auto;
}
.vm-carousel__thumb {
  width: 60px; height: 60px; object-fit: cover;
  border-radius: 4px; cursor: pointer;
  border: 2px solid transparent; transition: border-color .2s;
}
.vm-carousel__thumb.active,
.vm-carousel__thumb:hover { border-color: var(--vm-primary); }

.vm-detail__title { font-size: 1.8rem; font-weight: 700; margin-bottom: .75rem; }
.vm-detail__price { font-size: 2rem; font-weight: 700; color: var(--vm-primary); margin-bottom: 1rem; }
.vm-detail__desc { color: #555; margin-bottom: 1.5rem; line-height: 1.7; }
.vm-detail__stock { color: var(--vm-success); font-size: 1.15rem; margin-bottom: 1rem; font-weight: 600; }
.vm-label { display: block; font-weight: 600; margin-bottom: .5rem; font-size: 1.25rem; }
.vm-input-qty {
  width: 110px; padding: .7rem .9rem;
  border: 1px solid var(--vm-border); border-radius: var(--vm-radius);
  font-size: 1.25rem; margin-bottom: 1.4rem;
}
.vm-out-of-stock { color: var(--vm-danger); font-weight: 600; font-size: 1.1rem; }

/* ── Carrito ────────────────────────────────────────────── */
.vm-cart-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 800px) { .vm-cart-layout { grid-template-columns: 1fr; } }
.vm-cart-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--vm-radius); box-shadow: var(--vm-shadow); }
.vm-cart-table th, .vm-cart-table td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--vm-border); }
.vm-cart-table th { background: #f0f0f0; font-weight: 600; }
.vm-cart-product { display: flex; align-items: center; gap: .75rem; }
.vm-cart-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--vm-radius); }
.vm-cart-actions { margin-top: 1rem; display: flex; gap: 1rem; }
.vm-cart-actions .vm-btn { font-size: 1.2rem; padding: .75rem 1.8rem; }
.vm-cart-summary {
  background: #fff;
  border-radius: var(--vm-radius);
  box-shadow: var(--vm-shadow);
  padding: 1.5rem;
  position: sticky;
  top: 80px;
}
.vm-cart-summary h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.2rem; }
.vm-summary-line { display: flex; justify-content: space-between; margin-bottom: .7rem; font-size: 1.1rem; }
.vm-summary-line--total { font-size: 1.4rem; border-top: 2px solid var(--vm-border); padding-top: .9rem; margin-top: .9rem; }
.vm-secure-note { font-size: 1rem; color: var(--vm-gray); text-align: center; margin-top: .9rem; }
.vm-empty-cart { text-align: center; padding: 3rem; }
.vm-empty { text-align: center; color: var(--vm-gray); padding: 2rem; }

/* ── Páginas de resultado (éxito, pendiente, error) ─────── */
.vm-result-page { display: flex; align-items: flex-start; justify-content: center; padding: 4rem 1rem; }
.vm-result {
  background: #fff;
  border-radius: var(--vm-radius);
  box-shadow: var(--vm-shadow);
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 480px;
  width: 100%;
}
.vm-result__icon { font-size: 4rem; margin-bottom: 1rem; }
.vm-result__title { font-size: 1.8rem; font-weight: 700; margin-bottom: 1rem; }
.vm-result__text { color: #555; margin-bottom: 1.5rem; font-size: 1.1rem; }
.vm-result__ref { font-size: 1.1rem; color: var(--vm-gray); margin-bottom: 1.5rem; }
.vm-result__actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.vm-result__actions .vm-btn { font-size: 1.2rem; padding: .75rem 1.8rem; }
.vm-result--success .vm-result__title { color: var(--vm-success); }
.vm-result--pending .vm-result__title { color: #e67e22; }
.vm-result--error   .vm-result__title { color: var(--vm-danger); }

/* ── Footer ─────────────────────────────────────────────── */
.vm-footer { background: var(--vm-dark); color: #aaa; text-align: center; padding: 1.5rem; margin-top: 4rem; font-size: .85rem; }

/* ── Alertas ────────────────────────────────────────────── */
.vm-alert { padding: .75rem 1rem; border-radius: var(--vm-radius); margin-bottom: 1rem; font-weight: 500; }
.vm-alert--error   { background: #fde8e8; color: #b02020; border: 1px solid #f5c6c6; }
.vm-alert--success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* ── Admin layout ───────────────────────────────────────── */
.vm-admin {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
@media (max-width: 700px) {
  .vm-admin { grid-template-columns: 1fr; }
  .vm-sidebar { display: none; }
}
.vm-sidebar {
  background: var(--vm-mid);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.vm-sidebar__logo {
  padding: 1.2rem 1rem;
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  color: #fff;
}
.vm-sidebar__nav { display: flex; flex-direction: column; padding: .5rem 0; }
.vm-sidebar__link {
  padding: .7rem 1rem;
  color: #ccc;
  font-size: .9rem;
  text-decoration: none;
  transition: background .2s;
}
.vm-sidebar__link:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.vm-sidebar__link--active { background: var(--vm-primary); color: #fff; }
.vm-sidebar__link--logout { margin-top: auto; color: #f88; }

.vm-admin-content { padding: 1.5rem 2rem; overflow-x: auto; }
.vm-admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.vm-admin-title { font-size: 1.6rem; font-weight: 700; }
.vm-admin-subtitle { font-size: 1.2rem; font-weight: 600; margin: 1.5rem 0 .75rem; }

.vm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.vm-stat-card {
  background: #fff;
  border-radius: var(--vm-radius);
  box-shadow: var(--vm-shadow);
  padding: 1.2rem 1rem;
  text-align: center;
}
.vm-stat-card--highlight { background: var(--vm-primary); color: #fff; }
.vm-stat-card__value { font-size: 2rem; font-weight: 700; }
.vm-stat-card__label { font-size: .85rem; opacity: .75; margin-top: .25rem; }

.vm-admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--vm-radius); box-shadow: var(--vm-shadow); }
.vm-admin-table th, .vm-admin-table td { padding: .65rem 1rem; text-align: left; border-bottom: 1px solid var(--vm-border); }
.vm-admin-table th { background: #f0f0f0; font-weight: 600; font-size: .85rem; }
.vm-admin-table tfoot td { font-size: 1rem; }
.vm-admin-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.vm-row--inactive { opacity: .55; }

/* Badges de estado */
.vm-badge { padding: .25rem .6rem; border-radius: 20px; font-size: .78rem; font-weight: 600; display: inline-block; }
.vm-badge--aprobado  { background: #d4edda; color: #155724; }
.vm-badge--pendiente { background: #fff3cd; color: #856404; }
.vm-badge--rechazado, .vm-badge--cancelado { background: #fde8e8; color: #b02020; }
.vm-badge--aprobado.vm-badge--activo, .vm-badge--aprobado { background: #d4edda; }
.vm-badge--cancelado { background: #fde8e8; }

/* Admin forms */
.vm-form { background: #fff; border-radius: var(--vm-radius); box-shadow: var(--vm-shadow); padding: 2rem; max-width: 700px; }
.vm-form-group { margin-bottom: 1.25rem; }
.vm-form-group label { display: block; font-weight: 600; margin-bottom: .35rem; }
.vm-form-group input[type="text"],
.vm-form-group input[type="number"],
.vm-form-group input[type="email"],
.vm-form-group textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--vm-border);
  border-radius: var(--vm-radius);
  font-size: .95rem;
  font-family: inherit;
}
.vm-form-group input:focus, .vm-form-group textarea:focus {
  outline: none; border-color: var(--vm-primary); box-shadow: 0 0 0 3px rgba(230,57,70,.15);
}
.vm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.vm-form-check { display: flex; align-items: center; gap: .5rem; }
.vm-form-check label { margin-bottom: 0; font-weight: 400; cursor: pointer; }
.vm-form-hint { font-size: .8rem; color: var(--vm-gray); margin-top: .25rem; }
.vm-form-img-preview { max-width: 120px; border-radius: var(--vm-radius); margin-bottom: .5rem; display: block; }
.vm-form-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
.vm-required { color: var(--vm-danger); }
.vm-actions { white-space: nowrap; }

/* Admin login page */
.vm-admin-login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--vm-mid);
}
.vm-login-box { background: #fff; border-radius: var(--vm-radius); padding: 2.5rem; width: 100%; max-width: 380px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.vm-login-title { text-align: center; font-size: 1.4rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--vm-dark); }
.vm-login-title small { display: block; font-size: .85rem; color: var(--vm-gray); font-weight: 400; }
.vm-login-form label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.vm-login-form input {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--vm-border);
  border-radius: var(--vm-radius); margin-bottom: 1rem; font-size: 1rem;
}
.vm-login-form input:focus { outline: none; border-color: var(--vm-primary); }

/* Filtros y paginación */
.vm-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.vm-pagination { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; justify-content: flex-end; }

/* Info table (orden detalle) */
.vm-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }
@media (max-width: 700px) { .vm-detail-grid { grid-template-columns: 1fr; } }
.vm-detail-section h2 { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }
.vm-info-table { width: 100%; border-collapse: collapse; }
.vm-info-table th, .vm-info-table td { padding: .5rem .75rem; border-bottom: 1px solid var(--vm-border); font-size: .9rem; }
.vm-info-table th { width: 40%; font-weight: 600; color: var(--vm-gray); text-align: left; }
