/* WP Views – Frontend Styles v1.0 */

/* ── Variables ───────────────────────────────────────────────── */
.wpv-view {
    --wpv-cols: 3;
    --wpv-gap: 24px;
    --wpv-card-radius: 8px;
    --wpv-card-shadow: 0 1px 4px rgba(0,0,0,.09);
    --wpv-card-bg: #fff;
    --wpv-accent: #2271b1;
    --wpv-accent-text: #fff;
    --wpv-badge-bg: #f0f0f0;
    --wpv-badge-color: #555;
    box-sizing: border-box;
}

/* ── View title ──────────────────────────────────────────────── */
.wpv-view-title { margin: 0 0 var(--wpv-gap); }

/* ══════════════════════════════════════
   LAYOUTS
══════════════════════════════════════ */

/* ── Grid ────────────────────────────────────────────────────── */
.wpv-grid {
    display: grid;
    grid-template-columns: repeat(var(--wpv-cols), 1fr);
    gap: var(--wpv-gap);
}
@media (max-width: 1100px) { .wpv-grid { grid-template-columns: repeat(min(var(--wpv-cols),3), 1fr); } }
@media (max-width: 768px)  { .wpv-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .wpv-grid { grid-template-columns: 1fr; } }

/* ── List ────────────────────────────────────────────────────── */
.wpv-list { display: flex; flex-direction: column; gap: var(--wpv-gap); }
.wpv-layout-list .wpv-card { flex-direction: row; align-items: flex-start; }
.wpv-layout-list .wpv-card-img-wrap { flex: 0 0 160px; margin-right: 20px; }
.wpv-layout-list .wpv-card-img-wrap img { width: 160px; height: 130px; object-fit: cover; border-radius: var(--wpv-card-radius) 0 0 var(--wpv-card-radius); }
@media (max-width: 600px) {
    .wpv-layout-list .wpv-card { flex-direction: column; }
    .wpv-layout-list .wpv-card-img-wrap { flex: none; margin-right: 0; width: 100%; }
    .wpv-layout-list .wpv-card-img-wrap img { width: 100%; border-radius: var(--wpv-card-radius) var(--wpv-card-radius) 0 0; }
}

/* ── Masonry ─────────────────────────────────────────────────── */
.wpv-masonry-item { break-inside: avoid; margin-bottom: var(--wpv-gap); }

/* ── Slider ──────────────────────────────────────────────────── */
.wpv-slider-wrap { position: relative; overflow: hidden; }
.wpv-slider-track {
    display: flex;
    gap: var(--wpv-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.wpv-slider-track::-webkit-scrollbar { display: none; }
.wpv-slider-item {
    flex: 0 0 calc((100% - var(--wpv-gap) * (var(--wpv-cols) - 1)) / var(--wpv-cols));
    scroll-snap-align: start;
}
.wpv-slider-prev, .wpv-slider-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 10; background: rgba(255,255,255,.95);
    border: 1px solid #ddd; border-radius: 50%;
    width: 38px; height: 38px; cursor: pointer;
    font-size: 18px; line-height: 36px; text-align: center; padding: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: background .15s;
}
.wpv-slider-prev:hover, .wpv-slider-next:hover { background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.2); }
.wpv-slider-prev { left: 4px; }
.wpv-slider-next { right: 4px; }

/* ── Table ───────────────────────────────────────────────────── */
.wpv-table-wrap { overflow-x: auto; }
.wpv-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.wpv-table th {
    background: #f6f7f7; text-align: left;
    padding: 10px 12px; border-bottom: 2px solid #ddd;
    font-weight: 600; white-space: nowrap;
}
.wpv-table td { padding: 10px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }
.wpv-table tr:hover td { background: #fafafa; }
.wpv-col-image img { display: block; width: 50px; height: 50px; object-fit: cover; border-radius: 4px; }
.wpv-col-image { width: 70px; }
.wpv-col-cta { width: 100px; text-align: right; }

/* ── Cards (featured first) ──────────────────────────────────── */
.wpv-cards {
    display: grid;
    grid-template-columns: repeat(var(--wpv-cols), 1fr);
    gap: var(--wpv-gap);
}
.wpv-cards-featured {
    grid-column: 1 / -1;
}
.wpv-cards-featured .wpv-card {
    flex-direction: row;
}
.wpv-cards-featured .wpv-card-img-wrap {
    flex: 0 0 45%;
    max-height: 340px;
}
.wpv-cards-featured .wpv-card-img-wrap img {
    height: 340px; object-fit: cover; width: 100%;
    border-radius: var(--wpv-card-radius) 0 0 var(--wpv-card-radius);
}
.wpv-cards-featured .wpv-card-body { padding: 28px; }
.wpv-cards-featured .wpv-card-title { font-size: 1.4rem; }
@media (max-width: 700px) {
    .wpv-cards-featured .wpv-card { flex-direction: column; }
    .wpv-cards-featured .wpv-card-img-wrap { flex: none; max-height: 220px; }
    .wpv-cards-featured .wpv-card-img-wrap img { height: 220px; border-radius: var(--wpv-card-radius) var(--wpv-card-radius) 0 0; }
}
@media (max-width: 768px) {
    .wpv-cards { grid-template-columns: 1fr; }
    .wpv-cards-featured { grid-column: unset; }
}

/* ══════════════════════════════════════
   CARD
══════════════════════════════════════ */
.wpv-card {
    background: var(--wpv-card-bg);
    border-radius: var(--wpv-card-radius);
    box-shadow: var(--wpv-card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .2s;
}
.wpv-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.14); transform: translateY(-2px); }

