/* Variabili CSS per il tema Light (Azzurrino Chiaro) */
:root {
    --bg-color: #e3f2fd; /* Azzurrino chiaro per il body */
    --app-bg: #def0ff; /* Sfondo leggermente più chiaro per l'app container */
    --primary-color: #1565c0; /* Blu scuro per la leggibilità */
    --secondary-color: #0277bd;
    --text-main: #102a43;
    --text-muted: #334e68;
    --white: #ffffff;
    --border-radius: 8px; /* Arrotondamento ridotto ma moderno */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Reset e Box Sizing */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent; /* Rimuove l'highlight su mobile */
}

html, body {
    height: 100dvh;
    margin: 0;
    overflow: hidden; /* Blocca lo scroll del browser */
}

/* Nasconde visivamente la barra di scorrimento ma permette il movimento */
::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    height: 100dvh;
    overflow: hidden; /* Evita scroll della pagina intera, gestito dentro l'app */
}

/* Contenitore App per simulare mobile su desktop */
#app-container {
    width: 100%;
    max-width: 480px; /* Larghezza tipica smartphone */
    height: 100dvh;
    background-color: var(--app-bg);
    position: relative;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- HAMBURGER MENU --- */
#hamburger-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(255, 255, 255, 0.85);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary-color);
    z-index: 500; /* Sollevato per stare sopra l'header-bar */
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
}

/* --- TOP IMAGE PLACEHOLDER --- */
.top-image-placeholder {
    width: 100%;
    aspect-ratio: 2.5 / 1; /* Altezza = 1/2.5 della larghezza */
    background: linear-gradient(135deg, #cfd9df 0%, #e2ebf0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #90a4ae;
    font-size: 2rem;
}

/* --- MAIN CONTENT AREA --- */
main {
    flex: 1;
    overflow-y: auto;
    padding-bottom: calc(60px + env(safe-area-inset-bottom)); /* Spazio per la toolbar del footer con safe area */
}

.content-area {
    padding: 12px 8px; /* Marginature e padding ridotti come richiesto */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.3;
}

/* --- BOTTONI --- */
.buttons-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px; /* Margini ridotti tra i pulsanti */
    padding: 0 4px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 10px; /* Padding interno sufficiente per leggibilità */
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem; /* Caratteri ben leggibili */
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: var(--shadow);
}

.btn i {
    font-size: 1.4rem;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: var(--white);
}

.btn-secondary {
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    color: var(--primary-color);
    border: 1px solid #e0e0e0;
}

.assistant-section {
    width: 100%;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Sposta l'assistente a destra */
    padding: 0 10px;
}

.speech-bubble {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15); /* Ombra rafforzata */
    border: 1px solid #e1e8ed;
    width: 100%;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 40px; /* Spostato a destra */
    border-width: 12px 12px 0;
    border-style: solid;
    border-color: #ffffff transparent;
    display: block;
    width: 0;
    z-index: 2;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -13px;
    right: 39px; /* Spostato a destra (1px per bordo) */
    border-width: 13px 13px 0;
    border-style: solid;
    border-color: #e1e8ed transparent;
    display: block;
    width: 0;
    z-index: 1;
}

.description-text {
    font-size: 1.15rem; /* Ingrandito da 0.95rem */
    color: var(--text-main);
    line-height: 1.6; /* Leggermente aumentato per leggibilità */
    margin: 0;
    font-weight: 500; /* Reso un po' più marcato */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Mostra solo 2 righe inizialmente */
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.4s ease;
}

.assistant-section.expanded .description-text {
    -webkit-line-clamp: unset; /* Mostra tutto il testo */
    overflow: visible;
}

.assistant-avatar-container {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    position: relative;
    cursor: pointer;
    z-index: 1000; /* Sempre sopra la toolbar */
    margin-bottom: -15px; /* Sovrapposizione leggera globale */
}

/* Specifico per Pagina 0: Avatar flottante sopra la toolbar */
.page-0 .assistant-avatar-container {
    position: absolute;
    bottom: -20px; /* Alzato di 20px rispetto a prima */
    right: -10px;
    margin-top: 0;
    margin-bottom: -35px; /* Forza l'uscita dal bottom se necessario */
}

