/**
 * File: style.css
 * v2.5.0 (Modal Top Spacing Fix)
 */
:root {
    --primary: #B39DDB;
    --primary-light: #D1C4E9;
    --primary-dark: #5E35B1;
    --primary-darker: #4527A0;
    --background: #F5F5F5;
    --card-bg: #FFFFFF;
    --text: #424242;
    --text-light: #757575;
    --success: #66BB6A;
    --warning: #FFB74D;
    --error: #EF5350;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --calm-1: #81D4FA;
    --calm-2: #A7FFEB;
    --calm-3: #FFF9C4;

    --journey-1: #B39DDB;
    --journey-2: #80CBC4;
    --journey-3: #FFAB91;
    --streak-gradient: linear-gradient(135deg, #D1C4E9, #B39DDB);
    --streak-height: 120px;
    --text-primary-light: #5E35B1;
    --text-primary-dark: #7E57C2;
    --text-primary: var(--text-primary-light);
    --button-bg-light: var(--primary);
    --button-bg-dark: var(--primary-dark);
    --button-bg: var(--button-bg-light);
    --toggle-bg: #e0e0e0;
    --toggle-bg-dark: #2d2d2d;
    --toggle-slider-gradient: linear-gradient(135deg, #ff8a80, #ea80fc, #8c9eff, #80d8ff);
    --filter-bg-light: #E9E4F0;
    --disabled-bg: #E9E4F0;
    --disabled-text: #9575CD;
    --pastel-anxiety: var(--warning);
    --pastel-stress: var(--error);
}

/* Phosphor icons: inherit color from parent element */
.ph {
    color: inherit;
}

/* Nav bar icons 33% bigger */
.nav-icon .ph {
    font-size: 1.33em;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Prevent gray flash on tap in iOS WebView */
}

html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: #D3BBFF;
    /* Fallback anti-flash iOS */
}

body {
    height: 100%;
    width: 100%;
    /* margin/padding 0 already set in * */
    overflow: hidden;
    /* Blocco definitivo del rimbalzo della cornice WebView iOS */
    position: fixed;
    /* Obbligatorio su iOS per impedire il drag dell'intera viewport */
    background-color: #D3BBFF;
    /* Fallback solido per evitare flash bianchi su iOS prima del caricamento app-container */
    background-image:
        radial-gradient(ellipse at 50% 30%, hsla(277, 40%, 85%, 0.6) 0%, hsla(277, 40%, 85%, 0) 60%),
        linear-gradient(to top, #D3BBFF 0%, #D1C4E9 50%, #B39DDB 100%);
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.5s ease, color 0.5s ease;
}

body::before {
    display: none;
}

body.dark-theme {
    background-image:
        radial-gradient(ellipse at 70% 20%, hsla(260, 100%, 70%, 0.3) 0%, hsla(260, 100%, 70%, 0) 50%),
        radial-gradient(ellipse at 30% 25%, hsla(265, 80%, 60%, 0.3) 0%, hsla(265, 80%, 60%, 0) 45%),
        linear-gradient(180deg, #100a1c 0%, #1c102e 40%, #3c2d5a 100%);
    --background: #121212;
    --card-bg: #1e1e1e;
    --text: #f5f5f5;
    --text-light: #bdbdbd;
    --primary: #7E57C2;
    --primary-dark: #7E57C2;
    --primary-darker: #5E35B1;
    --calm-1: #4FC3F7;
    --calm-2: #1DE9B6;
    --calm-3: #FFF59D;
    --streak-gradient: linear-gradient(135deg, #7E57C2, #5E35B1);
    --text-primary: var(--text-primary-dark);
    --button-bg: var(--button-bg-dark);
    --toggle-bg: var(--toggle-bg-dark);
    --disabled-bg: #2d2640;
    --disabled-text: #7E57C2;

    /* Semantic dark tokens */
    --surface-elevated: #252538;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.dark-theme::before {
    display: none;
}

/* === LOADING SPINNER FOR BUTTONS === */
.spinner-border {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    vertical-align: text-bottom;
    border: 0.15em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.1em;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

#main-app {
    /* Removed `position: absolute` to let the container flow naturally if needed, 
       but keeping `height: 100%` and `overflow-y: auto` as the primary scroll container. */
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top);
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
    opacity: 0;
    transition: opacity 0.3s ease-in-out, padding-bottom 0.3s ease-out;
    scroll-behavior: smooth;
}

#main-app.app-visible {
    opacity: 1;
}

#auth-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    overflow: hidden;
    background-color: #D3BBFF;
    transition: opacity 0.5s ease-out;
}

.auth-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 30px 25px;
    border: 1px solid rgba(179, 157, 219, 0.2);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.auth-header {
    text-align: center;
    margin-bottom: 15px;
}

.auth-title {
    text-align: center;
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 400;
}

.container {
    max-width: 100%;
    width: 100%;
    padding: 0 15px;
    margin: 0 auto;
}

.section {
    display: none;
    padding: 20px 15px 120px;
    animation: fadeIn 0.4s ease-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    text-align: center;
    margin-bottom: 25px;
    padding-top: 15px;
}

.header h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header p {
    color: white;
    font-size: 0.95rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-theme .header p {
    color: var(--text-light);
    text-shadow: none;
}

.profile-welcome {
    color: white !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-theme .profile-welcome {
    color: var(--text-light) !important;
    text-shadow: none;
}

.card {
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(179, 157, 219, 0.2);
    position: relative;
}

.dark-theme .card {
    border-color: var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.daily-card {
    position: relative;
    height: 200px;
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.daily-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.daily-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 20px;
    color: white;
}

.daily-card-overlay h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.streak-card {
    background: var(--streak-gradient);
    color: white;
    border-radius: 18px;
    padding: 15px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    height: var(--streak-height);
}

.streak-card::after {
    content: "";
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.streak-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 5px 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.streak-label {
    font-size: 1rem;
    opacity: 0.9;
}

#combined-checkin-card .checkin-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    text-align: center;
}

#combined-checkin-card .combined-slider {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(179, 157, 219, 0.2);
}

.dark-theme #combined-checkin-card .combined-slider {
    border-top-color: var(--border-color);
}

#combined-checkin-card .mood-tracker {
    margin-bottom: 0;
}


.mood-tracker {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}

.mood-tracker::-webkit-scrollbar {
    height: 5px;
}

.mood-tracker::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 10px;
}

.mood-btn {
    background: none;
    border: 2px solid transparent;
    font-size: 2.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px;
    border-radius: 50%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mood-btn.selected {
    transform: scale(1.1);
    border-color: var(--primary);
    background: rgba(209, 196, 233, 0.3);
}

.mood-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: none !important;
    border-color: transparent !important;
}

.mood-tracker-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: -5px;
    margin-bottom: 15px;
}

.mood-status {
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    background: rgba(209, 196, 233, 0.2);
    color: var(--text);
    font-size: 0.95rem;
    margin: 10px 0;
    font-weight: 600;
    border: 1px solid var(--primary-light);
}

.dark-theme .mood-status {
    background: rgba(126, 87, 194, 0.15);
    border-color: rgba(126, 87, 194, 0.3);
}

.dark-theme input[type="range"] {
    background: linear-gradient(to right, var(--primary-darker), var(--primary-dark));
}

.dark-theme input[type="range"]::-webkit-slider-thumb {
    background: var(--surface-elevated);
    border-color: var(--primary);
}

.slider-container {
    padding: 15px 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.slider-value {
    text-align: center;
    font-size: 1.5rem;
    margin: 10px 0;
    font-weight: bold;
    color: var(--primary);
}

input[type="range"] {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, var(--primary-light), var(--primary-dark));
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--primary);
}

