@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=DM+Mono&display=swap');

:root {
  --bg:       #f4f3f0;
  --surface:  #ffffff;
  --surface2: #eeece7;
  --border:   #e0ddd6;
  --border2:  #ccc9c0;
  --text:     #1a1917;
  --text2:    #6b6960;
  --text3:    #a8a69f;
  --accent:   #185FA5;
  --accent-h: #0C447C;
  --ok:       #27500A;
  --ok-bg:    #EAF3DE;
  --sin-bg:   #FEF3E2;
  --sin:      #854F0B;
  --radius:   10px;
  --radius-lg:16px;
  --shadow:   0 2px 10px rgba(0,0,0,.07);
  --shadow-h: 0 8px 28px rgba(0,0,0,.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; }

/* ── HEADER ── */
header {
  background: #1a1917;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.3);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  height: 60px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; flex-shrink: 0; }
.logo svg { opacity: .75; }
.logo-name { font-size: 14px; font-weight: 700; line-height: 1.2; }
.logo-sub  { font-size: 10px; opacity: .5; text-transform: uppercase; letter-spacing: .05em; }

.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }

.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.45); pointer-events: none; }
.search-wrap input {
  height: 34px; width: 200px; padding: 0 10px 0 32px;
  border-radius: 999px; border: 1.5px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.09); color: #fff;
  font-size: 12px; font-family: 'DM Sans', sans-serif; outline: none;
  transition: border-color .2s;
}
.search-wrap input::placeholder { color: rgba(255,255,255,.38); }
.search-wrap input:focus { border-color: rgba(255,255,255,.4); }

select {
  height: 34px; padding: 0 10px;
  border-radius: var(--radius); border: 1.5px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.1); color: #fff;
  font-size: 12px; font-family: 'DM Sans', sans-serif; outline: none; cursor: pointer;
}
select option { background: #1a1917; color: #fff; }

/* ── BUTTONS ── */
.btn {
  height: 34px; padding: 0 14px; font-size: 12px;
  font-family: 'DM Sans', sans-serif; font-weight: 600;
  cursor: pointer; border-radius: var(--radius);
  border: 1.5px solid var(--border2);
  background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; transition: background .15s;
}
.btn:hover   { background: var(--surface2); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-h); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 11px; }

/* ── STATUS BAR ── */
.status-bar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 8px 1.5rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  font-size: 13px; color: var(--text2);
}
.status-item { display: flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-total { background: var(--text3); }
.dot-ok    { background: #4CAF50; }
.dot-sin   { background: #FFA726; }
.status-bar-right { margin-left: auto; }
.hint { font-size: 12px; color: var(--text3); font-style: italic; }

/* ── MAIN ── */
main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* ── GRUPO DE CATEGORÍA ── */
.cat-section { margin-bottom: 2.5rem; }
.cat-title {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 1rem; padding-bottom: .6rem;
  border-bottom: 2px solid #1a1917;
}
.cat-title h2 { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.cat-count { font-size: 11px; color: var(--text2); background: var(--border); padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.cat-missing { font-size: 11px; color: var(--sin); background: var(--sin-bg); padding: 2px 9px; border-radius: 999px; font-weight: 600; }

/* ── GRID ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

/* ── CARD ── */
.product-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-h); border-color: var(--accent); }
.product-card.has-img { border-color: #c8e6c9; }
.product-card.has-img:hover { border-color: #4CAF50; }

/* Badge estado */
.card-badge {
  position: absolute; top: 8px; right: 8px;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; z-index: 2;
}
.badge-ok  { background: var(--ok-bg); color: var(--ok); }
.badge-sin { background: var(--sin-bg); color: var(--sin); }

/* Imagen cuadrada */
.card-img-wrap {
  width: 100%; aspect-ratio: 1/1;
  overflow: hidden; background: var(--surface2);
  position: relative; display: flex; align-items: center; justify-content: center;
}
.card-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; transition: transform .3s;
}
.product-card:hover .card-img-wrap img { transform: scale(1.06); }

.card-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; width: 100%; height: 100%;
  background: linear-gradient(135deg, #f0efe9, #e5e3dc);
  color: var(--text3);
}
.card-placeholder svg { opacity: .35; }
.card-placeholder span { font-size: 11px; opacity: .6; font-weight: 500; }

/* Overlay "subir imagen" al hacer hover */
.card-overlay {
  position: absolute; inset: 0;
  background: rgba(24,95,165,.82);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; opacity: 0; transition: opacity .2s;
  color: #fff;
}
.product-card:hover .card-overlay { opacity: 1; }
.card-overlay svg { opacity: .9; }
.card-overlay span { font-size: 12px; font-weight: 600; letter-spacing: .02em; }

/* Info */
.card-info { padding: 10px 12px 12px; }
.card-code { font-size: 10px; font-weight: 700; color: var(--text3); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 3px; }
.card-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-desc { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .22s;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface); border-radius: 20px;
  width: 620px; max-width: 100%; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border);
}
.modal-cat  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text3); margin-bottom: 4px; }
.modal-name { font-size: 17px; font-weight: 700; line-height: 1.3; }
.modal-cod  { font-size: 12px; color: var(--text2); font-family: 'DM Mono', monospace; margin-top: 3px; }
.modal-close { background: var(--surface2); border: none; cursor: pointer; width: 32px; height: 32px; border-radius: 999px; font-size: 16px; display: flex; align-items: center; justify-content: center; color: var(--text2); flex-shrink: 0; transition: background .15s; }
.modal-close:hover { background: var(--border); }