.page-0 .assistant-section {
    align-items: flex-end;
    padding-right: 15px;
}

.page-0 .speech-bubble {
    margin-bottom: 180px; /* Spazio per l'avatar gigante che flotta */
}

.assistant-avatar {
    width: 140px; 
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    background-color: transparent;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-0 .assistant-avatar {
    width: 230px; /* Ulteriore +15% (da 200px a 230px) */
    height: 230px;
}

/* STATO ESPANSO: Avatar ridotto (ca 60px) */
.assistant-section.expanded .assistant-avatar {
    width: 60px; /* Un po' più grande del precedente 42px */
    height: 60px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.page-0 .assistant-section.expanded .assistant-avatar-container {
    bottom: 25px; /* Alzato di altri 20px */
    right: 5px;
}

.assistant-section.expanded .assistant-avatar-container {
    margin-top: 10px;
}

.assistant-avatar-container:hover .assistant-avatar,
.assistant-avatar-container.active .assistant-avatar {
    transform: scale(1.03);
}

/* POPUP SCELTA ASSISTENTE */
.assistant-selector-popup {
    position: absolute;
    bottom: 100%; /* Mostra sopra l'avatar */
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 8px 0;
    margin-bottom: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    min-width: 140px;
    border: 1px solid #e1e8ed;
}

/* Freccina sotto il popup */
.assistant-selector-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 62px; /* Allineato più o meno al centro dell'avatar */
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: white transparent;
}

.assistant-avatar-container.active .assistant-selector-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.assistant-option {
    padding: 12px 16px;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: center;
    font-size: 1.05rem;
}

.assistant-option:hover {
    background: #f0f4f8;
    color: var(--primary-color);
}

/* EVIDENZIAMENTO SCELTA SELEZIONATA (PAGINA B) */
.selection-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.selection-item.selected {
    border-color: var(--primary-color) !important;
    background-color: #f0f7ff !important;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.2) !important;
    transform: translateX(4px);
}

.selection-item.selected .selection-label {
    color: var(--primary-color) !important;
}

.selection-item.selected .selection-label i {
    opacity: 1 !important;
    color: var(--primary-color);
}

.selection-item.selected .btn {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%) !important;
    color: var(--white) !important;
    border: none !important;
    box-shadow: 0 4px 10px rgba(21, 101, 192, 0.3) !important;
}

/* --- FOOTER TOOLBAR --- */
#bottom-toolbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px; /* Allineato all'app-container */
    height: calc(50px + env(safe-area-inset-bottom)); /* Supporto safe area per notch/sbarra di navigazione */
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    border-top: 1px solid #e1e8ed;
    z-index: 2000; /* Sopra ad altri elementi */
    box-sizing: border-box;
}

.toolbar-item {
    background: none;
    border: none;
    color: #90a4ae;
    font-size: 1.2rem;
    padding: 4px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.toolbar-item.active {
    color: var(--primary-color);
}

/* Torna indietro più evidente nella toolbar */
.toolbar-item:has(.fa-arrow-left) i,
.toolbar-item:has(.fa-chevron-left) i {
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(21, 101, 192, 0.35);
    transition: all 0.2s ease;
}

.toolbar-item:has(.fa-arrow-left):active i,
.toolbar-item:has(.fa-chevron-left):active i {
    transform: scale(0.9);
}

/* --- SIDEBAR --- */
#sidebar {
    position: absolute;
    top: 0;
    left: -280px; /* Nascosta fuori dallo schermo */
    width: 280px;
    height: 100%;
    background-color: var(--white);
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    z-index: 1000; /* Alzato per coprire sia hamburger che intestazioni (che sono a 100/500) */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

#sidebar.open {
    left: 0;
}

.sidebar-header {
    height: 70px; /* Reduced from 120px to save space */
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    margin: 0;
}

#close-sidebar {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    align-self: flex-start; /* Sposta la X in alto */
}

.sidebar-menu {
    list-style: none;
    padding: 4px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 1rem;
    transition: background 0.2s;
}

.sidebar-menu li a i {
    width: 24px;
    margin-right: 12px;
    color: var(--primary-color);
    text-align: center;
}