input[type="range"]:disabled::-webkit-slider-thumb {
    background: var(--disabled-bg);
    border-color: var(--disabled-text);
}

.meditation-list {
    display: grid;
    gap: 15px;
}

.meditation-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, box-shadow;
    border: 1px solid rgba(179, 157, 219, 0.1);
    cursor: pointer;
    position: relative;
}

.dark-theme .meditation-item {
    background: #2a2530;
    border-color: rgba(126, 87, 194, 0.4);
}

.meditation-info {
    flex: 1;
    min-width: 0;
}

.meditation-title {
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meditation-desc {
    font-size: 0.9rem;
    color: var(--text-light);
}

.player-modal,
.profile-edit-modal,
.medal-unlock-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
    transform: scale(0.95);
}

.player-modal.active,
.profile-edit-modal.active,
.medal-unlock-modal.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(1);
}

/* History Modal Compact Native Style */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.history-modal.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* Report modal needs higher z-index to overlay the history modal that opened it */
#report-modal {
    z-index: 1010;
}

.player-container {
    background: var(--card-bg);
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--primary-light);
    margin-top: env(safe-area-inset-top);
    margin-bottom: env(safe-area-inset-bottom);
}

.dark-theme .player-container {
    border-color: rgba(126, 87, 194, 0.3);
}

.player-header {
    padding: 20px;
    text-align: center;
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
}

.player-body {
    padding: 25px 20px;
    background: var(--card-bg);
    color: var(--text);
}

#meditation-audio {
    display: none;
}

.custom-player-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.play-pause-btn,
.player-control-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--button-bg);
    color: white;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.play-pause-btn:active,
.player-control-btn:active {
    transform: scale(0.95);
    background: var(--primary-darker);
}

.progress-time-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-display {
    font-size: 0.85rem;
    color: var(--text-light);
    font-family: monospace, sans-serif;
    min-width: 45px;
    text-align: center;
}

.progress-bar-container {
    flex: 1;
    height: 8px;
    background-color: var(--disabled-bg);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

.dark-theme .progress-bar-container {
    background-color: #3e3e3e;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--primary);
    border-radius: 4px;
    transition: width 0.1s linear;
}

.player-close-btn-modern {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 14px;
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 25px;
}

.player-close-btn-modern:hover {
    background: rgba(179, 157, 219, 0.1);
}

/* Extracted history/account base shadows and padding to the nuclear group below */

.confirm-container {
    background: var(--card-bg);
    width: 90%;
    max-width: 350px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    padding: 35px 25px;
    position: relative;
    text-align: center;
}

.history-container,
.account-settings-container,
.profile-edit-container {
    max-width: 450px;
    width: 90%;
    /* Nuclear Option for Centering to fix native WKWebView layout issues */
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    height: auto !important;
    max-height: 85vh !important;
    /* Slightly less to avoid edge touch */
    overflow-y: auto;
    /* Ensure content is scrollable if tall */
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    padding: 0;
}

.history-header,
.profile-edit-title {
    flex-shrink: 0;
    background: var(--card-bg);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(179, 157, 219, 0.2);
}

.dark-theme .history-header {
    border-bottom-color: #3e3e3e;
}

.profile-edit-title {
    padding: 25px 25px 20px 25px;
}

.modal-body-scrollable {
    flex-grow: 1;
    overflow-y: auto;
    padding: 25px;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
}

.history-container .modal-body-scrollable {
    padding-top: 20px;
}

.profile-edit-container .modal-body-scrollable {
    padding: 0 25px 25px 25px;
}

.account-settings-container .modal-body-scrollable {
    padding-top: 5px;
}


.history-title {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.history-close {
    font-size: 1.8rem;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.history-close:active {
    background: #e2e8f0;
    transform: scale(0.9);
}

/* === NUOVO: Stile Specifico per X Paywall === */
#close-paywall-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.1);
    /* Sfondo leggero per contrasto */
    color: rgba(255, 255, 255, 0.9);
    /* Icona chiara */
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 20;
    /* Assicura che sia sopra l'header */
    transition: background 0.3s ease;
}

#close-paywall-modal:active {
    background: rgba(0, 0, 0, 0.3);
}

.history-section {
    margin-bottom: 30px;
}

.history-section-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

#mood-history-container {
    display: grid;
    gap: 15px;
}

.mood-history-card {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 15px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(179, 157, 219, 0.1);
    transition: transform 0.3s ease;
}

.dark-theme .mood-history-card {
    background: rgba(50, 50, 50, 0.7);
}


.mood-history-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(179, 157, 219, 0.2);
}

.dark-theme .mood-history-card-header {
    border-bottom-color: rgba(126, 87, 194, 0.3);
}

.mood-history-card-emoji {
    font-size: 2.5rem;
}

.mood-history-card-info {
    flex: 1;
}

.mood-history-card-mood-value {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
}

.mood-history-card-mood-value {
    color: var(--text-primary);
}


.mood-history-card-timewindow {
    background: var(--primary-light);
    color: var(--primary-darker);
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    margin-top: 5px;
}

.dark-theme .mood-history-card-timewindow {
    background: rgba(126, 87, 194, 0.3);
    color: var(--primary-light);
}

.mood-history-card-body {
    display: grid;
    gap: 12px;
}

.mood-history-stat {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
}

.mood-history-stat .stat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-light);
    white-space: nowrap;
}

.mood-history-stat .stat-label i {
    width: 16px;
    text-align: center;
}

.mood-history-stat .stat-bar-container {
    background-color: var(--disabled-bg);
    border-radius: 50px;
    height: 8px;
    overflow: hidden;
}

.dark-theme .mood-history-stat .stat-bar-container {
    background-color: #3e3e3e;
}

.mood-history-stat .stat-bar {
    height: 100%;
    border-radius: 50px;
    background-color: var(--primary);
    transition: width 0.5s ease-in-out;
}

.mood-history-stat .anxiety-bar {
    background-color: var(--pastel-anxiety);
}

.mood-history-stat .stress-bar {
    background-color: var(--pastel-stress);
}

.mood-history-stat .stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: right;
    color: var(--text-light);
    min-width: 40px;
}

.mood-history-stat.anxiety-stat .stat-label,
.mood-history-stat.anxiety-stat .stat-value {
    color: var(--pastel-anxiety);
    font-weight: 600;
}

.mood-history-stat.stress-stat .stat-label,
.mood-history-stat.stress-stat .stat-value {
    color: var(--pastel-stress);
    font-weight: 600;
}

.dark-theme .mood-history-stat.anxiety-stat .stat-label,
.dark-theme .mood-history-stat.anxiety-stat .stat-value {
    color: var(--pastel-anxiety);
}

.dark-theme .mood-history-stat.stress-stat .stat-label,
.dark-theme .mood-history-stat.stress-stat .stat-value {
    color: var(--pastel-stress);
}

.calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
}

.calendar-nav-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--primary);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.calendar-nav-btn:active {
    background: rgba(209, 196, 233, 0.3);
    transform: scale(0.95);
}

.calendar-month {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.calendar-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 20px;
}

.calendar-header {
    text-align: center;
    font-weight: 700;
    padding: 8px 0;
    color: var(--primary-dark);
    font-size: 0.9rem;
}

.calendar-day {
    text-align: center;
    padding: 10px 5px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.7);
    position: relative;
    border: 2px solid transparent;
}

.dark-theme .calendar-day {
    background: rgba(50, 50, 50, 0.7);
}

.calendar-day:active {
    background: var(--primary);
    color: white;
}

.calendar-day.active {
    background: var(--primary);
    color: white;
    font-weight: 700;
}

.calendar-day.has-data::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background-color: var(--primary);
    border-radius: 50%;
}

.calendar-day.selected {
    border-color: var(--primary-darker);
}

