/* ======================= */
/* === TEMA GENERALE === */
/* ======================= */
body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, sans-serif;
  transition: background 0.3s, color 0.3s;
  line-height: 1.6;
}

body[data-theme="dark"] {
  background: linear-gradient(145deg, #121826, #1c2433);
  color: #dbe4ff;
}

body[data-theme="light"] {
  background: #f5f9ff;
  color: #1a1a1a;
}

/* ======================= */
/* === CONTAINER === */
/* ======================= */
.container {
  max-width: 900px;
  margin: 60px auto;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(63, 94, 251, 0.08);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}

/* Contenitore in modalità scura */
body[data-theme="dark"] .container {
  background: #1c2433;
}

/* Contenitore in modalità chiara */
body[data-theme="light"] .container {
  background: #ffffff; /* Oppure #fefefe o altro colore chiaro */
}

@media (max-width: 600px) {
  .container {
    margin: 20px 10px;
    padding: 20px;
  }
}

/* ======================= */
/* === TITOLI E TESTI === */
/* ======================= */
h1 {
  font-size: 2.2rem;
  margin-bottom: 0.5rem;
  text-align: center;
  color: #5c7cfa;
}

.subtitle, .tagline {
  text-align: center;
  color: #9faecc;
}
.subtitle {
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.tagline {
  font-size: 0.95rem;
  margin-bottom: 25px;
}

/* ======================= */
/* === CHAT === */
/* ======================= */
.chat-box {
  background-color: #141b2c;
  border-radius: 12px;
  padding: 15px;
  height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (max-width: 480px) {
  .chat-box {
    height: 300px;
    padding: 10px;
  }
}

.message {
  display: flex;
}
.message.user {
  justify-content: flex-end;
}
.message.ai {
  justify-content: flex-start;
}
.bubble {
  padding: 10px 15px;
  border-radius: 20px;
  max-width: 80%;
  word-wrap: break-word;
  font-size: 1.05rem;
  line-height: 1.5;
}
.message.user .bubble {
  background-color: #3f5efb;
  color: #fff;
  border-bottom-right-radius: 6px;
}
.message.ai .bubble {
  background-color: #1f2a3e;
  color: #dbe4ff;
  border-bottom-left-radius: 6px;
}

/* ======================= */
/* === FORM & INPUT === */
/* ======================= */
form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
input[type="text"],
input[type="email"],
input[type="password"] {
  padding: 12px 18px;
  border-radius: 20px;
  border: none;
  background-color: #1f2a3e;
  color: #dbe4ff;
  font-size: 1.05rem;
  width: 100%;
  max-width: 400px;
}
input::placeholder {
  color: #8190b1;
}
input:focus {
  outline: 2px solid #5c7cfa;
  background-color: #25314b;
}

/* ======================= */
/* === BUTTONS === */
/* ======================= */
button {
  padding: 12px 18px;
  border-radius: 30px;
  border: none;
  background: #3f5efb;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease;
}
button:hover {
  background: #5c7cfa;
}
button:focus {
  outline: 2px solid #5c7cfa;
}

/* ======================= */
/* === DISCLAIMER & FOOTER === */
/* ======================= */
.disclaimer, footer {
  text-align: center;
  color: #7685a8;
}
.disclaimer {
  font-size: 0.9rem;
  margin-top: 30px;
}
footer {
  margin-top: 20px;
  font-size: 0.85rem;
}

/* ======================= */
/* === SIDEBAR E NAV === */
/* ======================= */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  z-index: 99;
}

.sidebar {
  height: 100vh;
  width: 0;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #1c2433;
  overflow-x: hidden;
  transition: 0.3s;
  padding-top: 60px;
  z-index: 1000;
}
.sidebar.open {
  width: 240px;
}
.sidebar .close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
}
.sidebar-title {
  color: #5c7cfa;
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 20px;
}
.sidebar ul {
  list-style-type: none;
  padding: 0;
}
.sidebar ul li {
  padding: 10px 20px;
}
.sidebar ul li a,
.sidebar ul li .logout-button.menu {
  color: #c9d2ee;
  text-decoration: none;
  font-size: 1rem;
  display: block;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 10px 0;
  cursor: pointer;
}
.sidebar ul li a:hover,
.sidebar ul li .logout-button.menu:hover {
  color: #ffffff;
  background-color: #2a3553;
  border-radius: 10px;
}
.hamburger {
  font-size: 24px;
  position: fixed;
  top: 15px;
  left: 20px;
  cursor: pointer;
  z-index: 1100;
  color: #5c7cfa;
}

/* ======================= */
/* === BACK BUTTON === */
/* ======================= */
.back-button {
  position: fixed;
  top: 15px;
  left: 15px;
  background-color: #2a3553;
  color: #dbe4ff;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.95rem;
  text-decoration: none;
  font-weight: 500;
  box-shadow: 0 0 8px rgba(63, 94, 251, 0.15);
  transition: background 0.3s ease;
  z-index: 1001;
}
.back-button:hover {
  background-color: #3f5efb;
  color: white;
}

/* ======================= */
/* === TIMER BLOCCO CHAT === */
/* ======================= */
#cooldown-timer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2a3553;
  color: #dbe4ff;
  padding: 12px 16px;
  border-radius: 10px;
  display: none;
  font-size: 0.9rem;
  box-shadow: 0 0 10px rgba(63, 94, 251, 0.2);
  z-index: 1001;
}