.sidebar-menu li a:hover, .sidebar-menu li a:active {
    background-color: #f0f4f8;
}

/* --- OVERLAY SIDEBAR --- */
#sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 900; /* Sotto la sidebar ma sopra il resto */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

#sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- SIMPLIFIED HERO LAYOUT (PAGINA 0) --- */
.hero-main-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100% - 50px); /* Height minus bottom toolbar */
    padding: 20px;
}

.center-hero-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
}

.hero-avatar-container {
    width: 80%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border: 4px solid var(--white);
    background-color: var(--white);
    transition: transform 0.3s ease;
}

.hero-avatar-container:hover {
    transform: scale(1.05);
}

.hero-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-button-container {
    width: 100%;
    max-width: 320px;
}

.btn-hero {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.2rem;
    border-radius: 50px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(21, 101, 192, 0.3);
    transition: all 0.2s ease;
}

/* --- REGISTRATION FORM & FIELDS (ISCRIZIONE.PHP) --- */
.registration-container {
    width: 100%;
    padding: 20px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-top: 10px;
    margin-bottom: 30px;
}

.registration-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 20px;
}

.form-group {
    width: 100%;
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

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

.col-prefix {
    width: 80px;
}

.col-phone {
    flex: 1;
}

.form-group-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 20px;
    cursor: pointer;
}

.form-group-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    user-select: none;
}

.btn-gray {
    background: linear-gradient(135deg, #9e9e9e 0%, #757575 100%);
    color: var(--white);
    margin-top: 10px;
}

.btn-submit-form {
    margin-top: 10px;
}

/* --- BANNER / NOTIFICATION POPUP --- */
.popup-notification-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(3px);
}

.popup-notification-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    text-align: center;
    border-top: 5px solid var(--primary-color);
    animation: popupScale 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popupScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.popup-message {
    font-size: 1.05rem;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 20px;
    font-weight: 500;
}

.popup-btn-close {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(21, 101, 192, 0.2);
    transition: all 0.2s;
}

.popup-btn-close:hover {
    opacity: 0.9;
}

/* --- ALERT MESSAGES --- */
.alert-box {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
}

.alert-box-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-box-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-box-info {
    background-color: #e0f2fe;
    color: #0369a1;
    border-left: 4px solid #0284c7;
}

/* --- ASSISTANT HEADER (NONNA & BUBBLE) --- */
.assistant-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
}

.assistant-avatar-right {
    width: 45%;
    max-width: 150px;
}

.header-avatar-nonna {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: var(--white);
    display: block;
}

.speech-bubble-left {
    position: relative;
    background-color: #66ccee;
    color: var(--white);
    border-radius: 50%;
    padding: 10px 15px;
    flex: 1;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.speech-bubble-left::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-width: 8px 0 8px 10px;
    border-style: solid;
    border-color: transparent transparent transparent #66ccee;
    display: block;
    width: 0;
}

.bubble-text {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    text-align: center;
}

/* --- INLINE FORM ACTIONS --- */
.form-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 15px;
    width: 100%;
}

.form-group-checkbox-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
    user-select: none;
    flex: 1;
}

.form-group-checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.btn-submit-inline {
    width: auto !important;
    min-width: 90px;
    padding: 10px 18px !important;
    font-size: 0.95rem !important;
    border-radius: 20px !important;
    height: 38px !important;
    box-shadow: 0 4px 10px rgba(21, 101, 192, 0.15);
}

.unsub-link-container {
    width: 100%;
    text-align: left;
    margin-top: 10px;
}

.btn-unsub-small {
    background: none;
    border: none;
    color: #9e9e9e;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.2s ease;
}

.btn-unsub-small:hover {
    color: #757575;
}

/* ==========================================================================
   NEW STYLES FOR THE REGISTRATION POPUP & NEW FLOW PAGES
   ========================================================================== */

/* Modern Form Styles */
.registration-form-card {
    background: var(--white);
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 90%;
    margin: 10px auto;
    text-align: left;
    border: 1px solid #e1e8ed;
}

.registration-form-card h3 {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
    font-weight: 700;
}

.form-group-pwa {
    margin-bottom: 16px;
}

