/* ══════════════════════════════════════════
   Catálogo Agencia Guapos — Estilos
   ══════════════════════════════════════════ */

:root {
  --bg: #f7f7f8;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --line: rgba(0, 0, 0, 0.1);
  --line-soft: rgba(0, 0, 0, 0.06);
  --text: #1a1a1a;
  --text-soft: #4a4a4a;
  --muted: #888;
  --accent: #b89a6a;
  --accent-strong: #a0784a;
  --danger: #d94f4f;
  --success: #5cb85c;
  --radius: 16px;
  --radius-sm: 8px;
  --container: 1220px;
  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Lato", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(var(--container), calc(100% - 2rem));
  margin-inline: auto;
}

/* ── Header ── */
.cat-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(20, 20, 22, 0.97);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
}

.cat-header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
}

.cat-logo { height: 38px; width: auto; }

.cat-title {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: clamp(0.85rem, 2.2vw, 1.15rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d4d0c9;
  white-space: nowrap;
}

.cat-header-search {
  flex: 1;
  max-width: 320px;
  margin-left: auto;
}

.cat-header-search .cat-search {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: 20px;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.cat-header-search .cat-search::placeholder {
  color: rgba(255,255,255,0.45);
}

.cat-header-search .cat-search:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.12);
}

.cat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat-cart-btn,
.cat-admin-btn {
  position: relative;
  background: none;
  border: 1px solid rgba(205, 176, 131, 0.4);
  color: #e8bd7b;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.25s, border-color 0.25s;
}

.cat-cart-btn:hover,
.cat-admin-btn:hover {
  background: #e8bd7b;
  color: #111;
  border-color: #e8bd7b;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e8bd7b;
  color: #111;
  font-size: 0.65rem;
  font-weight: 900;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cart-badge:empty,
.cart-badge[data-count="0"] { display: none; }

/* ── Filtros ── */
.cat-filters {
  padding: 20px 0 10px;
  border-bottom: 1px solid var(--line-soft);
}

.cat-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.cat-filter-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 7px 16px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.cat-filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.cat-filter-chip.is-active {
  background: var(--accent-strong);
  color: #fff;
  border-color: var(--accent-strong);
  font-weight: 700;
}

.cat-search-wrap { max-width: 360px; display: none; }

.cat-search {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}

.cat-search:focus { border-color: var(--accent); }
.cat-search::placeholder { color: var(--muted); }

/* ── Galería ── */
.cat-gallery-section {
  flex: 1;
  padding: 28px 0 64px;
}

.cat-results {
  margin: 0 0 18px;
  font-size: 0.82rem;
  color: var(--muted);
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.cat-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.cat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.cat-card-img {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-soft);
}

.cat-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

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

.cat-card-body { padding: 16px; }

.cat-card-cat {
  display: inline-block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
  margin-bottom: 6px;
}

.cat-card-name {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.cat-card-desc {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cat-color-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.cat-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
}

.cat-empty {
  text-align: center;
  padding: 64px 0;
  font-size: 1rem;
  color: var(--muted);
}

/* ── Color swatches (detalle) ── */
.cat-color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}

.cat-color-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
  background: none;
  outline: none;
}

.cat-color-swatch:hover {
  transform: scale(1.15);
}

.cat-color-swatch.is-selected {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(184, 154, 106, 0.35);
  transform: scale(1.1);
}

/* ── Color dot in cart ── */
.cat-color-dot-sm {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--line);
  vertical-align: middle;
  margin-left: 6px;
}

/* ── Admin color picker ── */
.cat-color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cat-color-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 24px;
}

.cat-color-dot-admin {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.cat-color-dot-admin:hover {
  transform: scale(1.15);
}

.cat-color-dot-x {
  display: none;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 3px rgba(0,0,0,0.6);
  line-height: 1;
}

.cat-color-dot-admin:hover .cat-color-dot-x {
  display: block;
}

.cat-color-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-color-input {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: pointer;
}

/* ── Modal detalle ── */
.cat-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(3px);
}

.cat-modal-overlay[hidden] { display: none; }

.cat-modal {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 32px;
}

.cat-modal--admin {
  max-width: 640px;
}

.cat-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.cat-modal-close:hover { color: var(--text); }

.cat-modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.cat-modal-img-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--panel);
  position: relative;
}

.cat-modal-img-wrap img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.cat-gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s;
  z-index: 2;
}