/* ======================= */
/* === MODALI === */
/* ======================= */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(18, 24, 38, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}
.modal-content {
  background-color: #1f2a3e;
  padding: 30px;
  border-radius: 16px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0 30px rgba(63, 94, 251, 0.2);
  color: #dbe4ff;
}
.modal-content input {
  width: 90%;
  margin-top: 10px;
  padding: 10px;
  border-radius: 12px;
  border: none;
  background-color: #27344b;
  color: #fff;
  font-size: 1rem;
}

/* ======================= */
/* === DIARIO PERSONALE === */
/* ======================= */

.diary-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 540px;
  margin: 60px auto;
  padding: 30px 20px;
  background-color: #1c2433;
  border-radius: 16px;
}

/* Intro coerente con terms.html */
.diary-intro {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 20px 30px;
  color: #dbe4ff;
  font-family: 'Georgia', serif;
  line-height: 1.6;
  text-align: center;
  border-bottom: 1px solid #344055;
}

.diary-intro h1 {
  font-size: 2rem;
  margin-bottom: 15px;
  color: #ffffff;
}

.diary-intro p {
  margin-bottom: 10px;
  font-size: 1rem;
  font-family: 'Georgia', serif;
  color: #dbe4ff;
}

/* Area note */
.note-list {
  width: 100%;
  max-width: 500px;
  max-height: 400px;
  overflow-y: auto;
  background: #1c2433;
  padding: 15px 20px;
  border-radius: 16px;
  margin: 0 auto;
}

/* Editor */
textarea#note-input {
  width: 100%;
  max-width: 100%;
  min-height: 200px;
  border-radius: 12px;
  background: #27344b;
  color: #fff;
  padding: 18px 28px; /* aumentato il padding laterale */
  font-size: 1rem;
  border: none;
  resize: vertical;
  margin: 0 auto;
  box-sizing: border-box;
  font-family: 'Georgia', serif;
  line-height: 1.6;
}

/* Campo titolo nel modal "Salva con nome" */
input#note-title {
  width: 100%;
  max-width: 100%;
  padding: 12px 24px; /* aumentato il padding laterale */
  font-size: 1.1rem;
  border-radius: 10px;
  background: #27344b;
  color: #fff;
  border: none;
  margin-bottom: 20px;
  box-sizing: border-box;
  font-family: 'Georgia', serif;
}

/* Singola nota */
.note-item {
  background-color: #27344b;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.note-title {
  font-weight: bold;
  color: #dbe4ff;
  cursor: pointer;
  font-family: 'Georgia', serif;
}

.note-options {
  cursor: pointer;
  font-size: 18px;
  color: #9faecc;
  position: relative;
}

.options-menu {
  position: absolute;
  top: 20px;
  right: 0;
  background: #1c2433;
  padding: 10px;
  border-radius: 12px;
  display: none;
  flex-direction: column;
  gap: 5px;
}

.options-menu button {
  background: none;
  color: #dbe4ff;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 5px 0;
}


/* ======================= */
/* === ESERCIZI GUIDATI === */
/* ======================= */

@media (max-width: 768px) {
  .exercise-pack .info {
    margin-top: 10px;
    align-items: center;
  }

  .exercise-pack .cover img {
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
  }

  .lesson-list {
    margin-left: 0;
    padding-left: 0;
    list-style-position: inside;
  }
}