.form-group-pwa label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group-pwa input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e1e8ed;
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    background-color: #f8fbff;
    transition: all 0.2s ease;
}

.form-group-pwa input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

/* Modal Popup Overlay */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 42, 67, 0.5);
    backdrop-filter: blur(6px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-card {
    background: var(--white);
    border-radius: 20px;
    padding: 30px 24px;
    width: 85%;
    max-width: 380px;
    box-shadow: 0 15px 35px rgba(16, 42, 67, 0.2);
    text-align: center;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.modal-overlay.active .modal-card {
    transform: translateY(0) scale(1);
}

.modal-icon-success {
    width: 64px;
    height: 64px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 16px;
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.15);
    animation: scaleCheck 0.5s ease-out 0.2s both;
}

@keyframes scaleCheck {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 10px;
}

.modal-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Colored Speech Bubbles */
.bubble-custom {
    position: relative;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
    width: 100%;
    margin-bottom: 12px;
    text-align: left;
    border: 1.5px solid transparent;
}

.bubble-custom p {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0;
}

/* Color Themes */
.bubble-green {
    background-color: #78c803;
    border-color: #61a102;
    color: #ffffff;
}

.bubble-yellow {
    background-color: #f1af01;
    border-color: #cc9401;
    color: #ffffff;
}

.bubble-blue {
    background-color: #046ab5;
    border-color: #035693;
    color: #ffffff;
}

/* Bubble tail directions */
.bubble-tail-bottom-right::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 30px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: inherit;
    display: block;
    width: 0;
    transform: rotate(0deg);
    filter: brightness(1);
}
/* For border outline of tail */
.bubble-tail-bottom-right::before {
    content: '';
    position: absolute;
    bottom: -11px;
    right: 29px;
    border-width: 11px 11px 0;
    border-style: solid;
    border-color: inherit;
    display: block;
    width: 0;
}