.profile-edit-title {
    text-align: center;
    margin-bottom: 0;
    color: var(--text-primary);
    font-size: 1.4rem;
}

.emoji-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 12px;
    margin-top: 10px;
    justify-content: center;
    padding: 0;
}

.emoji-option {
    font-size: 1.8rem;
    text-align: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: rgba(209, 196, 233, 0.1);
    border: 2px solid transparent;
}

.dark-theme .emoji-option {
    background: rgba(50, 50, 50, 0.2);
}

.emoji-option.selected {
    transform: scale(1.1);
    background: var(--primary-light);
    border-color: var(--primary);
}

.emoji-option:active {
    transform: scale(0.95);
}

.profile-edit-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.profile-edit-cancel,
.profile-edit-save {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    position: relative;
    min-height: 48px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.profile-edit-cancel {
    background: #f1f5f9;
    color: var(--text);
}

.dark-theme .profile-edit-cancel {
    background: #2d2d2d;
    color: #f5f5f5;
}

.profile-edit-save {
    background: var(--button-bg);
    color: white;
}

.toast {
    position: fixed;
    bottom: calc(120px + env(safe-area-inset-bottom));
    right: calc(15px + env(safe-area-inset-right));
    background: var(--primary-dark);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2100;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s ease;
    max-width: 300px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
    display: flex;
    padding: 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid #f1f5f9;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out, visibility 0.3s;
}

.dark-theme .nav-bar {
    background: rgba(30, 30, 30, 0.9);
    border-top: 1px solid #333;
}

body.keyboard-visible .nav-bar {
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
}

body.keyboard-visible #main-app {
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    position: relative;
}

.dark-theme .nav-item {
    color: #bdbdbd;
}

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

.nav-item.active .nav-indicator {
    width: 70%;
    opacity: 1;
}

.nav-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.nav-indicator {
    position: absolute;
    bottom: 0;
    height: 3px;
    width: 0;
    background: var(--primary);
    border-radius: 2px;
    opacity: 0;
    transition: all 0.3s ease;
}

.dark-theme .nav-item.active .nav-indicator {
    background: var(--primary-darker);
}

.nav-item:active {
    color: var(--primary-darker);
    transform: scale(0.95);
}

.gratitude-form {
    display: grid;
    gap: 12px;
}

.gratitude-input {
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.dark-theme .gratitude-input {
    background: rgba(50, 50, 50, 0.8);
    color: #f5f5f5;
    border-color: #333;
}

.gratitude-input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(209, 196, 233, 0.3);
}

.gratitude-btn {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 10px;
    font-size: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    position: relative;
    min-height: 50px;
    overflow: hidden; /* Contiene lo spinner senza espandere il bottone */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gratitude-btn:active {
    background: var(--primary-darker);
    transform: scale(0.98);
}

.gratitude-btn:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
}

.gratitude-history-item {
    background-color: rgba(209, 196, 233, 0.2);
    border-radius: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.dark-theme .gratitude-history-item {
    background-color: rgba(126, 87, 194, 0.2);
}

.gratitude-history-item:last-child {
    margin-bottom: 0;
}

.gratitude-history-emoji {
    font-size: 1.2rem;
}

.gratitude-history-text {
    font-size: 0.95rem;
    color: var(--text);
    flex: 1;
}

#generate-report-btn {
    display: block;
    margin: 30px auto 30px;
    width: auto;
    padding-left: 30px;
    padding-right: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.profile-header {
    display: flex;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 15px;
}

.profile-emoji {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    border-radius: 50%;
    margin-right: 20px;
    box-shadow: var(--shadow);
}

.dark-theme .profile-emoji {
    background: var(--primary-dark);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.profile-welcome {
    color: var(--text-light);
    font-size: 1rem;
}

.dark-theme .profile-welcome {
    color: var(--text-light);
}

.profile-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 16px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.profile-item:active {
    transform: translateY(0);
    background: rgba(209, 196, 233, 0.2);
}

.dark-theme .profile-item:active {
    background: rgba(126, 87, 194, 0.15);
}

.profile-icon {
    font-size: 1.6rem;
    color: var(--primary);
    width: 40px;
    text-align: center;
    margin-right: 15px;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-text {
    font-weight: 600;
    color: var(--text-primary);
}

.goal-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.goal-input-container {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.goal-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.dark-theme .goal-input {
    background: rgba(50, 50, 50, 0.8);
    color: #f5f5f5;
    border-color: #333;
}

.goal-btn {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

.goal-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-light);
}

.dark-theme .goal-item {
    background: rgba(50, 50, 50, 0.9);
}

.goal-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-light);
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.goal-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.goal-text {
    flex: 1;
    font-size: 1rem;
    color: var(--text);
    word-break: break-word;
    min-width: 0;
    text-decoration: none;
}

.goal-text.completed {
    text-decoration: line-through;
    color: var(--text-light);
}


.dark-theme .goal-text {
    color: var(--text);
}

.dark-theme .goal-text.completed {
    color: var(--text-light);
}

.goal-status {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: right;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding-left: 8px;
}

.goal-history-item {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.goal-history-icon {
    font-size: 1.2rem;
    margin-right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.goal-history-icon.completed {
    background: var(--success);
    color: white;
}

.goal-history-icon.not-completed {
    background: var(--error);
    color: white;
}

.app-name {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-weight: 700;
}

.app-tagline {
    color: var(--text-light);
    font-size: 1rem;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 15px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    color: white;
    position: relative;
    min-height: 54px;
    width: 100%;
    background: var(--button-bg);
    box-shadow: 0 4px 18px rgba(126, 87, 194, 0.25);
}

.login-btn:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.75;
}

.login-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(126, 87, 194, 0.35);
}

.login-btn:not(:disabled):active {
    transform: translateY(0);
}

.registration-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
}

.form-input {
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: var(--background);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.dark-theme .form-input {
    background: #333;
    border-color: #444;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.2);
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.checkbox-container input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.checkbox-container a {
    color: var(--primary-dark);
}

.login-btn.register {
    background: var(--button-bg);
    margin-top: 10px;
}

.login-btn.register:disabled {
    background: var(--disabled-bg);
    color: var(--disabled-text);
    cursor: not-allowed;
}

/* V5.7: Stile Outline per pulsanti secondari (es. Safety Modal) */
.login-btn.outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    box-shadow: none;
}

.login-btn.outline:active {
    background: rgba(179, 157, 219, 0.1);
    transform: scale(0.98);
}

.toggle-form-link {
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: center;
}

.toggle-form-link a {
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.password-feedback {
    margin-top: 10px;
    font-size: 0.85rem;
}

.password-feedback ul {
    list-style-type: none;
    padding: 0;
}

.password-feedback li {
    color: var(--error);
    transition: color 0.3s ease;
}

.password-feedback li.valid {
    color: var(--success);
    text-decoration: line-through;
}

.filter-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.select-wrapper {
    position: relative;
    width: 100%;
    max-width: 300px;
}

#theme-select {
    width: 100%;
    padding: 12px 20px;
    padding-right: 40px;
    border-radius: 50px;
    background-color: var(--card-bg);
    border: 1px solid rgba(179, 157, 219, 0.3);
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.dark-theme #theme-select {
    background-color: #2a2530;
    color: var(--text);
    border-color: rgba(126, 87, 194, 0.4);
}

#theme-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.2);
}

.select-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
    font-size: 0.9rem;
}



.intention-banner {
    background: linear-gradient(135deg, rgba(179, 157, 219, 0.15), rgba(126, 87, 194, 0.15));
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(179, 157, 219, 0.2);
    box-shadow: 0 6px 16px rgba(126, 87, 194, 0.1);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.intention-banner::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    z-index: 0;
}

.intention-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    color: var(--primary-dark);
    animation: pulse 2s infinite;
}