.exercise-pack {
  display: flex;
  gap: 20px;
  background: #1f2a3e;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 0 15px rgba(63, 94, 251, 0.1);
  align-items: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.exercise-pack.locked {
  position: relative;
  opacity: 0.6;
  pointer-events: none;
}
.exercise-pack.locked::after {
  content: "🔒 Premium";
  position: absolute;
  top: 20px;
  right: 20px;
  background: #3f5efb;
  color: white;
  padding: 5px 10px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 0.9rem;
}

.exercise-pack .cover img {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 10px rgba(63, 94, 251, 0.15);
}
.exercise-pack .info {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.exercise-pack .info h2 {
  font-size: 1.3rem;
  color: #5c7cfa;
  margin-bottom: 10px;
}
.exercise-pack .info p {
  font-size: 0.95rem;
  color: #cbd5ff;
  margin-bottom: 10px;
}
.lesson-list {
  list-style-type: disc;
  margin-left: 20px;
  font-size: 0.9rem;
  color: #dbe4ff;
  margin-bottom: 10px;
}
.progress-bar {
  width: 100%;
  height: 10px;
  background: #27344b;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-bar .progress {
  height: 100%;
  background: #3f5efb;
  width: 0%;
  transition: width 0.3s ease-in-out;
}
.exercise-pack button.locked {
  padding: 10px 18px;
  border-radius: 30px;
  background: #5c7cfa;
  color: white;
  border: none;
  font-weight: bold;
  font-size: 0.95rem;
  cursor: not-allowed;
}
.exercise-pack.coming-soon {
  opacity: 0.6;
}
.exercise-pack:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 30px rgba(63, 94, 251, 0.2);
}

.section-title {
  text-align: center;
  font-size: 2rem;
  color: #5c7cfa;
  margin-bottom: 10px;
}

.badge {
  font-size: 0.75rem;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 10px;
  margin-left: 10px;
}
.badge.free {
  background-color: #38bdf8;
  color: #ffffff;
}
.badge.premium {
  background-color: #f43f5e;
  color: #ffffff;
}

/* ======================= */
/* === GRAFICO EMOZIONALE === */
/* ======================= */
#moodChart {
  background: #1c2433;
  border-radius: 12px;
  padding: 15px;
  position: relative;
}
.mood-gradient-legend {
  position: absolute;
  right: -50px;
  top: 10px;
  height: 200px;
  width: 12px;
  background: linear-gradient(to top, #1f2a3e 0%, #3f5efb 50%, #dbe4ff 100%);
  border-radius: 10px;
}
canvas::after {
  content: "";
  display: block;
  height: 0;
  border-top: 1px dashed #ffffff33;
  position: absolute;
  top: 30%;
  left: 0;
  right: 0;
}

/* Link nei disclaimer (es. Registrati, Recupera) */
.disclaimer a {
  color: #dbe4ff; /* colore molto leggibile su sfondo scuro */
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.3s ease, border-bottom 0.3s ease;
  padding-bottom: 2px;
}

.disclaimer a:hover {
  color: #5c7cfa; /* il viola chiaro usato nel sito */
  border-bottom: 1px solid #5c7cfa;


.form-title {
  font-size: 1.8rem;
  color: #5c7cfa;
  text-align: center;
  margin-bottom: 10px;
}

.form-subtext {
  font-size: 1rem;
  color: #9faecc;
  text-align: center;
  margin-bottom: 20px;
}

.primary-button {
  padding: 12px 24px;
  border-radius: 30px;
  background-color: #3f5efb;
  color: white;
  border: none;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s ease;
  display: block;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.primary-button:hover {
  background-color: #5c7cfa;
}
}






/* --- Titolo Premium Dinamico (premium.html) --- */
.page-title {
  font-size: 3.2rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 0 25px rgba(163, 93, 252, 0.4), 0 0 60px rgba(110, 110, 246, 0.3);
}

.page-title .brand {
  background: linear-gradient(90deg, #7b7ff5, #a35dfc, #ff6b6b);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: aurora-shine 6s ease-in-out infinite alternate;
}

/* --- Animazione gradiente fluida --- */
@keyframes aurora-shine {
  0% {
    background-position: 0% center;
    filter: drop-shadow(0 0 6px rgba(163,93,252,0.5));
  }
  50% {
    background-position: 100% center;
    filter: drop-shadow(0 0 12px rgba(255,107,107,0.5));
  }
  100% {
    background-position: 0% center;
    filter: drop-shadow(0 0 6px rgba(123,127,245,0.5));
  }
}