/* ── Image ───────────────────────────────────────────────────── */
.wpv-card-img-wrap { display: block; overflow: hidden; }
.wpv-card-img-wrap img { display: block; width: 100%; transition: transform .3s ease; }
.wpv-card:hover .wpv-card-img-wrap img { transform: scale(1.04); }

/* Aspect ratios */
.wpv-ratio-1x1  .wpv-card-img-wrap, .wpv-ratio-1x1  .wpv-card-img-wrap img { aspect-ratio: 1/1; object-fit: cover; }
.wpv-ratio-4x3  .wpv-card-img-wrap, .wpv-ratio-4x3  .wpv-card-img-wrap img { aspect-ratio: 4/3; object-fit: cover; }
.wpv-ratio-16x9 .wpv-card-img-wrap, .wpv-ratio-16x9 .wpv-card-img-wrap img { aspect-ratio: 16/9; object-fit: cover; }
.wpv-ratio-3x4  .wpv-card-img-wrap, .wpv-ratio-3x4  .wpv-card-img-wrap img { aspect-ratio: 3/4; object-fit: cover; }
.wpv-ratio-2x3  .wpv-card-img-wrap, .wpv-ratio-2x3  .wpv-card-img-wrap img { aspect-ratio: 2/3; object-fit: cover; }

/* File icon (non-image media) */
.wpv-card-file-icon {
    display: flex; align-items: center; justify-content: center;
    height: 100px; background: #f0f0f0; font-size: 1.5rem; font-weight: 700; color: #666;
}

/* ── Body ────────────────────────────────────────────────────── */
.wpv-card-body { padding: 16px; display: flex; flex-direction: column; flex: 1; gap: 4px; }

/* ── Badge ───────────────────────────────────────────────────── */
.wpv-badge {
    display: inline-block; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    padding: 2px 8px; border-radius: 3px;
    background: var(--wpv-badge-bg); color: var(--wpv-badge-color);
    margin-bottom: 2px;
}
.wpv-badge-sale { background: #e74c3c; color: #fff; }

/* ── Title ───────────────────────────────────────────────────── */
.wpv-card-title { margin: 0 0 4px; font-size: 1rem; line-height: 1.35; }
.wpv-card-title a { text-decoration: none; color: inherit; }
.wpv-card-title a:hover { text-decoration: underline; }

/* ── Author ──────────────────────────────────────────────────── */
.wpv-card-author { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: #666; }
.wpv-author-avatar { border-radius: 50%; }

/* ── Date ────────────────────────────────────────────────────── */
.wpv-card-date { font-size: .78rem; color: #888; }

/* ── Excerpt ─────────────────────────────────────────────────── */
.wpv-card-excerpt { font-size: .875rem; color: #555; line-height: 1.55; margin: 4px 0; }

/* ── Counts, meta ────────────────────────────────────────────── */
.wpv-card-count, .wpv-card-post-count, .wpv-card-comments { font-size: .78rem; color: #777; }

/* ── Price ───────────────────────────────────────────────────── */
.wpv-card-price { font-size: 1.15rem; font-weight: 700; color: #c0392b; margin-top: auto; padding-top: 8px; }
.wpv-card-price del { font-size: .85rem; color: #999; font-weight: 400; margin-right: 4px; }

/* ── Rating stars ────────────────────────────────────────────── */
.wpv-card-rating { font-size: 1rem; }
.wpv-star-filled { color: #f39c12; }
.wpv-star-empty  { color: #ddd; }

/* ── Stock ───────────────────────────────────────────────────── */
.wpv-card-stock { font-size: .78rem; font-weight: 600; }
.wpv-in-stock  { color: #27ae60; }
.wpv-out-stock { color: #e74c3c; }

/* ── Caption ─────────────────────────────────────────────────── */
.wpv-card-caption { font-size: .82rem; color: #666; font-style: italic; }

/* ── Custom fields ───────────────────────────────────────────── */
.wpv-card-meta { font-size: .8rem; margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.wpv-card-meta dt { font-weight: 600; color: #555; }
.wpv-card-meta dd { color: #333; margin: 0; }

/* ── CTA button ──────────────────────────────────────────────── */
.wpv-btn {
    display: inline-block; margin-top: auto; padding: 8px 18px;
    background: var(--wpv-accent); color: var(--wpv-accent-text) !important;
    border-radius: 4px; text-decoration: none !important;
    font-size: .875rem; font-weight: 600; text-align: center;
    transition: opacity .15s, transform .1s;
    border: 2px solid transparent;
    align-self: flex-start;
}
.wpv-btn:hover { opacity: .88; transform: translateY(-1px); }
.wpv-btn-sm { padding: 5px 12px; font-size: .8rem; }

/* ── Empty ───────────────────────────────────────────────────── */
.wpv-empty { color: #777; font-style: italic; }
