/* =====================================================
   HOME - CUSTOMER REVIEWS (carousel cards + popup)
   Uses the shared carousel (.tb-carousel) from home.css and the
   brand tokens from core.css. Loaded only on the home page.
   ===================================================== */

.home-section--reviews {
    background: var(--bg-light);
    border-top: 1px solid var(--border-light);
}

/* items per screen for the shared carousel */
.tb-carousel--reviews { --pv: 2.15; --gap: 24px; }

/* ---------- Card ---------- */
.review-card {
    display: grid;
    grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
    min-height: 250px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow .25s ease, border-color .25s ease;
}

.review-card:hover,
.review-card:focus-visible {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.review-card:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.review-card-media {
    position: relative;
    background: var(--secondary);
}

.review-card-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.review-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px 22px;
    min-width: 0;
}

.review-card-name {
    font-size: 1rem;
    color: var(--primary-dark);
}

.review-card-title {
    font-size: .95rem;
    font-weight: 600;
    color: var(--secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-card-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .85rem;
    color: var(--text-light);
}

.review-stars {
    display: inline-flex;
    gap: 2px;
    color: var(--warning);
    font-size: .85rem;
}

.review-stars .off { color: var(--border); }

.review-card-comment {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-light);
    font-size: .92rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.review-card-category {
    margin-top: auto;
    font-size: .8rem;
    font-weight: 600;
    color: var(--primary-dark);
}

/* product without any picture: neutral placeholder */
.review-card-media.is-empty,
.review-modal-media.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
}

.review-card-media.is-empty::before,
.review-modal-media.is-empty::before {
    content: "\f03e";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 2.2rem;
    color: var(--border);
}

.review-modal-media.is-empty img { display: none; }

/* ---------- Pager dots ---------- */
.review-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.review-dots:empty { display: none; }

.review-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 50%;
    background: var(--border);
    transition: background .2s ease, width .2s ease;
}

.review-dot.active {
    width: 26px;
    border-radius: 5px;
    background: var(--primary);
}

/* ---------- Popup ---------- */
.review-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.review-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .62);
}

.review-modal-dialog {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    width: min(60rem, 100%);
    max-height: min(32rem, 90vh);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.review-modal-dialog:focus { outline: none; }

.review-modal-media {
    position: relative;
    min-height: 16rem;
    background: var(--secondary);
}

.review-modal-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.review-modal-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 40px 24px 20px;
    background: linear-gradient(0deg, rgba(15, 23, 42, .85) 0%, rgba(15, 23, 42, 0) 100%);
    color: var(--white);
    font-weight: 600;
}

.review-modal-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.review-modal-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
}

.review-modal-count {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    font-weight: 700;
    font-size: .9rem;
    border: 3px solid var(--primary-light);
}

.review-modal-heading { flex: 1; min-width: 0; }

.review-modal-heading h3 { font-size: 1.05rem; }

.review-modal-heading p {
    font-size: .8rem;
    color: var(--primary-dark);
}

.review-modal-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-light);
    transition: background .2s ease, color .2s ease;
}

.review-modal-close:hover { background: var(--primary-light); color: var(--primary-dark); }

.review-modal-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 20px;
}

.review-modal-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border-light);
}

.review-modal-item:last-child { border-bottom: none; }

.review-modal-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--white);
    font-size: .8rem;
    font-weight: 700;
}

.review-modal-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
}

.review-modal-meta strong { font-size: .92rem; }

.review-modal-item h4 {
    margin-top: 4px;
    font-size: .9rem;
}

.review-modal-item p {
    margin-top: 4px;
    font-size: .88rem;
    color: var(--text-light);
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.review-modal-date {
    display: block;
    margin-top: 6px;
    font-size: .75rem;
    color: var(--text-muted);
}

.review-modal-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    text-align: right;
}

body.review-modal-open { overflow: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .tb-carousel--reviews { --pv: 1.9; }
}

@media (max-width: 992px) {
    .tb-carousel--reviews { --pv: 1.35; }
}

@media (max-width: 700px) {
    .tb-carousel--reviews { --pv: 1.08; --gap: 14px; }

    .review-card { grid-template-columns: minmax(0, 38%) minmax(0, 1fr); min-height: 220px; }
    .review-card-body { padding: 18px 16px; }

    .review-modal { padding: 0; align-items: flex-end; }

    .review-modal-dialog {
        grid-template-columns: 1fr;
        grid-template-rows: 11rem minmax(0, 1fr);
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .review-modal-media { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .review-card,
    .review-dot,
    .review-modal-close { transition: none; }
}
