/* ==========================================================================
   Contenedor principal del Widget de Opiniones
   ========================================================================== */
#agWidgetSide {
    position: relative;
    margin: 24px 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    height: 160px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    -webkit-font-smoothing: antialiased;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: visible;
    padding: 10px 14px;
}

/* Escarapela / Listón (Cocarde) */
#agWidgetSide .ag-cocarde {
    position: absolute;
    top: -16px;
    left: 20px;
    z-index: 10;
    pointer-events: none;
}

#agWidgetSide .ag-cocarde img {
    width: 28px;
    height: auto;
    display: block;
}

/* Panel lateral de resumen (Puntuación global) */
#agWidgetSide #summaryPart {
    flex: 0 0 200px;
    width: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-right: 1px solid #edf2f7;
    padding: 4px 12px 4px 0;
    margin: 0;
    box-sizing: border-box;
    text-align: center;
}

#agWidgetSide .reviewGlobal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #0c56a4;
    margin: 0;
    width: 100%;
}

/* Nota y animación de número */
#agWidgetSide .largeNote {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 800;
    font-style: normal;
    font-size: 22px;
    line-height: 1;
    color: #0c56a4;
    margin: 0 0 4px 0;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

#agWidgetSide .largeNote big {
    font-size: 34px;
    font-weight: 800;
    font-style: normal;
    letter-spacing: -0.5px;
    line-height: 1;
    color: #0c56a4;
    margin-right: 1px;
}

#agWidgetSide .largeNote span {
    font-size: 20px;
    font-weight: 700;
    font-style: normal;
    color: #0c56a4;
    line-height: 1;
}

/* Estrellas y animación */
#agWidgetSide .star {
    width: 105px;
    max-width: 105px;
    position: relative;
    margin: 2px auto 4px auto;
    padding: 0;
    height: 18px;
    background: url(../img/stars_empty.svg) no-repeat left center;
    background-size: 105px 18px;
    transition: transform 0.25s ease, filter 0.25s ease;
    cursor: default;
}

#agWidgetSide .star:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.45));
}

#agWidgetSide .star span.note {
    display: block;
    height: 18px;
    width: 0;
    overflow: hidden;
    background: url(../img/stars_filled.svg) no-repeat left center;
    background-size: 105px 18px;
}

#agWidgetSide .animate {
    animation: fillStars 1.5s ease-out forwards;
}

@keyframes fillStars {
    from {
        width: 0;
    }
}

#agWidgetSide #ratingLabel {
    margin: 0;
    padding: 0;
    font-size: 12px;
    line-height: 1.3;
    color: #0c56a4;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#agWidgetSide #ratingLabel .ratingText {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #0c56a4;
    white-space: nowrap;
}

#agWidgetSide #ratingLabel .fbLink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    margin-top: 1px;
}

#agWidgetSide #ratingLabel .fbLink:hover {
    text-decoration: underline;
}

#agWidgetSide #ratingLabel .fbText {
    font-weight: 800;
    font-size: 13px;
    color: #1877f2;
}

#agWidgetSide #ratingLabel .clickIcon {
    width: 13px;
    height: 13px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

/* ==========================================================================
   Lista horizontal de opiniones
   ========================================================================== */
#agWidgetSide .reviewList {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    padding: 2px 6px 6px 14px;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
    -webkit-overflow-scrolling: touch;
}

#agWidgetSide .reviewList::-webkit-scrollbar {
    height: 6px;
}

#agWidgetSide .reviewList::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#agWidgetSide .reviewList::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

#agWidgetSide .reviewList::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Tarjetas individuales de opinión */
#agWidgetSide .reviewList li.tarjeta {
    flex: 0 0 225px;
    width: 225px;
    box-sizing: border-box;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    white-space: normal;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

#agWidgetSide .reviewList li.tarjeta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

#agWidgetSide .author {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

#agWidgetSide .author img.img_opinion {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    object-fit: contain;
    margin-top: 1px;
}

#agWidgetSide .author-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

#agWidgetSide .author-name-row {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    line-height: 1.25;
}

#agWidgetSide .author-name {
    font-size: 13.5px;
    line-height: 1.25;
    color: #175298;
    font-weight: 700;
}

#agWidgetSide .author-name a {
    color: #175298;
    text-decoration: none;
}

#agWidgetSide .author-name a:hover {
    text-decoration: underline;
}

/* Icono Minimalista de Compra Verificada */
.ag-verified-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    cursor: help;
    transition: transform 0.2s ease;
}

