/* ============================================================================
   Comerziofy — Módulo de reseñas
   Panel: .cfr-*    |    Tienda: .cfrev-*
   Tokens de panel.css (--primary, --gray-*, --success…). v2 — 2026-09-24
   ========================================================================== */

/* ══════════════════════════ PANEL ══════════════════════════ */
.cfr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 1000px) { .cfr-grid { grid-template-columns: 1fr; } }

.cfr-aviso {
    padding: 13px 16px; border-radius: 10px; margin-bottom: 20px;
    font-size: 14px; line-height: 1.5; border: 1px solid transparent;
}
.cfr-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.cfr-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.cfr-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.cfr-hint { font-size: 12px; color: var(--gray-500, #6b7280); line-height: 1.55; margin-top: 7px; }

.cfr-switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; cursor: pointer; }
.cfr-switch-row strong { display: block; font-size: 14px; color: var(--gray-800, #1f2937); }
.cfr-switch-row small { display: block; margin-top: 4px; font-size: 12px; color: var(--gray-500, #6b7280); line-height: 1.5; }
.cfr-switch {
    appearance: none; -webkit-appearance: none; flex-shrink: 0;
    width: 42px; height: 24px; margin: 2px 0 0; border-radius: 999px;
    background: var(--gray-300, #d1d5db); position: relative; cursor: pointer; transition: background .18s ease;
}
.cfr-switch::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease;
}
.cfr-switch:checked { background: var(--primary, #6366f1); }
.cfr-switch:checked::after { transform: translateX(18px); }

.cfr-vacio { color: var(--gray-500, #6b7280); font-size: 14px; margin: 0; }
.cfr-prod-list { display: flex; flex-direction: column; gap: 10px; }
.cfr-prod {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 16px; border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 12px; background: var(--gray-50, #f9fafb);
}
.cfr-prod-info strong { display: block; font-size: 14px; color: var(--gray-800, #1f2937); margin-bottom: 3px; }
.cfr-prod-info span { font-size: 12px; color: var(--gray-500, #6b7280); }
.cfr-prod-acciones { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cfr-prod-acciones form { margin: 0; }
.cfr-danger { color: var(--danger, #ef4444) !important; }

.cfr-detalle { margin-top: 28px; border-top: 1px solid var(--gray-200, #e5e7eb); padding-top: 22px; }
.cfr-detalle h4 { font-size: 15px; margin: 0 0 16px; color: var(--gray-700, #374151); }
.cfr-item { border: 1px solid var(--gray-200, #e5e7eb); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.cfr-item-head { display: flex; align-items: center; gap: 12px; }
.cfr-item-head > div { flex: 1; min-width: 0; }
.cfr-item-head strong { display: block; font-size: 14px; margin-bottom: 2px; }
.cfr-item-head small { font-size: 11.5px; color: var(--gray-500, #6b7280); }
.cfr-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: var(--primary, #6366f1); color: #fff; font-weight: 700;
    display: grid; place-items: center; text-transform: uppercase; font-size: 15px;
}
.cfr-stars { color: #f59e0b; font-size: 14px; letter-spacing: 2px; flex-shrink: 0; }
.cfr-del { margin: 0; flex-shrink: 0; }
.cfr-x { border: 0; background: none; color: var(--gray-400, #9ca3af); font-size: 21px; cursor: pointer; line-height: 1; padding: 0 2px; }
.cfr-x:hover { color: var(--danger, #ef4444); }
.cfr-item p { margin: 12px 0 0; font-size: 13.5px; color: var(--gray-600, #4b5563); line-height: 1.6; }
.cfr-fotos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cfr-fotos img { width: 74px; height: 74px; object-fit: cover; border-radius: 9px; border: 1px solid var(--gray-200, #e5e7eb); }

/* ══════════════════════════ TIENDA ══════════════════════════ */
.cfrev {
    max-width: 1140px; margin: 56px auto; padding: 0 20px;
    color: #111827; -webkit-font-smoothing: antialiased;
}

.cfrev-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.cfrev-titulo { font-size: clamp(21px, 2.4vw, 27px); font-weight: 700; margin: 0; letter-spacing: -.01em; color: #111827; }
.cfrev-verificado {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12.5px; font-weight: 600; color: #047857;
    background: #ecfdf5; border: 1px solid #a7f3d0;
    padding: 6px 13px; border-radius: 999px; white-space: nowrap;
}

/* ── Resumen: nota grande + desglose ─────────────────────────── */
.cfrev-resumen {
    display: grid; grid-template-columns: minmax(190px, 240px) 1fr;
    gap: 36px; align-items: center;
    padding: 26px 30px; margin-bottom: 34px;
    background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 16px;
}
.cfrev-nota-box { text-align: center; }
.cfrev-nota-fila { display: flex; align-items: baseline; justify-content: center; gap: 7px; }
.cfrev-nota { font-size: 50px; font-weight: 800; line-height: 1; letter-spacing: -.03em; color: #111827; }
.cfrev-nota-sobre { font-size: 15px; font-weight: 500; color: #9ca3af; }
.cfrev-estrellas { color: #f59e0b; letter-spacing: 3px; line-height: 1; }
.cfrev-estrellas-lg { font-size: 21px; margin: 12px 0 10px; }
.cfrev-conteo { margin: 0; font-size: 13px; color: #6b7280; line-height: 1.6; }
.cfrev-conteo strong { color: #374151; font-weight: 600; }
.cfrev-conteo-fotos { color: #9ca3af; font-size: 12px; }

.cfrev-barras { display: flex; flex-direction: column; gap: 9px; }
.cfrev-barra { display: grid; grid-template-columns: 42px 1fr 30px; align-items: center; gap: 12px; }
.cfrev-barra-lbl { font-size: 12.5px; color: #6b7280; display: inline-flex; align-items: center; gap: 3px; justify-content: flex-end; }
.cfrev-barra-lbl i { color: #f59e0b; font-style: normal; font-size: 11px; }
.cfrev-barra-pista { display: block; height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }
.cfrev-barra-pista i { display: block; height: 100%; background: #f59e0b; border-radius: 999px; transition: width .5s ease; }
.cfrev-barra-num { font-size: 12px; color: #9ca3af; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Galería de fotos de compradores ─────────────────────────── */
.cfrev-galeria-wrap { margin-bottom: 32px; }
.cfrev-sub { font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 12px; }
.cfrev-galeria { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.cfrev-gal-btn { border: 0; padding: 0; background: none; cursor: pointer; flex-shrink: 0; border-radius: 12px; }
.cfrev-gal-btn img {
    display: block; width: 104px; height: 104px; object-fit: cover;
    border-radius: 12px; border: 1px solid #e5e7eb; transition: transform .18s ease, box-shadow .18s ease;
}
.cfrev-gal-btn:hover img { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.14); }

/* ── Tarjetas de reseña ──────────────────────────────────────── */
.cfrev-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.cfrev-item {
    border: 1px solid #e5e7eb; border-radius: 16px; padding: 20px; background: #fff;
    display: flex; flex-direction: column; transition: box-shadow .18s ease, border-color .18s ease;
}
.cfrev-item:hover { box-shadow: 0 6px 22px rgba(17, 24, 39, .07); border-color: #d1d5db; }
.cfrev-item-head { display: flex; align-items: center; gap: 12px; }
.cfrev-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 700; color: #fff;
    text-transform: uppercase; font-size: 17px;
}
.cfrev-autor { min-width: 0; }
.cfrev-autor strong { display: block; font-size: 14.5px; font-weight: 600; color: #111827; margin-bottom: 3px; }
.cfrev-autor small { display: block; font-size: 12px; color: #9ca3af; }
.cfrev-item .cfrev-estrellas { font-size: 15px; margin: 14px 0 0; }
.cfrev-texto { margin: 10px 0 0; font-size: 14.5px; line-height: 1.65; color: #374151; }
.cfrev-fotos { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 14px; }
.cfrev-foto-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 10px; }
.cfrev-foto-btn img {
    display: block; width: 82px; height: 82px; object-fit: cover;
    border-radius: 10px; border: 1px solid #e5e7eb; transition: transform .18s ease;
}
.cfrev-foto-btn:hover img { transform: scale(1.05); }
.cfrev-sku {
    display: inline-block; align-self: flex-start; margin-top: 14px;
    font-size: 11.5px; color: #6b7280; background: #f3f4f6;
    padding: 5px 11px; border-radius: 7px;
}

/* ── Estrellas junto al título del producto ──────────────────── */
.cfrev-inline { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; flex-wrap: wrap; }
.cfrev-inline .cfrev-estrellas { font-size: 16px; }
.cfrev-inline a { color: #6b7280; text-decoration: none; border-bottom: 1px solid #e5e7eb; padding-bottom: 1px; }
.cfrev-inline a:hover { color: #374151; border-bottom-color: #9ca3af; }

/* ── Visor de foto ampliada ──────────────────────────────────── */
.cfrev-visor {
    position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 100000;
    display: none; align-items: center; justify-content: center; padding: 24px;
}
.cfrev-visor.abierto { display: flex; }
.cfrev-visor img { max-width: 94vw; max-height: 90vh; border-radius: 10px; }
.cfrev-visor-cerrar {
    position: absolute; top: 16px; right: 22px; color: #fff; font-size: 40px;
    background: none; border: 0; cursor: pointer; line-height: 1; opacity: .85;
}
.cfrev-visor-cerrar:hover { opacity: 1; }

@media (max-width: 760px) {
    .cfrev { margin: 40px auto; }
    .cfrev-resumen { grid-template-columns: 1fr; gap: 24px; padding: 22px; }
    .cfrev-lista { grid-template-columns: 1fr; }
    .cfrev-nota { font-size: 44px; }
}

/* ── Panel: ritmo vertical y controles (v3, 2026-09-24) ──────────────── */
.cfr-campo { margin: 0; }
.cfr-campo .form-label {
    display: block; margin-bottom: 7px;
    font-size: 13px; font-weight: 600; color: var(--gray-700, #374151);
}
.cfr-campo .form-control { width: 100%; }

.cfr-filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 560px) { .cfr-filtros { grid-template-columns: 1fr; } }

.cfr-seccion { display: flex; flex-direction: column; gap: 18px; margin: 20px 0; }

/* Casilla con descripción (importar) */
.cfr-casilla {
    display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
    margin-top: 18px; padding: 14px 16px;
    border: 1px solid var(--gray-200, #e5e7eb); border-radius: 12px;
    background: var(--gray-50, #f9fafb); transition: border-color .15s ease, background .15s ease;
}
.cfr-casilla:hover { border-color: var(--gray-300, #d1d5db); background: #fff; }
.cfr-casilla input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; accent-color: var(--primary, #6366f1); }
.cfr-casilla strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--gray-800, #1f2937); }
.cfr-casilla small { display: block; margin-top: 3px; font-size: 12px; color: var(--gray-500, #6b7280); line-height: 1.5; }

/* Interruptores: cada uno en su fila, con separación clara */
.cfr-switches {
    display: flex; flex-direction: column;
    border: 1px solid var(--gray-200, #e5e7eb); border-radius: 12px; overflow: hidden;
}
.cfr-switches .cfr-switch-row { padding: 15px 16px; margin: 0; }
.cfr-switches .cfr-switch-row + .cfr-switch-row { border-top: 1px solid var(--gray-200, #e5e7eb); }
.cfr-switches .cfr-switch-row:hover { background: var(--gray-50, #f9fafb); }

.cfr-switch-destacado {
    padding: 15px 16px; border: 1px solid var(--primary-100, #e0e7ff);
    border-radius: 12px; background: var(--primary-50, #eef2ff);
}
.cfr-switch-row span { min-width: 0; }

.cfr-btn-principal { margin-top: 22px; }
.cfr-nota-pie {
    margin: 12px 0 0; font-size: 12px; line-height: 1.6;
    color: var(--gray-500, #6b7280);
}

/* las dos tarjetas de arriba arrancan a la misma altura */
.cfr-grid > .card { align-self: stretch; }
.cfr-grid > .card .card-body { display: flex; flex-direction: column; }

/* ── Panel: edicion de resenas (2026-09-24) ──────────────────────────── */
.cfr-detalle-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 16px;
}
.cfr-detalle-head h4 { margin: 0; }

.cfr-nueva {
    border: 1px dashed var(--primary, #6366f1); border-radius: 12px;
    padding: 18px; margin-bottom: 16px; background: var(--primary-50, #eef2ff);
}
.cfr-oculto { display: none; }
.cfr-item.cfr-oculta { opacity: .6; background: var(--gray-50, #f9fafb); }

.cfr-edit-fila { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .cfr-edit-fila { grid-template-columns: 1fr; } }

.cfr-edit-acciones {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--gray-200, #e5e7eb);
}
.cfr-edit-acciones .btn:last-of-type { margin-left: auto; }

.cfr-visible { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.cfr-visible input { width: 17px; height: 17px; accent-color: var(--primary, #6366f1); }
.cfr-origen {
    font-size: 11px; color: var(--gray-500, #6b7280);
    background: var(--gray-100, #f3f4f6); padding: 3px 9px; border-radius: 6px;
}

.cfr-foto { position: relative; display: inline-block; }
.cfr-foto-x {
    position: absolute; top: -6px; right: -6px; width: 21px; height: 21px;
    border: 0; border-radius: 50%; background: var(--danger, #ef4444); color: #fff;
    font-size: 14px; line-height: 1; cursor: pointer; display: grid; place-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.cfr-foto-x:hover { background: #b91c1c; }
