/**
 * File: style.css
 * v1.1.2 (Final Polish & Bugfixes)
 */
:root {
    /* MODIFICA: La variabile --app-height è stata rimossa perché non più necessaria */
    --primary: #B39DDB;
    --primary-light: #D1C4E9;
    --primary-dark: #5E35B1;
    --primary-darker: #5E35B1;
    --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;
    --premium: #FFD700;
    --premium-light: #FFF59D;
    --premium-gradient: linear-gradient(135deg, #FFD700, #FFA000);
    --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: #80CBC4;
    --pastel-stress: #FFAB91;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    touch-action: manipulation;
}

html {
    height: 100%;
}

body {
    height: 100dvh; /* MODIFICA: Usiamo l'unità dvh per l'altezza dinamica (risolve bug tastiera) */
    position: relative;
    background-color: var(--background);
    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, #EADFF2 0%, #D1C4E9 50%, #B39DDB 100%);
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
}

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%);
}

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

body {
    color: var(--text);
    line-height: 1.6;
    padding-top: env(safe-area-inset-top);
    padding-bottom: 0;
    overflow: hidden;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.5s ease, color 0.5s ease;
}

body.dark-theme {
    --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;
}

#main-app {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    height: 100%;
    overflow-y: auto;
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
}
#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-y: auto;
    background-color: #D3BBFF;
    transition: opacity 0.5s ease-out;
}

.auth-container {
    background: var(--card-bg);
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 30px 25px;
    border: 1px solid rgba(179, 157, 219, 0.2);
    max-height: 95vh;
    overflow-y: auto;
}

.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;
}

.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);
}

#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 input[type="range"] {
    background: linear-gradient(to right, var(--primary-darker), var(--primary-dark));
}
.dark-theme input[type="range"]::-webkit-slider-thumb {
    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;
    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,
.history-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,
.history-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);
}

.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);
}

.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 {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--card-bg);
    color: var(--text);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-top: 20px;
    border: 1px solid rgba(179, 157, 219, 0.2);
}

/* MODIFICA FINALE: I contenitori dei modali ora usano Flexbox. */
.history-container,
.account-settings-container,
.profile-edit-container {
    background: var(--card-bg);
    width: 90%;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-height: calc(100% - 40px);
    margin-top: env(safe-area-inset-top);
    margin-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.history-container, .account-settings-container {
    max-width: 500px;
}
.profile-edit-container {
    max-width: 400px;
}

.history-header,
.profile-edit-title {
    flex-shrink: 0;
    background: var(--card-bg);
    /* MODIFICA FINALE: Correzione angoli retti. */
    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;
}

.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: 0; /* Il padding è già gestito dagli item interni */
}

.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);
}

.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,
.dark-theme .mood-history-stat.stress-stat .stat-label,
.dark-theme .mood-history-stat.stress-stat .stat-value {
    color: var(--text);
}

.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;
}

.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);
}

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

.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;
}

.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);
}

.profile-icon {
    font-size: 1.2rem;
    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;
}

.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%;
}

.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;
}

.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;
}

.meditation-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.filter-btn {
    padding: 10px 15px;
    border-radius: 50px;
    background: var(--filter-bg-light);
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dark-theme .filter-btn {
    background: rgba(209, 196, 233, 0.2);
    color: var(--text);
}

.filter-btn.active {
    background: var(--primary-darker);
    color: white;
}

.dark-theme .filter-btn.active {
    background: var(--primary-dark);
    color: white;
    font-weight: 700;
}

.filter-btn:active {
    transform: scale(0.95);
}

.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;
}

.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;
}

.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: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    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 {
    left: calc(100% - 16px - 4px);
}

.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;
}

.premium-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 25px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--primary-light);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.premium-title {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-description {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 1rem;
    line-height: 1.7;
}

.subscription-toggle-container {
    padding: 4px;
    background: var(--toggle-bg);
    border-radius: 50px;
    margin-bottom: 25px;
}

.subscription-toggle {
    display: flex;
    position: relative;
}

.toggle-slider-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    background: var(--toggle-slider-gradient);
    border-radius: 50px;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.subscription-toggle.monthly-active .toggle-slider-background {
    transform: translateX(100%);
}

.toggle-option {
    flex: 1;
    padding: 12px 10px;
    background: transparent;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    z-index: 1;
    color: var(--text-light);
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.toggle-option.active {
    color: white;
}

.dark-theme .toggle-option {
    color: var(--text-light);
}
.dark-theme .toggle-option.active {
    color: white;
}

.discount-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.plan-details {
    display: none;
    text-align: center;
    animation: fadeIn 0.5s;
}

.plan-details.active {
    display: block;
}

.plan-price-container {
    margin-bottom: 5px;
}

.plan-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.plan-equivalent {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.trial-badge {
    background: var(--primary-light);
    color: var(--primary-darker);
    padding: 8px 15px;
    border-radius: 12px;
    font-weight: bold;
    margin: 0 auto 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.buy-one-give-one {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 15px;
    background: rgba(209, 196, 233, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(179, 157, 219, 0.1);
}
.dark-theme .buy-one-give-one {
     background: rgba(126, 87, 194, 0.2);
     border-color: rgba(126, 87, 194, 0.3);
}


.subscribe-btn-premium {
    background: var(--button-bg);
    color: white;
    border: none;
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(94, 53, 177, 0.3);
    transition: all 0.3s ease;
    position: relative;
    min-height: 58px;
}

.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;
}

.premium-lock {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.premium-lock-icon {
    font-size: 2rem;
    color: var(--premium);
    margin-bottom: 10px;
}

.premium-lock-text {
    text-align: center;
    padding: 0 20px;
    font-weight: 600;
    color: var(--text);
}

.premium-lock-btn {
    background: var(--premium);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dark-theme .premium-lock {
    background: rgba(30, 30, 30, 0.85);
}

.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: #EF5350;
}

.stress-bar {
    background: #FFB74D;
}

.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);
    }
}

.coriandolo {
    position: fixed;
    top: -5vh;
    font-size: 1.5rem;
    user-select: none;
    pointer-events: none;
    z-index: 9999;
    animation: caduta-oscillazione ease-in forwards;
    will-change: transform, opacity;
}

.coriandolo.fade-out {
    animation: dissolvenza 0.5s ease-out forwards;
}

@keyframes caduta-oscillazione {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(105vh) translateX(var(--oscillazione)) rotate(720deg);
        opacity: 1;
    }
}

@keyframes dissolvenza {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

.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);
}

.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;
}

.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: 20px 0;
}

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

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

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