/* Elliptical Speech Bubbles for armi_luce.php */
.bubble-ellipse {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    border-radius: 50px !important; /* Standardized to match other bubbles and prevent yellow bubble distortion */
    padding: 20px 16px 20px 32px !important; /* Extra tall padding with reduced right padding */
    min-height: 100px; /* Much taller */
    gap: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.bubble-ellipse:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.bubble-ellipse p {
    flex: 1;
    font-size: 1.3rem !important; /* Enlarge text size (from 1.15rem to 1.3rem) */
    font-weight: 700 !important;
    line-height: 1.35 !important;
    margin: 0;
    text-align: left;
}

/* Hide original tails when using ellipse custom tails */
.bubble-ellipse.bubble-tail-bottom-right::after, 
.bubble-ellipse.bubble-tail-bottom-right::before {
    display: none !important;
}

/* New custom tails oriented towards the center-right avatar */
.bubble-ellipse-tail::after {
    content: '';
    position: absolute;
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 2;
}

.bubble-ellipse-tail::before {
    content: '';
    position: absolute;
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    z-index: 1;
}

/* Green Bubble (Top) - Tail pointing down-right towards the center (Very Large) */
.bubble-green.bubble-ellipse-tail::after {
    bottom: -20px;
    right: 70px;
    border-width: 20px 20px 0 0;
    border-color: #78c803 transparent transparent transparent;
}
.bubble-green.bubble-ellipse-tail::before {
    bottom: -22px;
    right: 69px;
    border-width: 22px 22px 0 0;
    border-color: #61a102 transparent transparent transparent;
}

/* Yellow Bubble (Center-Left) - Tail pointing directly right towards the nipotina (Very Large) */
.bubble-yellow.bubble-ellipse-tail::after {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 14px 0 14px 20px;
    border-color: transparent transparent transparent #f1af01;
}
.bubble-yellow.bubble-ellipse-tail::before {
    right: -22px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 15px 0 15px 22px;
    border-color: transparent transparent transparent #cc9401;
}

/* Blue Bubble (Bottom) - Tail pointing up-right towards the center (Very Large) */
.bubble-blue.bubble-ellipse-tail::after {
    top: -20px;
    right: 70px;
    border-width: 0 20px 20px 0;
    border-color: transparent transparent #046ab5 transparent;
}
.bubble-blue.bubble-ellipse-tail::before {
    top: -22px;
    right: 69px;
    border-width: 0 22px 22px 0;
    border-color: transparent transparent #035693 transparent;
}

/* Flex layout side-by-side center section */
.layout-side-by-side {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin: 15px 0;
    text-align: left;
}

.layout-left-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layout-right-col {
    width: 38%;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.avatar-nipotina-side {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 3px solid var(--white);
    background: #fff;
    animation: bounceIn 0.8s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Round arrow buttons */
.btn-round-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-round-arrow:active {
    transform: scale(0.9);
}

.btn-round-arrow-green {
    background-color: #2e7d32;
    color: var(--white);
}
.btn-round-arrow-green:hover {
    background-color: #1b5e20;
    box-shadow: 0 6px 14px rgba(46, 125, 50, 0.3);
}

.btn-round-arrow-yellow {
    background-color: #f57c00;
    color: var(--white);
}
.btn-round-arrow-yellow:hover {
    background-color: #e65100;
    box-shadow: 0 6px 14px rgba(245, 124, 0, 0.3);
}

.btn-round-arrow-blue {
    background-color: #1976d2;
    color: var(--white);
}
.btn-round-arrow-blue:hover {
    background-color: #1565c0;
    box-shadow: 0 6px 14px rgba(25, 118, 210, 0.3);
}

/* Modal inside Nueva Pagina */
.modal-form-pwa {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.modal-counter-wrapper {
    margin-top: 15px;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #cbd5e1;
}

.modal-counter-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.modal-counter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* layout-nipotino-top-right in missioni_compiute */
.layout-top-split {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
}

.layout-top-left-bubble {
    flex: 1;
}

.layout-top-right-avatar {
    width: 35%;
    max-width: 120px;
    flex-shrink: 0;
    margin-top: 5px;
}

.avatar-nipotino-side {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 3px solid var(--white);
    background: #fff;
}

/* Large Elliptical Left-aligned Speech Bubble with right tail pointing to avatar */
.speech-bubble-left-ellipse {
    position: relative;
    background-color: #bbdefb;
    border: 1.5px solid #64b5f6;
    color: #0d47a1;
    border-radius: 50px;
    padding: 16px 22px;
    flex: 1;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.speech-bubble-left-ellipse::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -10px;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-style: solid;
    border-color: transparent transparent transparent #bbdefb;
    display: block;
    width: 0;
    z-index: 2;
}

.speech-bubble-left-ellipse::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    border-width: 11px 0 11px 11px;
    border-style: solid;
    border-color: transparent transparent transparent #64b5f6;
    display: block;
    width: 0;
    z-index: 1;
}

/* Variante blu intenso per missioni_compiute.php */
.speech-bubble-left-ellipse.bubble-blue {
    background-color: #046ab5;
    border-color: #035693;
    color: #ffffff;
}
.speech-bubble-left-ellipse.bubble-blue::after {
    border-color: transparent transparent transparent #046ab5;
}
.speech-bubble-left-ellipse.bubble-blue::before {
    border-color: transparent transparent transparent #035693;
}

/* Variante gialla intensa per le_tue_armi_di_luce.php */
.speech-bubble-left-ellipse.bubble-yellow {
    background-color: #f1af01;
    border-color: #cc9401;
    color: #ffffff;
}
.speech-bubble-left-ellipse.bubble-yellow::after {
    border-color: transparent transparent transparent #f1af01;
}
.speech-bubble-left-ellipse.bubble-yellow::before {
    border-color: transparent transparent transparent #cc9401;
}

/* Variante verde intensa per nome_giovani.php */
.speech-bubble-left-ellipse.bubble-green {
    background-color: #78c803;
    border-color: #61a102;
    color: #ffffff;
}
.speech-bubble-left-ellipse.bubble-green::after {
    border-color: transparent transparent transparent #78c803;
}
.speech-bubble-left-ellipse.bubble-green::before {
    border-color: transparent transparent transparent #61a102;
}

/* Classe per rimuovere bordo, ombra e sfondo degli avatar, trasformandoli in quadrati con angoli arrotondati (30px) in continuità con lo sfondo */
.avatar-no-border {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    background-color: transparent !important;
    border-radius: 30px !important;
}