.dark-theme .intention-icon {
    color: var(--primary);
}


.intention-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.intention-text {
    font-size: 1.2rem;
    font-weight: 500;
    font-style: italic;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    color: var(--text);
    line-height: 1.6;
    min-height: 50px;
    position: relative;
}

.dark-theme .intention-text {
    color: var(--text);
}

.edit-intention-btn {
    position: absolute;
    right: 15px;
    top: 0;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-light);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.intention-btn {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 14px 30px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(126, 87, 194, 0.3);
    display: block;
    margin: 0 auto;
    min-height: 48px;
    flex-shrink: 0;
}

.intention-input {
    padding: 14px 20px;
    border: 1px solid var(--primary-light);
    border-radius: 50px;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.8);
    width: 100%;
    margin-bottom: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(126, 87, 194, 0.1);
}

.intention-input:focus {
    outline: none;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(126, 87, 194, 0.2);
}

.dark-theme .intention-input {
    background: rgba(50, 50, 50, 0.8);
    color: #f5f5f5;
    border-color: #333;
}

.daily-data-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.daily-data-item {
    background: rgba(209, 196, 233, 0.15);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.dark-theme .daily-data-item {
    background: rgba(126, 87, 194, 0.12);
}

.daily-data-value {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 5px 0;
    color: var(--primary);
}

.daily-data-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

@media (min-width: 768px) {
    .container {
        max-width: 750px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .daily-card {
        height: 250px;
    }

    .nav-bar {
        padding: 15px 0;
    }

    .goal-input-container {
        flex-direction: row;
    }

    .profile-header {
        flex-direction: row;
        text-align: left;
    }

    .profile-emoji {
        margin-right: 20px;
        margin-bottom: 0;
    }

    .emoji-picker {
        grid-template-columns: repeat(6, 1fr);
        gap: 15px;
        padding: 0;
    }

    .emoji-option {
        font-size: 1.8rem;
    }

    .mood-tracker-hint {
        display: none;
    }
}

@media (max-width: 768px) {
    .calendar-header {
        font-size: 0.8rem;
        padding: 5px 0;
    }

    .calendar-day {
        padding: 8px 3px;
        font-size: 0.8rem;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-emoji {
        margin-right: 0;
        margin-bottom: 15px;
    }
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-left: auto;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--primary-darker);
}

input:checked+.toggle-slider:before {
    transform: translateX(26px);
}

.review-message {
    text-align: center;
    margin-top: 15px;
    color: var(--success);
    font-weight: 600;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.floating {
    animation: float 4s ease-in-out infinite;
}

@keyframes loading-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

.pulse {
    animation: pulse 3s ease-in-out infinite;
}





.time-range {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.time-input {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    width: 100%;
    text-align: center;
    color: var(--text);
}

.dark-theme .time-input {
    background: rgba(50, 50, 50, 0.8);
    color: #f5f5f5;
    border-color: #333;
}

.logout-btn {
    background: rgba(239, 83, 80, 0.1) !important;
}

.logout-btn .profile-text {
    color: var(--error) !important;
}

.logout-btn .profile-icon {
    color: var(--error) !important;
}

#onboarding-login-modal {
    z-index: 3000;
}



.report-content {
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark-theme .report-content {
    background: #2d2d2d;
}

.report-header {
    text-align: center;
    margin-bottom: 20px;
}

.report-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.report-period {
    color: var(--text-light);
    font-size: 1rem;
}

.report-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.report-stat {
    background: rgba(209, 196, 233, 0.1);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(179, 157, 219, 0.2);
}

.dark-theme .report-stat {
    background: rgba(50, 50, 50, 0.2);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 5px 0;
    color: var(--primary);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.report-chart-area {
    display: flex;
    height: 250px;
    margin: 20px 0;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 20px 10px 30px 10px;
}

.dark-theme .report-chart-area {
    background: #2d2d2d;
    border-color: #3e3e3e;
}

.chart-yaxis {
    display: none;
}

.report-chart {
    flex-grow: 1;
    position: relative;
}

.chart-grid-line {
    display: none;
}

.dark-theme .chart-grid-line {
    background-color: rgba(255, 255, 255, 0.08);
}

.chart-group {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    width: 100%;
    height: 100%;
    align-items: end;
    position: relative;
    z-index: 1;
}

.chart-day-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bars {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 3px;
    height: 100%;
    width: 100%;
}

.chart-bar {
    flex: 1;
    max-width: 15px;
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: height 0.5s ease-in-out, background-color 0.3s ease;
    cursor: pointer;
}

.mood-bar {
    background: var(--primary);
}

.anxiety-bar {
    background: var(--warning);
}

.stress-bar {
    background: var(--error);
}

.sleep-bar {
    background: var(--calm-1);
}

.chart-label {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-light);
    text-align: center;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

.report-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.report-btn {
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--button-bg);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.report-btn:active {
    transform: translateY(0);
}

.sleep-container {
    padding: 15px 0;
}

.sleep-slider {
    margin: 15px 0;
}

.sleep-value {
    text-align: center;
    font-size: 1.5rem;
    margin: 10px 0;
    font-weight: bold;
    color: var(--primary);
}

.sounds-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.sound-item {
    background: rgba(209, 196, 233, 0.1);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 1px solid rgba(179, 157, 219, 0.2);
    transition: all 0.3s ease;
}

.sound-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.sound-title {
    font-weight: 600;
    margin-bottom: 5px;
}

.sound-duration {
    font-size: 0.85rem;
    color: var(--text-light);
}

.sound-player {
    width: 100%;
    margin-top: 10px;
}

.sound-item.active {
    background: rgba(179, 157, 219, 0.2);
    border-color: var(--primary);
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #D3bbff;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-logo {
    width: 100px;
    height: 100px;
    animation: loading-pulse 2s ease-in-out infinite;
    border-radius: 22.5%;
}

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

.account-settings-content {
    display: flex;
    flex-direction: column;
}

.account-settings-item {
    display: flex;
    align-items: center;
    padding: 18px 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(179, 157, 219, 0.2);
    transition: background-color 0.3s ease;
}

.account-settings-item:last-child {
    border-bottom: none;
}

.dark-theme .account-settings-item {
    border-bottom-color: #3e3e3e;
}

.account-settings-icon {
    font-size: 1.2rem;
    color: var(--primary);
    width: 40px;
    text-align: center;
    margin-right: 15px;
}

.account-settings-text {
    font-weight: 600;
    color: var(--text);
}

.dark-theme .account-settings-text {
    color: var(--text-light);
}

/* Dark mode per Condivisione Professionista */
.dark-theme .sharing-section {
    background: rgba(0, 151, 167, 0.1) !important;
    border-color: rgba(0, 151, 167, 0.3) !important;
}

.dark-theme .sharing-section .account-settings-icon {
    background: rgba(0, 151, 167, 0.2) !important;
}

.dark-theme .sharing-section .account-settings-text {
    color: #4DD0E1 !important;
}

.dark-theme .sharing-section .gratitude-btn {
    opacity: 1 !important;
    background: rgba(0, 151, 167, 0.25) !important;
    color: #4DD0E1 !important;
}

.account-settings-item.delete-btn .account-settings-icon,
.account-settings-item.delete-btn .account-settings-text {
    color: var(--error);
}

.medals-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.medal {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    cursor: help;
}

.medal-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e0e0e0;
    color: #9e9e9e;
    font-size: 1.8rem;
    margin-bottom: 8px;
    transition: all 0.4s ease;
    filter: blur(2px);
    opacity: 0.7;
    transform: translateZ(0);
}

.medal-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
}

.medal.unlocked .medal-icon-wrapper {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: white;
    filter: blur(0);
    opacity: 1;
    box-shadow: 0 4px 10px rgba(255, 160, 0, 0.4);
}

.medal.unlocked .medal-name {
    color: var(--text);
}

.dark-theme .medal-icon-wrapper {
    background-color: #333;
    color: #666;
}

.dark-theme .medal.unlocked .medal-name {
    color: var(--text);
}

.medal-unlock-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 380px;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--primary-light);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    margin-top: env(safe-area-inset-top);
    margin-bottom: env(safe-area-inset-bottom);
}

.medal-unlock-modal.active .medal-unlock-container {
    transform: scale(1);
}

.medal-unlock-header {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.medal-unlock-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 15px auto;
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 160, 0, 0.5);
    animation: float 3s ease-in-out infinite;
}