.ag-verified-icon:hover {
    transform: scale(1.15);
}

.ag-verified-icon svg {
    width: 14px;
    height: 14px;
    display: block;
    color: #10b981;
    fill: #10b981;
}

#agWidgetSide .author .time {
    display: block;
    font-size: 10.5px;
    font-weight: 400;
    color: #718096;
    margin-top: 2px;
    line-height: 1.2;
}

#agWidgetSide .author .time span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    vertical-align: middle;
}

#agWidgetSide .author .time img {
    width: 12px;
    height: 12px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

#agWidgetSide .reviewTxt {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 12px;
    line-height: 1.35;
    color: #334155;
}

#agWidgetSide .reviewTxt p {
    margin: 0;
    padding: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Modal "Dejar una Opinión"
   ========================================================================== */
.ag-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ag-modal-overlay.ag-modal-active {
    display: flex;
    opacity: 1;
}

.ag-modal-dialog {
    background: #ffffff;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: agModalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

@keyframes agModalPop {
    from {
        transform: scale(0.92) translateY(10px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.ag-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px 14px 22px;
    border-bottom: 1px solid #f1f5f9;
}

.ag-modal-title-wrap h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.ag-modal-title-wrap p {
    margin: 0;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.35;
}

.ag-modal-close {
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s ease;
}

.ag-modal-close:hover {
    color: #0f172a;
}

.ag-modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1;
}

/* Formulario */
.ag-form-group {
    margin-bottom: 14px;
}

.ag-form-row {
    display: flex;
    gap: 12px;
}

.ag-col {
    flex: 1;
    min-width: 0;
}

.ag-form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 5px;
}

.ag-req {
    color: #ef4444;
}

.ag-input,
.ag-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 13.5px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #1e293b;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.ag-input:focus,
.ag-textarea:focus {
    outline: none;
    border-color: #0c56a4;
    box-shadow: 0 0 0 3px rgba(12, 86, 164, 0.15);
}

.ag-textarea {
    resize: vertical;
    min-height: 80px;
}

.ag-help-text {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

/* Selector Interactivo de Estrellas */
.ag-stars-group {
    text-align: center;
    background: #f8fafc;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.ag-star-picker {
    display: inline-flex;
    gap: 6px;
    cursor: pointer;
    font-size: 32px;
    line-height: 1;
    user-select: none;
}

.ag-star-item {
    color: #d1d5db;
    transition: color 0.15s ease, transform 0.15s ease;
}

.ag-star-item.ag-star-filled {
    color: #fbbf24;
}

.ag-star-item:hover {
    transform: scale(1.2);
}

.ag-rating-hint {
    margin-top: 6px;
    font-size: 12.5px;
    font-weight: 700;
    color: #0c56a4;
}

/* Alertas */
.ag-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.4;
    margin-top: 10px;
}

.ag-alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.ag-alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Spinner */
.ag-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: agSpin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

@keyframes agSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer Modal */
.ag-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.ag-btn-cancel {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ag-btn-cancel:hover {
    background: #e2e8f0;
}

.ag-btn-submit {
    background: #0c56a4;
    border: none;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.ag-btn-submit:hover {
    background: #083c75;
    box-shadow: 0 2px 8px rgba(12, 86, 164, 0.3);
}

.ag-btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ==========================================================================
   Responsive (Tablets & Smartphones)
   ========================================================================== */
@media (max-width: 680px) {
    #agWidgetSide {
        flex-direction: column;
        height: auto;
        min-height: auto;
        padding: 12px 12px 0 12px;
        gap: 0;
    }

    #agWidgetSide .ag-cocarde {
        top: -14px;
        left: 18px;
    }

    #agWidgetSide .ag-cocarde img {
        width: 25px;
    }

    #agWidgetSide #summaryPart {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #edf2f7;
        padding: 4px 0 12px 0;
        margin: 0;
    }

    #agWidgetSide .reviewList {
        width: 100%;
        padding: 12px 2px 12px 2px;
        margin: 0;
        gap: 10px;
        scroll-snap-type: x mandatory;
    }

    #agWidgetSide .reviewList li.tarjeta {
        flex: 0 0 80%;
        width: 80%;
        max-width: 280px;
        scroll-snap-align: start;
        padding: 10px;
    }

    #agWidgetSide .largeNote big {
        font-size: 30px;
    }

    .ag-form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ==========================================================================
   Banner de Calificación en Detalle de Pedido (Mi Cuenta)
   ========================================================================== */
