/**
 * PERCHÉ: Stili dedicati per la sezione recensioni Google con design elegante glassmorphism.
 * UTILIZZO: Incluso tramite l'array $pageCss nella homepage (home.php).
 * DIPENDENZE: Compatibile con Bootstrap e layout responsive del sito.
 * INFO: Adatta gli stili di Tailwind CSS in Vanilla CSS puro, integrando i colori
 *       e la tipografia ufficiale del sito Automobilando (#0b163f, #00577c, #0d6efd).
 */

/* ==========================================================================
   Sezione Principale e Sfondo Astratto
   ========================================================================== */
.reviews-section {
    position: relative;
    background-color: #00577c;
    /* Blu scuro aziendale Automobilando */
    color: #f8fafc;
    padding: 90px 20px;
    overflow: hidden;
}

/* Forme astratte sfocate in sottofondo (Blobs) */
.reviews-bg-blobs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.reviews-bg-blobs .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    opacity: 0.35;
    animation: blobAnimation 10s infinite ease-in-out;
}

.reviews-bg-blobs .blob-1 {
    top: -10%;
    left: -10%;
    width: 400px;
    height: 400px;
    background-color: #00577c;
}

.reviews-bg-blobs .blob-2 {
    top: 20%;
    right: -10%;
    width: 400px;
    height: 400px;
    background-color: #0d6efd;
    animation-delay: 2s;
}

.reviews-bg-blobs .blob-3 {
    bottom: -20%;
    left: 20%;
    width: 520px;
    height: 520px;
    background-color: #0d6efd;
    opacity: 0.2;
    animation-delay: 4s;
}

@keyframes blobAnimation {
    0% {
        transform: translate(0px, 0px) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }

    100% {
        transform: translate(0px, 0px) scale(1);
    }
}

/* ==========================================================================
   Grid e Struttura Layout
   ========================================================================== */
.reviews-container-inner {
    max-width: 1240px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.reviews-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: center;
}

@media (min-width: 992px) {
    .reviews-grid {
        grid-template-columns: 5fr 7fr;
        gap: 40px;
    }
}

/* ==========================================================================
   Colonna Sinistra: Badge, Titoli e Rating Summary
   ========================================================================== */
.reviews-intro {
    text-align: center;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

@media (min-width: 992px) {
    .reviews-intro {
        text-align: left;
    }
}

/* Badge Google "Recensioni Verificate" */
.reviews-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 24px;
}

.google-g {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.reviews-badge span {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #cbd5e1;
}

/* Titolo d'impatto con testo sfumato */
.reviews-title {
    font-size: 38px;
    font-weight: 700;
    line-height: 1.18;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (min-width: 992px) {
    .reviews-title {
        font-size: 54px;
    }
}

.reviews-description {
    color: #94a3b8;
    font-size: 17px;
    font-weight: 300;
    line-height: 1.6;
    max-width: 440px;
    margin: 0 auto 32px auto;
}

@media (min-width: 992px) {
    .reviews-description {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Box Sintesi Valutazione Google (Stile Card dall'immagine) */
.reviews-rating-summary {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 22px;
    padding: 26px 32px;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.3);
    margin-top: 8px;
}

@media (max-width: 991px) {
    .reviews-rating-summary {
        margin: 8px auto 0 auto;
    }
}

.rating-score-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.rating-score-value {
    font-size: 54px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    letter-spacing: -1px;
}

.rating-score-max {
    font-size: 20px;
    color: #94a3b8;
    font-weight: 400;
}

.rating-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e2e8f0;
    font-size: 15px;
    font-weight: 500;
}

.rating-meta .google-g {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.rating-meta #google-user-ratings-total {
    font-weight: 600;
    color: #ffffff;
}

/* ==========================================================================
   Colonna Destra: Cards Recensioni Glassmorphism & Cascata
   ========================================================================== */
.reviews-cards-col {
    position: relative;
    width: 100%;
}

.reviews-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

@media (min-width: 992px) {
    .reviews-wrapper {
        margin-left: auto;
        margin-right: 0;
    }
}

/* Scheda stile Vetro Sfocato (Glass Card) */
.glass-card {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.4s ease, border-color 0.4s ease;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.01);
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.28);
}

/* Simbolo citazione decorativo in sottofondo alla card */
.quote-mark {
    position: absolute;
    top: -15px;
    right: 20px;
    font-size: 130px;
    font-family: Georgia, 'Times New Roman', serif;
    color: rgba(255, 255, 255, 0.05);
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* Intestazione della Card (Autore e Stelle) */
.review-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.review-author-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.author-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    background-color: #1e293b;
    flex-shrink: 0;
}

.author-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 17px;
    margin: 0 0 3px 0;
}

.review-date {
    color: #94a3b8;
    font-size: 12px;
    margin: 0;
}

.card-stars {
    font-size: 17px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    color: #ffc107;
}

/* Testo della recensione */
.review-body-text {
    color: #e2e8f0;
    font-weight: 300;
    font-size: 15px;
    line-height: 1.65;
    position: relative;
    z-index: 2;
    margin: 0;
}

/* ==========================================================================
   Effetto Cascata (Sfalsamento Schede su Desktop)
   ========================================================================== */
@media (min-width: 992px) {
    .cascade-0 {
        margin-left: 0;
    }

    .cascade-1 {
        margin-left: 48px;
    }

    .cascade-2 {
        margin-left: 96px;
    }

    .cascade-3 {
        margin-left: 48px;
    }

    .cascade-4 {
        margin-left: 0;
    }
}

/* Delays per l'animazione di entrata */
.delay-100 {
    animation-delay: 100ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-500 {
    animation-delay: 500ms;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Loader e Stati di Errore
   ========================================================================== */
.reviews-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: #94a3b8;
    padding: 60px 0;
    width: 100%;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.reviews-error-box {
    padding: 24px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 16px;
    color: #fca5a5;
    font-size: 14px;
    line-height: 1.5;
}

.stars-outer {
    position: relative;
    display: inline-block;
    color: #e0e0e0;
    /* Colore delle stelle vuote/grigie */
    font-size: 24px;
    /* Dimensione delle stelle */
    line-height: 1;
}

.stars-inner {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    color: #ffc107;
    /* Colore oro (stelle piene) */
    /* Calcola automaticamente la larghezza in base alla variabile --rating */
    width: calc(var(--rating) / 5 * 100%);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}