.medal-unlock-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 15px 0 10px;
    color: var(--text);
}

.medal-unlock-text {
    color: var(--text-light);
    margin-bottom: 25px;
}

.medal-unlock-close {
    background: var(--button-bg);
    color: white;
    border: none;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success-feedback {
    background: var(--success) !important;
    transition: background-color 0.3s ease;
}

.btn-success-feedback .fas {
    display: inline-block;
    animation: check-pop 0.4s ease-out;
    color: white;
}

@keyframes check-pop {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    70% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.new-item-feedback {
    animation: new-item-pop-in 0.5s ease-out;
}

@keyframes new-item-pop-in {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.btn-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@media (max-width: 380px) {
    .toggle-option#yearly-toggle {
        flex-direction: column;
        gap: 2px;
        padding: 8px 5px;
        white-space: normal;
        line-height: 1.2;
        font-size: 0.9rem;
    }

    .toggle-option#yearly-toggle .discount-badge {
        font-size: 0.7rem;
        margin-left: 0;
    }
}

.forgot-password-link {
    text-align: right;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.forgot-password-link a {
    color: var(--text-light);
    text-decoration: none;
}

.auth-description {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.auth-disclaimer {
    font-size: 0.85rem;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background-color: rgba(209, 196, 233, 0.2);
    border-radius: 8px;
    line-height: 1.5;
}

.dark-theme .auth-disclaimer {
    background-color: rgba(126, 87, 194, 0.2);
}

.error-message {
    display: none;
    color: var(--error);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-top: 5px;
    margin-bottom: 10px;
}

#email-confirmation-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
    gap: 15px;
}

.email-confirm-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 10px;
    animation: float 4s ease-in-out infinite;
}

#email-confirmation-view .auth-description {
    line-height: 1.7;
    margin-bottom: 10px;
}

#email-confirmation-view .login-btn {
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
    margin-bottom: 0;
}

#back-to-login-from-confirm-link {
    background: var(--filter-bg-light);
    color: var(--text-primary);
}

.dark-theme #back-to-login-from-confirm-link {
    background: var(--toggle-bg-dark);
    color: var(--text);
}

.auth-container>div[id] {
    animation: fadeIn 0.5s ease-out;
    width: 100%;
}

#welcome-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 0;
}

#welcome-view .auth-title {
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 10px;
}

.welcome-animation-container {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.welcome-logo {
    width: 120px;
    height: 120px;
    border-radius: 22.5%;
    box-shadow: 0 10px 30px rgba(94, 53, 177, 0.2);
}

.welcome-tagline {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-top: 0;
    margin-bottom: 25px;
}

#browser-install-prompt {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 10px;
    padding: 5px 10px;
    background: rgba(209, 196, 233, 0.2);
    border-radius: 8px;
}

.welcome-button-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

#show-register-from-welcome {
    background: var(--button-bg);
}

#show-login-from-welcome {
    background: var(--filter-bg-light);
    color: var(--text-primary);
}

#show-register-from-welcome:active,
#show-login-from-welcome:active {
    transform: scale(0.98);
}

.floating-emoji {
    position: absolute;
    font-size: 1.8rem;
    opacity: 0.8;
}

.floating-emoji.emoji-1 {
    font-size: 2.5rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.1;
}

.floating-emoji.emoji-2 {
    top: 10px;
    right: 0;
}

.floating-emoji.emoji-3 {
    top: 10px;
    left: 0;
}

.floating-emoji.emoji-4 {
    top: 50%;
    left: -20px;
    transform: translateY(-50%);
}

.floating-emoji.emoji-5 {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.floating-emoji.emoji-6 {
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
}

.floating-emoji.emoji-7 {
    bottom: 10px;
    right: 0;
}

.floating-emoji.emoji-8 {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.floating-emoji.emoji-9 {
    bottom: 10px;
    left: 0;
}

.share-quote-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(5px);
}

.share-quote-btn:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

#quote-share-container-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    z-index: -100;
    pointer-events: none;
    background: transparent;
}

#quote-share-container {
    width: 1080px;
    height: 1080px;
    position: relative;
    overflow: hidden;
    background-color: #1e1e1e;
    /* Fallback */
    font-family: 'Inter', 'Nunito', system-ui, sans-serif;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#quote-share-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.quote-share-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.8) 100%);
    z-index: 2;
}

.quote-share-content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 100px;
    text-align: center;
}

.quote-share-icon {
    font-size: 80px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 40px;
}

#quote-share-text {
    font-size: 64px;
    font-weight: 700;
    line-height: 1.4;
    color: #ffffff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quote-share-footer {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-top: 60px;
}

#quote-share-logo {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.quote-share-handle {
    font-size: 42px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* =========================================
   AETON EVOLUTION v3.0 - NEW STYLES
   ========================================= */

/* --- Diario di Riflessione --- */
.reflection-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reflection-textarea {
    width: 100%;
    border: 1px solid rgba(179, 157, 219, 0.3);
    border-radius: 12px;
    padding: 12px;
    font-size: 0.95rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.5);
    resize: none;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: 1.5;
}

.reflection-textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(179, 157, 219, 0.2);
}

.dark-theme .reflection-textarea {
    background: rgba(40, 40, 40, 0.5);
    border-color: rgba(126, 87, 194, 0.4);
    color: var(--text);
}

.dark-theme .reflection-textarea:focus {
    background: rgba(50, 50, 50, 0.8);
}

/* --- Dashboard Professionista --- */
.pro-users-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.pro-user-item {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(179, 157, 219, 0.2);
}

.pro-user-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.pro-user-avatar {
    width: 50px;
    height: 50px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.pro-user-info {
    flex: 1;
}

.pro-user-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.pro-user-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 2px;
}

.goal-input-container {
    display: flex;
    gap: 10px;
}

.goal-input {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(179, 157, 219, 0.3);
    background: var(--background);
    color: var(--text);
}



/* Stile per i dati Read-Only */
.readonly-reflection-card {
    background: rgba(179, 157, 219, 0.1);
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.readonly-date {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 5px;
    display: block;
}

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

.readonly-label {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--primary-dark);
    margin-right: 5px;
}

/* --- Safety & Sharing (V4) --- */
.risk-dot {
    width: 10px;
    height: 10px;
    background-color: #ef5350;
    border-radius: 50%;
    display: inline-block;
    vertical-align: text-bottom;
    margin-left: 8px;
    margin-bottom: 2px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 4px #ef5350;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 83, 80, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 83, 80, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 83, 80, 0);
    }
}

.reflection-item.risk-flagged {
    border-left: 4px solid #ef5350 !important;
    background: rgba(239, 83, 80, 0.05);
}

#revoke-sharing-btn {
    background-color: #ef5350;
    color: white;
    font-weight: 600;
}

#save-sharing-btn:disabled,
#save-sharing-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #bdbdbd;
}

/* Fix Reflection Button Success State */
#save-reflection-btn.btn-success-feedback {
    background-color: var(--success) !important;
    color: white;
    border-color: var(--success) !important;
    border-radius: 12px;
    /* Match standard pill shape if needed, verify */
}