.modal-body { padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }

/* Imagen actual */
.img-current-wrap { display: flex; flex-direction: column; gap: 8px; }
.img-current-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); }
.img-current {
  width: 100%; height: 200px; border-radius: var(--radius-lg);
  border: 2px solid var(--border); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
}
.img-current img { width: 100%; height: 100%; object-fit: cover; }
.img-none { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text3); }
.img-none svg { opacity: .3; }
.img-none span { font-size: 13px; font-weight: 500; }
.btn-remove {
  align-self: flex-start; display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #a32d2d; background: #fcebeb;
  border: 1px solid #f0abab; border-radius: var(--radius);
  padding: 5px 12px; cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 600;
  transition: background .15s;
}
.btn-remove:hover { background: #fad5d5; }

/* Upload options */
.upload-options { display: flex; flex-direction: column; gap: 1rem; }

/* Drop zone */
.upload-option {
  border: 2px dashed var(--border2); border-radius: var(--radius-lg);
  padding: 1.5rem; text-align: center; cursor: pointer;
  position: relative; transition: border-color .18s, background .18s;
  background: var(--bg);
}
.upload-option:hover, .upload-option.drag-over { border-color: var(--accent); background: #EEF5FC; }
.upload-option input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-icon  { font-size: 32px; margin-bottom: 6px; }
.drop-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.drop-sub   { font-size: 12px; color: var(--text2); }
.drop-types { font-size: 11px; color: var(--text3); margin-top: 6px; }

/* Divider */
.upload-divider {
  text-align: center; font-size: 12px; color: var(--text3); font-weight: 600;
  position: relative;
}
.upload-divider::before, .upload-divider::after {
  content: ''; position: absolute; top: 50%; width: 45%; height: 1px; background: var(--border);
}
.upload-divider::before { left: 0; }
.upload-divider::after  { right: 0; }

/* URL option */
.url-option { display: flex; flex-direction: column; gap: 8px; }
.url-label  { font-size: 12px; font-weight: 600; color: var(--text2); }
.url-input-wrap { display: flex; gap: 8px; }
.url-input-wrap input {
  flex: 1; height: 36px; padding: 0 10px; font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); outline: none; transition: border-color .15s;
}
.url-input-wrap input:focus { border-color: var(--accent); }
.url-preview-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; background: var(--ok-bg);
  border-radius: var(--radius); border: 1px solid #c8e6c9;
}
.url-preview-wrap img { width: 60px; height: 60px; object-fit: cover; border-radius: var(--radius); border: 1px solid #c8e6c9; flex-shrink: 0; }
.btn-sm-ok {
  font-size: 12px; font-weight: 700; color: var(--ok);
  background: var(--ok-bg); border: 1.5px solid #a5d6a7;
  border-radius: var(--radius); padding: 6px 14px; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: background .15s;
}
.btn-sm-ok:hover { background: #d4edda; }
.url-error { font-size: 12px; color: #a32d2d; padding: 6px 0; font-weight: 500; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
}

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: #1a1917; color: #fff;
  padding: 10px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 500; z-index: 999;
  opacity: 0; transform: translateY(10px);
  transition: opacity .25s, transform .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── EMPTY ── */
.empty-state { text-align: center; padding: 3rem; color: var(--text2); }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: .75rem 1rem; }
  .header-actions { width: 100%; gap: 6px; }
  .search-wrap input { width: 150px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  main { padding: 1rem; }
}