.cat-gallery-arrow:hover { background: rgba(0,0,0,0.7); }
.cat-gallery-arrow--prev { left: 8px; }
.cat-gallery-arrow--next { right: 8px; }
.cat-gallery-arrow[hidden] { display: none; }

.cat-gallery-counter {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 10px;
  border-radius: 10px;
}

.cat-gallery-counter:empty { display: none; }

.cat-modal-desc-full {
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.cat-modal-stock {
  font-size: 0.82rem;
  color: var(--accent-strong);
  font-weight: 700;
}

.cat-card-stock {
  display: block;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--muted);
}

.cat-modal-cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-strong);
}

.cat-modal-info h2 {
  margin: 6px 0 12px;
  font-family: "Montserrat", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
}

.cat-modal-info p { color: var(--text-soft); font-size: 0.9rem; }

.cat-modal-dims {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.cat-modal-cart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.cat-modal-cart-row label {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.cat-qty-input {
  width: 64px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  text-align: center;
  outline: none;
}

.cat-qty-input:focus { border-color: var(--accent); }

/* ── Botones ── */
.cat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.cat-btn--accent {
  background: var(--accent-strong);
  color: #fff;
}

.cat-btn--accent:hover {
  background: var(--accent);
}

.cat-btn--outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
}

.cat-btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.cat-btn--danger {
  background: var(--danger);
  color: #fff;
}

.cat-btn--danger:hover { opacity: 0.85; }

.cat-btn--sm {
  padding: 6px 12px;
  font-size: 0.72rem;
}

.cat-btn--full { width: 100%; }

/* ── Panel carrito ── */
.cat-cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  justify-content: flex-end;
  backdrop-filter: blur(2px);
}

.cat-cart-overlay[hidden] { display: none; }

.cat-cart {
  background: var(--bg-soft);
  border-left: 1px solid var(--line);
  width: min(420px, 90vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.cat-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.cat-cart-header h2 {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.cat-cart-header .cat-modal-close {
  position: static;
}

.cat-cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.cat-cart-empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

.cat-cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.cat-cart-item-img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--panel);
}

.cat-cart-item-info { flex: 1; min-width: 0; }

.cat-cart-item-name {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-cart-item-cat {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
}

.cat-cart-item-qty {
  width: 50px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 4px;
  font-size: 0.82rem;
  border-radius: 4px;
  outline: none;
}

.cat-cart-item-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.cat-cart-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-cart-total {
  margin: 0;
  font-size: 0.9rem;
  text-align: center;
}

/* ── Admin ── */
.cat-form-group {
  margin-bottom: 16px;
}

.cat-form-group label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.cat-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.cat-input:focus { border-color: var(--accent); }

.cat-input-file {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.cat-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
}

.cat-success {
  color: var(--success);
  font-size: 0.85rem;
  margin-top: 10px;
}

.cat-admin-tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0;
  flex-wrap: wrap;
}

.cat-admin-tab {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 8px 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.cat-admin-tab.is-active {
  background: var(--accent-strong);
  color: #fff;
  border-color: var(--accent-strong);
  font-weight: 700;
}

.cat-admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.cat-admin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel);
  border-radius: var(--radius-sm);
}

.cat-admin-item-img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.cat-admin-item-info {
  flex: 1;
  min-width: 0;
}

.cat-admin-item-name {
  font-weight: 700;
  font-size: 0.85rem;
}

.cat-admin-item-cat {
  font-size: 0.7rem;
  color: var(--muted);
}

.cat-inline-form {
  display: flex;
  gap: 8px;
}

.cat-inline-form .cat-input { flex: 1; }

.cat-divider {
  border: none;
  border-top: 1px solid var(--line-soft);
  margin: 24px 0;
}

/* ── Footer ── */
.cat-footer {
  text-align: center;
  padding: 24px 0;
  background: rgba(20, 20, 22, 0.97);
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.8rem;
  color: #999;
}

.cat-footer p { margin: 0; }

/* ── Responsive ── */
@media (max-width: 700px) {
  .cat-modal-body {
    grid-template-columns: 1fr;
  }

  .cat-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }

  .cat-header-inner { gap: 10px; }

  .cat-title { font-size: 0.75rem; }

  .cat-filter-bar { gap: 6px; }

  .cat-filter-chip {
    padding: 6px 12px;
    font-size: 0.7rem;
  }

  .cat-modal { padding: 24px 18px; }
}