/* V5.6 Fix: Use theme variables for exact match with Check-in button */
#save-reflection-btn:disabled,
#save-reflection-btn[disabled] {
    background-color: var(--disabled-bg) !important;
    color: var(--disabled-text) !important;
    opacity: 1 !important;
    border-color: var(--disabled-bg) !important;
    cursor: not-allowed;
    box-shadow: none;
}


.pathway-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.pathway-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(179, 157, 219, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pathway-item:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.8);
}

.pathway-item.completed {
    background: rgba(232, 245, 233, 0.8);
    border-color: #a5d6a7;
}


/* 1. Therapist Focus Card */
.active-focus-card {
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    border: none;
    border-left: 5px solid #1976D2 !important;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(25, 118, 210, 0.15);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    margin-bottom: 25px;
}

.active-focus-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(25, 118, 210, 0.25);
}

.active-focus-card::after {
    content: '"';
    position: absolute;
    top: -20px;
    right: 20px;
    font-size: 8rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: serif;
    pointer-events: none;
}

#therapist-focus-text {
    font-size: 1.15rem;
    font-weight: 600;
    color: #0D47A1;
    line-height: 1.6;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    position: relative;
    z-index: 2;
}

/* 2. Pathway Checklist */
.pathway-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pathway-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.pathway-item:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.pathway-item.completed {
    background: linear-gradient(to right, rgba(102, 187, 106, 0.05), transparent);
    border-color: rgba(102, 187, 106, 0.2);
}

.pathway-item .goal-checkbox {
    width: 28px;
    height: 28px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    margin-right: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: white;
    flex-shrink: 0;
}

.pathway-item.completed .goal-checkbox {
    background: #66BB6A;
    border-color: #66BB6A;
    transform: scale(1.1) rotate(5deg);
}

.pathway-item .goal-text {
    font-size: 1.05rem;
    color: var(--text);
    font-weight: 500;
    transition: color 0.3s ease;
}

.pathway-item.completed .goal-text {
    color: #81C784;
    text-decoration: line-through;
    opacity: 0.8;
}

/* Dark Theme Adjustments */
body.dark-theme .pathway-item {
    background: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .pathway-item:hover {
    background: #2a2a2a;
}

body.dark-theme .pathway-item .goal-checkbox {
    background: #333;
    border-color: #555;
}

body.dark-theme .active-focus-card {
    background: linear-gradient(135deg, #1A237E 0%, #0D47A1 100%);
    border-left-color: #64B5F6 !important;
}

body.dark-theme #therapist-focus-text {
    color: #E3F2FD;
}

/* 3. Pro Dashboard List */
.pro-users-list .goal-item {
    padding: 15px;
    border-radius: 12px;
    background: var(--card-bg);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    transition: background 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow);
}

body.dark-theme .pro-users-list .goal-item {
    border-color: rgba(255, 255, 255, 0.1);
}

.pro-users-list .goal-item:hover {
    background: var(--background);
}

/* E2EE Styles */
.security-warning-box {
    background: #FFF3E0;
    border: 1px solid #FFB74D;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #E65100;
    font-size: 0.9rem;
    line-height: 1.5;
}

.security-warning-box i {
    font-size: 1.2rem;
    margin-top: 2px;
}

.mnemonic-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 16px;
    border: 1px dashed var(--primary);
}

.mnemonic-word {
    background: #fff;
    padding: 8px 5px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.95rem;
    color: #444;
    border: 1px solid #e0e0e0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.word-index {
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 2px;
    font-weight: bold;
    user-select: none;
}

.loading-spinner-container {
    display: flex;
    justify-content: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(179, 157, 219, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* ===================================
   PROMO BANNER (Advertiser Network)
   =================================== */

.promo-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
    animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    color: white;
}

.promo-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.promo-logo {
    width: auto;
    height: 40px;
    max-width: 80px;
    /* Prevent it from being too wide */
    border-radius: 8px;
    object-fit: contain;
    background: transparent;
}

.promo-advertiser {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
}

.promo-content h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.promo-content p {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 12px;
    line-height: 1.4;
}

.promo-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promo-close:hover,
.promo-close:active {
    background: rgba(255, 255, 255, 0.3);
}

.promo-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    color: #667eea;
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    margin-top: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.promo-cta:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.offline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Sfondo in linea con il tema (Glassmorphism su sfondo sfocato) */
    background: rgba(245, 245, 245, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
    padding: 20px;
}

body.dark-theme .offline-overlay {
    background: rgba(18, 18, 18, 0.6);
}

.offline-content {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px 30px;
    max-width: 350px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(94, 53, 177, 0.15);
    /* Ombra viola leggera */
    border: 1px solid rgba(179, 157, 219, 0.3);
    animation: slideInUp 0.4s ease-out;
}

.offline-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--primary);
    /* Viola AETON */
    position: relative;
    display: inline-block;
}

.offline-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    background: var(--primary);
    filter: blur(20px);
    opacity: 0.2;
    transform: translate(-50%, -50%);
    z-index: -1;
    border-radius: 50%;
}

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

.offline-message {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 30px;
    line-height: 1.5;
}

.offline-retry-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 15px 35px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(94, 53, 177, 0.3);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.offline-retry-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(94, 53, 177, 0.2);
}

/* ===== PATIENT VIEW ACCORDION STYLES ===== */

/* Patient Section Container */
.patient-section {
    margin-bottom: 20px;
}

.patient-section-fixed {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

/* Accordion Styles */
.patient-accordion {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.accordion-header:hover {
    background: #f9f9f9;
}

.accordion-chevron {
    font-size: 1.2rem;
    color: #999;
    transition: transform 0.3s ease;
}

.patient-accordion[data-open="true"] .accordion-chevron {
    transform: rotate(90deg);
}

.accordion-content {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.25s ease-in;
}

.patient-accordion[data-open="true"] .accordion-content {
    max-height: 2000px;
    padding: 0 20px 20px 20px;
    opacity: 1;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.35s ease-out 0.1s;
}

/* Reflection Info Box */
.reflection-info-box {
    background: #f0f4ff;
    border-left: 4px solid #7E57C2;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
}

.reflection-info-box i {
    color: #7E57C2;
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 3px;
}

.reflection-info-box ol {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.reflection-info-box li {
    margin: 5px 0;
    color: #555;
}

.dark-theme .reflection-info-box {
    background: rgba(126, 87, 194, 0.1);
}

.dark-theme .reflection-info-box li {
    color: var(--text-light);
}

/* Toggle Switch for Diary - STANDARD WORKING VERSION */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Diary Status Badge */
.diary-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f0f0f0;
    color: #999;
    transition: all 0.3s ease;
}

.diary-status-badge.active {
    background: #e8f5e9;
    color: #4CAF50;
}

.diary-status-badge i {
    font-size: 0.5rem;
}

.diary-status-badge.active i {
    color: #4CAF50;
}

/* Accessibility Focus Styles */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.nav-item:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: -2px;
}

/* ========================================================= */
/* PRO DASHBOARD REDESIGN (MASONRY & CARDS)                  */
/* ========================================================= */

.pro-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 15px;
    padding-bottom: 40px;
}

.pro-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
}

/* Span the focus clinical across the top if needed, or let it flow naturally */
.pro-card-focus {
    grid-column: 1 / -1;
}

/* Span the chart across more columns if space permits */
.pro-card-stats {
    grid-column: 1 / -1;
}

@media (min-width: 1024px) {
    .pro-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pro-card-focus {
        grid-column: 1 / -1;
    }

    .pro-card-stats {
        grid-column: 1 / -1;
    }
}

