/* ============================================================
   Dampi — ocasion.css
   Portátiles Reacondicionados
============================================================ */

:root {
  --emerald-bg: #d1fae5;
  --cyan-bg:    #E0F7FC;
  --amber-bg:   #fef3c7;
  --coral:      #F43F5E;
  --border2:    #cbd5e1;
  --text2:      #475569;
  --text3:      #94a3b8;
}

.ocasion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 14px;
}
.ocasion-grid.list-view {
  grid-template-columns: 1fr;
  gap: 8px;
}

/* ─── tarjeta cuadrícula ─────────────────────────────────── */
a.oc-card { text-decoration: none; color: inherit; }
a.oc-card:visited { color: inherit; }
.oc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .2s, box-shadow .2s;
}
.oc-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
}

.oc-card__img {
  position: relative;
  height: 164px;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.oc-card__img img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 12px;
  transition: transform .3s;
}
.oc-card:hover .oc-card__img img { transform: scale(1.04); }
.oc-card__img-ph { width: 52px; height: 52px; color: var(--border2); }
.oc-card__img-ph svg { width: 52px; height: 52px; }

.oc-grade {
  position: absolute;
  top: 9px; left: 9px;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px;
  letter-spacing: .04em; text-transform: uppercase;
}
.oc-grade--a { background: var(--emerald-bg); color: #065f46; }
.oc-grade--b { background: var(--cyan-bg);    color: #0e7490; }
.oc-grade--c { background: var(--amber-bg);   color: #92400e; }

.oc-stock-dot {
  position: absolute; top: 9px; right: 9px;
  width: 8px; height: 8px; border-radius: 50%;
}
.oc-stock-dot--ok  { background: #10b981; }
.oc-stock-dot--low { background: #f59e0b; }
.oc-stock-dot--out { background: #f43f5e; opacity:.5; }

.oc-card__body {
  padding: 14px 15px 15px;
  display: flex; flex-direction: column; flex: 1;
}
.oc-card__brand {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--text3); margin-bottom: 3px;
}
.oc-card__name {
  font-family: var(--font-display);
  font-size: 13.5px; font-weight: 600;
  color: var(--text); line-height: 1.35;
  margin-bottom: 12px; flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.oc-specs {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  background: var(--bg2); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 13px;
}
.oc-spec { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.oc-spec__k {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text3);
}
.oc-spec__v {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.oc-spec__v.na { color: var(--text3); font-weight: 400; font-style: italic; }

.oc-footer {
  display: flex; align-items: flex-end;
  justify-content: space-between; gap: 8px;
}
.oc-price {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 800;
  color: var(--text); letter-spacing: -.02em; line-height: 1;
}
.oc-stock-txt { font-size: 11px; color: var(--text3); margin-top: 3px; }
.oc-stock-txt.low { color: #b45309; }
.oc-stock-txt.out { color: #be123c; }

.oc-btn {
  background: var(--text); color: var(--surface);
  border: none; padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: opacity .15s; line-height: 1;
}
.oc-btn:hover:not(:disabled) { opacity: .82; }
.oc-btn:disabled { background: var(--bg3); color: var(--text3); cursor: not-allowed; }

/* ─── tarjeta lista ──────────────────────────────────────── */
.ocasion-grid.list-view .oc-card { flex-direction: row; height: 116px; }
.ocasion-grid.list-view .oc-card__img {
  width: 148px; height: 100%; flex-shrink: 0;
  border-right: 1px solid var(--border);
}
.ocasion-grid.list-view .oc-card__body {
  flex-direction: row; align-items: center;
  gap: 14px; padding: 12px 16px;
}
.ocasion-grid.list-view .oc-card__name {
  -webkit-line-clamp: 1; font-size: 13px;
  width: 220px; flex: none; margin-bottom: 0;
}
.ocasion-grid.list-view .oc-specs {
  flex: 1; grid-template-columns: repeat(4,1fr);
  margin-bottom: 0; min-width: 0;
}
.ocasion-grid.list-view .oc-footer {
  flex-direction: column; align-items: flex-end;
  gap: 5px; flex-shrink: 0;
}

/* ─── hero ───────────────────────────────────────────────── */
.ocasion-hero-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.ocasion-hero-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  background: var(--amber-bg); color: #92400e;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ocasion-hero-icon svg { width: 26px; height: 26px; }
.ocasion-hero-text { flex: 1; min-width: 180px; }
.ocasion-hero-text h1 {
  font-family: var(--font-display); font-size: 1.25rem;
  font-weight: 800; color: var(--text);
  letter-spacing: -.02em; margin-bottom: 3px;
}
.ocasion-hero-text p { font-size: 13px; color: var(--text2); line-height: 1.5; }
.ocasion-hero-stats {
  display: flex; gap: 18px; margin-top: 6px;
  font-size: 12.5px; color: var(--text2);
}
.ocasion-hero-stats strong { color: var(--text); font-weight: 700; }

.ocasion-hero-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.ocasion-hbadge {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 20px; white-space: nowrap;
}
.ocasion-hbadge svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ─── toolbar ────────────────────────────────────────────── */
.oc-toolbar {
  display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.oc-results { font-size: 13px; color: var(--text2); }
.oc-results strong { color: var(--text); font-weight: 700; }
.oc-toolbar-right { display: flex; align-items: center; gap: 7px; }

.oc-sort {
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 7px 10px;
  font-family: var(--font-body); font-size: 13px; color: var(--text);
  cursor: pointer; outline: none;
}
.oc-view-btns { display: flex; gap: 3px; }
.oc-view-btn {
  width: 32px; height: 32px; display: flex;
  align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text3); transition: all .15s;
}
.oc-view-btn.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.oc-view-btn:not(.active):hover { color: var(--text2); border-color: #94a3b8; }

/* ─── chips ──────────────────────────────────────────────── */
.oc-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.oc-chip {
  font-size: 12.5px; font-weight: 600;
  padding: 5px 13px; border-radius: 20px;
  border: 1.5px solid var(--border2);
  background: var(--surface); color: var(--text2);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.oc-chip:hover { border-color: #64748b; color: var(--text); }
.oc-chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }

/* ─── filtros activos ────────────────────────────────────── */
.oc-active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.oc-filter-tag {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--text2);
  background: var(--bg2); border: 1px solid var(--border2);
  padding: 3px 4px 3px 10px; border-radius: 20px;
}
.oc-filter-tag button {
  width: 18px; height: 18px; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg3); border: none; border-radius: 50%;
  cursor: pointer; font-size: 11px; color: var(--text2); line-height: 1;
}

/* ─── paginación ─────────────────────────────────────────── */
.oc-pagination {
  display: flex; justify-content: center;
  gap: 4px; padding: 28px 0 8px; flex-wrap: wrap;
}
.oc-page-btn {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  color: var(--text2); cursor: pointer; transition: all .15s;
}
.oc-page-btn:hover:not(:disabled):not(.active) { border-color: #64748b; color: var(--text); }
.oc-page-btn.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.oc-page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ─── loading / vacío ────────────────────────────────────── */
.oc-loading {
  grid-column: 1/-1; padding: 64px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; color: var(--text3); font-size: 14px;
}
.oc-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border2); border-top-color: var(--text2);
  border-radius: 50%; animation: oc-spin .7s linear infinite;
}
@keyframes oc-spin { to { transform: rotate(360deg); } }

.oc-empty {
  grid-column: 1/-1; padding: 56px 24px; text-align: center;
  background: var(--surface); border: 1px dashed var(--border2);
  border-radius: var(--radius-lg);
}
.oc-empty h3 {
  font-family: var(--font-display); font-size: 1rem;
  font-weight: 700; color: var(--text2); margin-bottom: 6px;
}
.oc-empty p { font-size: 13px; color: var(--text3); }

/* ─── responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .ocasion-hero-badges { display: none; }
  .ocasion-grid.list-view .oc-card__name { width: 140px; }
  .ocasion-grid.list-view .oc-specs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .ocasion-grid { grid-template-columns: 1fr; }
  .ocasion-grid.list-view .oc-card { flex-direction: column; height: auto; }
  .ocasion-grid.list-view .oc-card__img { width: 100%; height: 156px; border-right: none; border-bottom: 1px solid var(--border); }
  .ocasion-grid.list-view .oc-card__body { flex-direction: column; gap: 10px; }
  .ocasion-grid.list-view .oc-card__name { width: 100%; }
  .ocasion-grid.list-view .oc-specs { grid-template-columns: 1fr 1fr; }
}