.ag-order-detail-card {
    margin: 20px 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ag-order-card-pending,
.ag-order-card-reviewed {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ag-order-card-pending {
    justify-content: space-between;
    flex-wrap: wrap;
}

.ag-order-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #eff6ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ag-reviewed-icon {
    background: #ecfdf5;
}

.ag-order-card-info {
    flex: 1;
    min-width: 200px;
}

.ag-order-card-info h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.ag-order-card-info p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.35;
}

.ag-btn-rate-order {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #0c56a4;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ag-btn-rate-order:hover {
    background: #083c75;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12, 86, 164, 0.25);
    color: #ffffff;
}

.ag-existing-review-stars {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 6px;
}

.ag-star-mini {
    font-size: 16px;
    color: #cbd5e1;
    line-height: 1;
}

.ag-star-mini.filled {
    color: #fbbf24;
}

.ag-existing-review-date {
    font-size: 12px;
    color: #64748b;
    margin-left: 6px;
}

@media (max-width: 680px) {
    .ag-order-card-pending {
        flex-direction: column;
        align-items: flex-start;
    }

    .ag-btn-rate-order {
        width: 100%;
        justify-content: center;
    }
}

/* Botón de Calificar debajo de la referencia en el Historial de Pedidos */
.ag-ref-rate-wrap {
    margin-top: 6px;
    display: block;
}

.ag-btn-history-rate {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #0c56a4;
    color: #ffffff !important;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: none !important;
    margin: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    line-height: 1.2;
    box-shadow: 0 1px 3px rgba(12, 86, 164, 0.2);
}

.ag-btn-history-rate:hover {
    background: #083c75;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(12, 86, 164, 0.35);
}

/* Estrellas de pedidos ya calificados en el Historial */
.ag-history-rated-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    font-size: 15px;
    line-height: 1;
    cursor: default;
    user-select: none;
}

.ag-history-rated-stars .ag-star-mini {
    font-size: 15px;
    color: #cbd5e1;
    line-height: 1;
    display: inline-block;
}

.ag-history-rated-stars .ag-star-mini.filled {
    color: #fbbf24;
    text-shadow: 0 1px 2px rgba(251, 191, 36, 0.3);
}

/* ==========================================================================
   Bloque de Confianza en Carrito y Checkout (displayShoppingCartFooter)
   ========================================================================== */
.ag-cart-trust-wrapper {
    margin: 24px 0 16px 0;
    width: 100%;
    clear: both;
}

.ag-cart-trust-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ag-cart-trust-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.ag-cart-trust-score-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ag-cart-trust-cocarde {
    width: 38px;
    height: 38px;
    object-fit: contain;
    flex-shrink: 0;
}

.ag-cart-trust-note {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ag-cart-trust-note strong {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.ag-cart-trust-note span {
    font-size: 13px;
    color: #94a3b8;
    font-weight: 600;
}

.ag-cart-trust-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
}

.ag-cart-trust-stars .ag-star-mini {
    font-size: 15px;
    color: #cbd5e1;
    line-height: 1;
}

.ag-cart-trust-stars .ag-star-mini.filled {
    color: #fbbf24;
}

.ag-cart-trust-title {
    font-size: 13px;
    color: #475569;
    margin-top: 2px;
}

.ag-cart-trust-title strong {
    color: #0c56a4;
}

.ag-cart-fb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    color: #1877f2 !important;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.ag-cart-fb-btn:hover {
    background: #1877f2;
    color: #ffffff !important;
    border-color: #1877f2;
}

.ag-cart-reviews-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.ag-cart-review-item {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    padding: 10px 14px;
}

.ag-cart-review-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.ag-cart-review-author {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
}

.ag-verified-mini {
    width: 14px;
    height: 14px;
}

.ag-cart-review-stars {
    margin-left: auto;
    display: inline-flex;
    gap: 1px;
    font-size: 12px;
}

.ag-cart-review-text {
    font-size: 12px;
    color: #475569;
    line-height: 1.35;
    margin: 0;
    font-style: italic;
}

@media (max-width: 680px) {
    .ag-cart-trust-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .ag-cart-reviews-grid {
        grid-template-columns: 1fr;
    }

    /* En móviles mostrar únicamente 3 opiniones para mantener la vista compacta */
    .ag-cart-review-item:nth-child(n+4) {
        display: none !important;
    }
}