/* Alert badges for patient triage */
.pro-status-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 82, 82, 0.1);
    color: #ff5252;
    font-size: 0.8rem;
    margin-left: 10px;
    animation: pulseAlert 2s infinite;
}

.pro-status-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
    font-size: 0.85rem;
    margin-left: 10px;
}

@keyframes pulseAlert {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(255, 82, 82, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 82, 82, 0);
    }
}

@media (max-width: 480px) {
    .confirm-container {
        width: 95%;
        padding: 25px 15px;
    }

    .player-container {
        width: 95%;
        /* padding rimosso per garantire l'aderenza dell'header viola */
    }

    .player-body {
        padding: 20px 15px;
    }

    .player-close-btn-modern {
        padding: 18px;
        font-size: 1.1rem;
        margin-top: 20px;
        border-radius: 14px;
    }
}

/* --- RESPIRAZIONE GUIDATA (Component Styles — Cream Theme) --- */

/* ═══ Breathing card trigger ═══ */
#breathing-card-trigger {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* ═══ Breathing Modal ═══ */
.breathing-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 9999;
    background: linear-gradient(160deg, #f0e8ff 0%, #e5d5ff 40%, #dac8ff 100%);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.breathing-close-btn {
    position: absolute;
    top: calc(env(safe-area-inset-top, 24px) + 24px);
    /* Aumentato fallback per evitare sovrapposizioni notch */
    right: 24px;
    z-index: 100;
    background: rgba(94, 53, 177, 0.08);
    border: none;
    color: var(--primary-dark);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══ Screens ═══ */
.breathing-screen {
    position: absolute;
    inset: 0;
}

.breathing-settings {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px 20px;
    padding-top: calc(env(safe-area-inset-top, 12px) + 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.breathing-settings-inner {
    max-width: 400px;
    width: 100%;
}

.breathing-subtitle {
    color: var(--primary-dark);
    font-size: 0.9rem;
    margin-bottom: 28px;
    opacity: 0.7;
}

/* Titolo respirazione — coerente con app */
.breathing-settings .breathing-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.breathing-field {
    margin-bottom: 22px;
}

.breathing-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.breathing-range-val {
    font-weight: 700;
    min-width: 45px;
    text-align: right;
    color: var(--primary-dark);
    font-size: 1rem;
}

/* ═══ Slider ═══ */
input[type="range"].breathing-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    background: var(--primary-light);
    border-radius: 3px;
    outline: none;
    transition: background 0.3s ease;
}

input[type="range"].breathing-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--primary-dark);
    cursor: grab;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(94, 53, 177, 0.3);
}

/* ═══ Select ═══ */
select.breathing-select {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    padding: 14px 20px;
    background-color: var(--background);
    border: 1px solid var(--primary-light);
    border-radius: 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%235E35B1%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px top 50%;
    background-size: 10px auto;
}

select.breathing-select option {
    background: var(--card-bg);
    color: var(--text);
}

/* ═══ Buttons ═══ */
.breathing-btn {
    background: var(--primary-dark);
    color: white;
    border: none;
    padding: 16px 30px;
    border-radius: 16px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(94, 53, 177, 0.25);
    width: 100%;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.breathing-btn:active {
    transform: scale(0.97);
}

.breathing-btn-outline {
    background: rgba(94, 53, 177, 0.08);
    color: var(--primary-dark);
    border: 1px solid rgba(94, 53, 177, 0.2);
    padding: 12px 30px;
    border-radius: 35px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.3s ease;
}

.breathing-btn-outline:active {
    background: rgba(94, 53, 177, 0.15);
}

/* ═══ Animation screen ═══ */
.breathing-anim {
    display: none;
    justify-content: center;
    align-items: center;
}

.breathing-ball {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, #D3BBFF 55%, rgba(211, 187, 255, 0) 100%);
    border-radius: 50%;
    transform: scale(0.21);
    will-change: transform;
}

.breathing-text {
    position: absolute;
    bottom: 18%;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    opacity: 0;
    transition: opacity 0.5s ease;
    letter-spacing: 2px;
    text-transform: lowercase;
}

.breathing-stop-btn {
    position: absolute;
    bottom: calc(env(safe-area-inset-bottom, 20px) + 30px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

/* ═══ Ball idle animation ═══ */
@keyframes breathing-idle {

    0%,
    100% {
        transform: scale(0.21);
    }

    50% {
        transform: scale(0.25);
    }
}

#breathing-ball {
    animation: breathing-idle 3s ease-in-out infinite;
}

#breathing-ball.breathing-active {
    animation: none;
    transition: transform 3s cubic-bezier(0.65, 0, 0.35, 1);
}

/* ═══ Dark Theme – Breathing Modal ═══ */
.dark-theme .breathing-modal {
    background: var(--card-bg);
}

.dark-theme .breathing-close-btn {
    background: rgba(126, 87, 194, 0.15);
    color: var(--primary);
}

.dark-theme .breathing-subtitle {
    color: var(--text-light);
}

.dark-theme .breathing-range-val {
    color: var(--primary);
}

.dark-theme input[type="range"].breathing-slider {
    background: rgba(126, 87, 194, 0.2);
}

.dark-theme input[type="range"].breathing-slider::-webkit-slider-thumb {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(126, 87, 194, 0.5);
}

.dark-theme select.breathing-select {
    background-color: rgba(126, 87, 194, 0.1);
    border-color: rgba(126, 87, 194, 0.25);
    color: var(--text);
}

.dark-theme select.breathing-select option {
    background: var(--card-bg);
    color: var(--text);
}

.dark-theme .breathing-btn {
    background: var(--primary);
}

.dark-theme .breathing-btn-outline {
    background: rgba(126, 87, 194, 0.1);
    color: var(--primary);
    border-color: rgba(126, 87, 194, 0.3);
}

.dark-theme .breathing-text {
    color: var(--primary);
}

/* =========================================================================
   ONBOARDING AETON (PWA Premium Story-Carousel)
   ========================================================================= */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85);
    /* Light glassmorphism */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

body.dark-theme .onboarding-overlay {
    background: rgba(30, 30, 46, 0.85);
}

.onboarding-fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Header & Progress (Instagram Stories Style) */
.onboarding-header {
    display: flex;
    gap: 8px;
    padding: 20px 24px;
    padding-top: max(20px, env(safe-area-inset-top));
    width: 100%;
    z-index: 10001;
}

.onboarding-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

body.dark-theme .onboarding-progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

.onboarding-progress-bar .fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.onboarding-progress-bar.completed .fill {
    width: 100%;
}

.onboarding-progress-bar.active .fill {
    width: 100%;
}

/* Viewport & Track */
.onboarding-viewport {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
    /* Nasconde ciò che non è visibile */
}

.onboarding-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    /* Apple-like swipe */
}

.onboarding-slide {
    min-width: 100vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 30px;
    text-align: center;
    box-sizing: border-box;
}

.onboarding-avatar {
    width: 200px;
    height: 200px;
    object-fit: contain;
    margin-bottom: 30px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1));
    animation: float-avatar 6s ease-in-out infinite;
}

.onboarding-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-alt));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(126, 87, 194, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.dark-theme .onboarding-icon {
    background: linear-gradient(135deg, var(--card-bg), #2A2A3E);
    border-color: rgba(255, 255, 255, 0.05);
}

.onboarding-text-content {
    max-width: 400px;
}

.onboarding-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.onboarding-desc {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-muted);
    font-weight: 500;
}

/* Footer Buttons */
.onboarding-footer {
    padding: 24px;
    padding-bottom: calc(50px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    z-index: 10001;
    position: absolute;
    bottom: 0;
}

.onboarding-prev-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 600;
    padding: 12px 20px;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}

.onboarding-prev-btn:active {
    opacity: 0.6;
}

.onboarding-next-btn {
    padding: 16px 36px !important;
    font-size: 16px !important;
    border-radius: 50px !important;
    flex: none !important;
    min-width: 140px;
}

@keyframes float-avatar {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* =========================================
   MAINTENANCE SCREEN (Premium & Calm Theme)
   ========================================= */
#maintenance-screen,
#terms-update-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Gradiente pastello AETON — coerente con schermate bloccanti */
    background: linear-gradient(160deg, #ede0ff 0%, #ddd0f8 40%, #d3bbff 100%);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

#maintenance-screen .maintenance-orbs,
#terms-update-screen .maintenance-orbs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.5;
    pointer-events: none;
}

/* auth-container dentro schermate bloccanti: deve stare sopra le orbs */
#maintenance-screen .auth-container,
#terms-update-screen .auth-container {
    position: relative;
    z-index: 1;
}

/* Reusing .glass-effect from the main app, adding local tweaks if needed */
.maintenance-content {
    background: rgba(var(--card-bg-rgb, 255, 255, 255), 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 32px;
    padding: 50px 30px;
    text-align: center;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
    /* Soft, airy shadow */
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: authFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Dark mode adjustment for the glass card */
[data-theme="dark"] .maintenance-content {
    background: rgba(30, 30, 40, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.maintenance-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb, 126, 87, 194), 0.1), rgba(var(--primary-color-rgb, 126, 87, 194), 0.25));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
    color: var(--primary-color);
    font-size: 2.5rem;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
    /* Inner glow */
}

[data-theme="dark"] .maintenance-icon-wrapper {
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.maintenance-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.maintenance-divider {
    width: 40px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 10px;
    margin: 15px auto 25px auto;
    opacity: 0.3;
}

.maintenance-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: 500;
}

/* Minimal Pulse Loader */
.maintenance-loader {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
    padding: 10px 20px;
    border-radius: 50px;
}

[data-theme="dark"] .maintenance-loader {
    background: rgba(255, 255, 255, 0.05);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background-color: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb, 126, 87, 194), 0.7);
    animation: maintenancePulse 1.5s infinite cubic-bezier(0.66, 0, 0, 1);
}

.maintenance-loader span {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 700;
}

@keyframes maintenancePulse {
    to {
        box-shadow: 0 0 0 15px rgba(var(--primary-color-rgb, 126, 87, 194), 0);
    }
}

/* =========================================
   SYSTEM MODAL ICON (Termini, Novità, etc.)
   ========================================= */
.system-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary, #7E57C2), #5c35a8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(126, 87, 194, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* =========================================
   AETON CUSTOM CHECKBOXES (Modali sistema)
   ========================================= */
.aeton-checkbox-row {
    margin-bottom: 14px;
}

.aeton-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.aeton-checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.aeton-checkbox-custom {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    border: 2px solid rgba(126, 87, 194, 0.35);
    background: rgba(126, 87, 194, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.aeton-checkbox-custom i {
    font-size: 0.75rem;
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
}

.aeton-checkbox-input:checked + .aeton-checkbox-custom {
    background: linear-gradient(135deg, var(--primary, #7E57C2), #5c35a8);
    border-color: var(--primary, #7E57C2);
    box-shadow: 0 4px 12px rgba(126, 87, 194, 0.3);
}

.aeton-checkbox-input:checked + .aeton-checkbox-custom i {
    opacity: 1;
    transform: scale(1);
}

.aeton-checkbox-text {
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-color, #333);
}

/* =========================================
   BREATHING BALL — Premium 3D Glow
   ========================================= */
.breathing-ball {
    width: 280px;
    height: 280px;
    background:
        radial-gradient(circle at 35% 32%, rgba(255,255,255,0.55) 0%, transparent 48%),
        radial-gradient(circle, #c8aaff 0%, #9c6fff 50%, #7c4dff 100%);
    border-radius: 50%;
    transform: scale(0.21);
    will-change: transform;
    box-shadow:
        0 0 60px rgba(156, 111, 255, 0.45),
        0 0 120px rgba(156, 111, 255, 0.2),
        inset 0 2px 10px rgba(255, 255, 255, 0.35);
}

/* =========================================
   BREATHING SLIDER — Viola accent
   ========================================= */
input[type="range"].breathing-slider {
    accent-color: var(--primary, #7E57C2);
}

/* =========================================
   BREATHING PHASE HEADER (label + toggle)
   ========================================= */
.breathing-phase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.breathing-toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.breathing-toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.breathing-toggle-track {
    width: 36px;
    height: 20px;
    background: rgba(126, 87, 194, 0.2);
    border-radius: 10px;
    transition: background 0.25s ease;
    position: relative;
}

.breathing-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: #aaa;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.breathing-toggle-switch input:checked + .breathing-toggle-track {
    background: var(--primary, #7E57C2);
}

.breathing-toggle-switch input:checked + .breathing-toggle-track::after {
    background: white;
    transform: translateX(16px);
}

.breathing-hold-field .breathing-range-row {
    transition: opacity 0.3s ease;
}

/* =========================================
   CHECK-IN / SAVE BUTTONS — Spinner fix
   Il resize è gestito via JS (offsetWidth lock).
   Il CSS garantisce solo min-height e overflow.
   ========================================= */

/* Bottoni full-width: garantisce che la larghezza non collassi durante loading */
.login-btn {
    overflow: hidden;
}

/* Lo spinner dentro un bottone: dimensione fissa centrata */
.btn-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

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

/* Spunta bianca sul feedback di successo */
.btn-success-feedback {
    background: var(--button-bg, linear-gradient(135deg, #7E57C2, #5c35a8)) !important;
    color: white !important;
}

.btn-success-feedback i,
.btn-success-feedback .ph {
    color: white !important;
    font-weight: 700;
}

/* =========================================
   BREATHING BALL — Maximum 3D Premium Glow
   (override del blocco precedente)
   ========================================= */
.breathing-ball {
    width: 280px;
    height: 280px;
    background:
        /* Specular highlight primario: punto di luce forte */
        radial-gradient(circle at 30% 26%, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0) 38%),
        /* Highlight secondario soft */
        radial-gradient(circle at 65% 70%, rgba(255,255,255,0.12) 0%, transparent 40%),
        /* Core gradient 3D: chiaro al centro-alto, scuro in basso */
        radial-gradient(ellipse at 40% 30%, #d5b8ff 0%, #9c6fff 35%, #6b35cc 65%, #4a1fa8 100%);
    border-radius: 50%;
    transform: scale(0.21);
    will-change: transform;
    box-shadow:
        /* Alone esterno luminoso */
        0 0 50px rgba(140, 90, 255, 0.55),
        0 0 100px rgba(140, 90, 255, 0.25),
        /* Ombra portata (profondità) */
        0 20px 60px rgba(80, 30, 180, 0.35),
        /* Inner highlight rimbalzo */
        inset 0 -8px 20px rgba(80, 30, 180, 0.4),
        inset 0 4px 12px rgba(255, 255, 255, 0.25);
}

/* Dark mode: toni ancora più profondi */
.dark-theme .breathing-ball {
    background:
        radial-gradient(circle at 30% 26%, rgba(255,255,255,0.65) 0%, rgba(255,255,255,0) 35%),
        radial-gradient(circle at 65% 70%, rgba(255,255,255,0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 40% 30%, #c4a0ff 0%, #8b5cf6 35%, #5b21b6 65%, #3b0fa0 100%);
    box-shadow:
        0 0 60px rgba(139, 92, 246, 0.6),
        0 0 120px rgba(139, 92, 246, 0.25),
        0 20px 70px rgba(59, 15, 160, 0.5),
        inset 0 -8px 20px rgba(59, 15, 160, 0.5),
        inset 0 4px 12px rgba(255, 255, 255, 0.2);
}