@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;700&display=swap");
body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #064e3b;
  text-align: center;
  padding: 20px;
}
h1 {
  margin-bottom: 20px;
  font-weight: 700;
}

.streak {
  margin-bottom: 20px;
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.6);
  padding: 12px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
}
.card {
  width: 220px;
  padding: 25px;
  border-radius: 20px;
  text-decoration: none;
  color: #065f46;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: 0.3s;
}
.card:hover {
  transform: translateY(-8px) scale(1.05);
  background: rgba(255, 255, 255, 0.7);
}

input {
  padding: 10px;
  border-radius: 10px;
  border: none;
}

.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  color: #065f46;
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(-3px);
}

#datePicker {
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: #ecfdf5;
}
h3 {
  margin-top: 30px;
}

.subtitle {
  font-size: 1rem;
  margin-bottom: 10px;
  opacity: 0.8;
}
h2 {
  margin: 10px 0 15px;
}
.emojis {
  margin: 15px 0;
}
.emojis span {
  font-size: 2.5rem;
  margin: 10px;
  cursor: pointer;
  transition: 0.2s;
}
.emojis span.active {
  transform: scale(1.4);
  border-bottom: 3px solid #10b981;
}
.emojis span:hover {
  transform: scale(1.3);
}
textarea {
  width: 80%;
  max-width: 600px;
  height: 90px;
  border-radius: 12px;
  border: none;
  padding: 12px;
  margin-top: 10px;
  background: #ecfdf5;
  color: #065f46;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
button {
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  margin: 12px;
  cursor: pointer;
  font-weight: 500;
  background: linear-gradient(45deg, #10b981, #34d399);
  color: white;
  transition: 0.2s;
}
button:hover {
  transform: scale(1.05);
}
#todayMood,
#moodMessage {
  margin-top: 10px;
  font-size: 1rem;
}
hr {
  margin: 30px 0;
  border: none;
  height: 1px;
  background: rgba(0, 0, 0, 0.1);
}
.calendar {
  margin: 20px auto;
  max-width: 600px;
  padding: 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
}
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.calendar-header h4 {
  margin: 0;
}
.calendar-header button {
  padding: 6px 12px;
  border-radius: 10px;
  background: #10b981;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 15px;
  font-weight: 500;
}

.calendar-dates {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 10px;
}

.calendar-dates div {
  padding: 12px;
  margin: 5px;
  border-radius: 12px;
  background: #ecfdf5;
  cursor: pointer;
  transition: all 0.2s ease;
}

.calendar-dates div:hover {
  transform: scale(1.08);
  background: #c3f2d3;
}
.happy {
  background: #93ffb9 !important;
}
.sad {
  background: #bfdbfe !important;
}
.tired {
  background: #ddd6fe !important;
}
.angry {
  background: #fecaca !important;
}
.selected-date {
  border: 3px solid #16a34a;
}
.today-date {
  border: 2px dashed #22c55e;
  background: #dcfce7;
}

.selected-date.today-date {
  border: 3px solid #15803d;
  background: #bbf7d0;
}
#moodHistory p {
  background: rgba(255, 255, 255, 0.5);
  padding: 8px;
  border-radius: 10px;
  margin: 6px auto;
  width: fit-content;
}
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  justify-content: center;
  align-items: center;
}

.popup-content {
  background: #d1fae5;
  padding: 20px 30px;
  border-radius: 12px;
  text-align: center;
  width: 300px;
  animation: fadeIn 0.3s ease;
}
.close-btn {
  float: right;
  cursor: pointer;
  font-size: 20px;
}

@keyframes fadeIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.chart-box {
  width: 850px;
  height: 380px;
  margin: 20px auto;
}
.insights-container {
  position: relative;
  max-width: 500px;
  margin: 20px auto;
}

.trend-box {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.15);
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  font-weight: 600;
  margin-bottom: 15px;
}
.insights-row {
  display: flex;
  gap: 10px;
}
.insights-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.6);
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(8px);
  font-weight: 600;
  transition: 0.2s;
}
.insights-card:hover {
  transform: translateY(-4px);
}

.streak-global {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: white;
  padding: 14px 20px;
  border-radius: 25px;
  font-size: 18px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  font-weight: 600;
  z-index: 1000;
}
#moodScore {
  color: #15803d;
  font-size: 16px;
}
#mostMood {
  color: #166534;
  font-size: 16px;
}
.habit-container {
  max-width: 500px;
  margin: 20px auto;
}

.add-habit {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.add-habit input {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
}

.add-habit button {
  background: #22c55e;
  border: none;
  padding: 10px 15px;
  border-radius: 10px;
  color: white;
  cursor: pointer;
}

.habit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.6);
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

.habit-card button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
}
.done-habit {
  text-decoration: line-through;
  color: #6b7280;
  opacity: 0.7;
}
.habit-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #22c55e;
}
.habit-card span {
  flex: 1;
}
.progress-bar {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border-radius: 10px;
  margin: 10px 0;
}
#progressFill {
  height: 100%;
  background: #22c55e;
  border-radius: 10px;
  width: 0%;
  transition: 0.3s;
}

small {
  font-size: 12px;
  color: #6b7280;
}
#smartMessage {
  color: #16a34a;
  font-weight: 500;
}
select {
  padding: 10px;
  border-radius: 10px;
  border: none;
}
.chart-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-top: 30px;
}
#habitDonut {
  width: 400px !important;
  height: 400px !important;
}
.custom-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  color: #064e3b;
  margin-top: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: #064e3b;
  justify-content: space-between;
  width: 140px;
}
.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.best-streak {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(34, 197, 94, 0.15);
  padding: 10px 15px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  font-weight: 500;
}
.glass {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 20px;
  margin: 20px auto;
  max-width: 420px;
}
.sleep-container button {
  background: #22c55e;
  border: none;
  padding: 10px;
  border-radius: 10px;
  color: white;
  cursor: pointer;
  margin-top: 10px;
}
.sleep-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: none;
  outline: none;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  font-size: 14px;
  color: #065f46;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.sleep-input:focus {
  box-shadow: 0 0 0 2px #22c55e;
  background: rgba(255, 255, 255, 0.8);
}

.sleep-input::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  cursor: pointer;
  filter: invert(35%) sepia(60%) saturate(400%) hue-rotate(90deg);
}

.input-group {
  margin-bottom: 10px;
}
.sleep-history {
  max-width: 420px;
  margin: 10px auto;
}

.history-card {
  background: rgba(255, 255, 255, 0.5);
  padding: 10px;
  margin-top: 8px;
  border-radius: 10px;
}
.goal-box {
  margin: 15px 0;
  text-align: center;
}
.goal-box input {
  padding: 8px;
  border-radius: 10px;
  border: none;
  margin-right: 5px;
}
.goal-progress {
  width: 100%;
  height: 10px;
  background: rgba(209, 206, 206, 0.349);
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0;
}

#goalBar {
  height: 100%;
  width: 0%;
  background: #22c55e;
  transition: width 0.2s ease;
}

.footer {
  text-align: center;
  margin-top: 10px;
  padding: 15px;
  font-size: 14px;
  color: #066046;
  opacity: 0.8;
}
.dashboard {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin: 20px;
  flex-wrap: wrap;
}

.dash-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  padding: 15px;
  margin-top: 50px;
  border-radius: 14px;
  width: 120px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
.chart-title {
  text-align: center;
  margin-bottom: 10px;
  color: #065f46;
  font-weight: 600;
}
.theme-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: absolute;
}
.theme-btn img {
  width: 55px;
  height: 55px;
  display: block;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.warning {
  text-align: center;
  color: #b91c1c;
  margin-top: 10px;
}

body.dark {
  background: linear-gradient(135deg, #1a1e29, #2e2a3b, #4b3b59);
  color: #ede6d8;
}

body.dark h1,
body.dark h2,
body.dark h3,
body.dark h4 {
  color: #ede6d8;
}

body.dark p,
body.dark span,
body.dark small,
body.dark label {
  color: #c2b180;
}

body.dark .card,
body.dark .habit-card,
body.dark .calendar,
body.dark .glass,
body.dark .dash-card,
body.dark .insights-card,
body.dark .history-card {
  background: rgba(46, 42, 59, 0.65);
  color: #ede6d8;
  border: 1px solid rgba(194, 177, 128, 0.15);
}
body.dark .popup-content {
  background: #4b3b59 !important;
  color: #ede6d8 !important;
  border: 1px solid #4b3b59;
  backdrop-filter: none !important;
}
body.dark .card:hover {
  background: rgba(75, 59, 89, 0.7);
}

body.dark input,
body.dark select,
body.dark .sleep-input {
  background: rgba(26, 30, 41, 0.6);
  color: #ede6d8;
  border: 1px solid rgba(194, 177, 128, 0.2);
}
body.dark textarea {
  background: rgba(26, 30, 41, 0.8) !important;
  color: #ede6d8 !important;
  border: 1px solid rgba(194, 177, 128, 0.2);
}
body.dark button {
  background: #7a6c8c;
  color: #ede6d8;
}

body.dark button:hover {
  background: #4b3b59;
}

body.dark .back-btn {
  background: rgba(46, 42, 59, 0.6);
  color: #ede6d8;
}

body.dark hr {
  background: rgba(194, 177, 128, 0.2);
}

body.dark .streak,
body.dark .best-streak {
  background: rgba(46, 42, 59, 0.6);
  color: #ede6d8;
}

body.dark .streak-global {
  background: linear-gradient(135deg, #7a6c8c, #4b3b59);
  color: #ede6d8;
}

body.dark .progress-bar {
  background: rgba(194, 177, 128, 0.15);
}

body.dark #progressFill {
  background: #a89fb5;
}

body.dark .footer {
  color: #c2b180;
  opacity: 0.8;
}

body.dark canvas {
  filter: brightness(0.9);
}

body.dark .done-habit {
  color: #c2b180;
  opacity: 0.8;
  text-decoration: line-through;
}

body.dark .habit-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #a89fb5;
  cursor: pointer;
}

body.dark .calendar-dates div {
  background: rgba(26, 30, 41, 0.7);
  color: #ede6d8;
  border: 1px solid rgba(194, 177, 128, 0.18);
  position: relative;
}

body.dark .calendar-dates div:hover {
  background: rgba(122, 108, 140, 0.75);
  transform: scale(1.03);
  transition: 0.2s;
}

body.dark .happy {
  background: rgba(168, 159, 181, 0.55) !important;
  color: #ede6d8;
  border: 1px solid rgba(237, 230, 216, 0.2);
}

body.dark .sad {
  background: rgba(122, 108, 140, 0.55) !important;
  color: #ede6d8;
}

body.dark .tired {
  background: rgba(75, 59, 89, 0.55) !important;
  color: #ede6d8;
}

body.dark .angry {
  background: rgba(46, 42, 59, 0.7) !important;
  color: #ede6d8;
}

body.dark .selected-date {
  border: 2px solid #ede6d8;
  background: rgba(122, 108, 140, 0.5);
}

body.dark .today-date {
  border: 1px dashed #c2b180;
  background: rgba(75, 59, 89, 0.5);
}

body.dark .custom-legend,
body.dark .legend-item {
  color: #ede6d8;
}

body.dark .legend-color {
  border: 1px solid rgba(194, 177, 128, 0.3);
}

body.dark #weeklyStats,
body.dark #smartMessage,
body.dark .subtitle {
  color: #c2b180;
}
body.dark #moodHistory p {
  background: rgba(46, 42, 59, 0.75);
  color: #ede6d8;
  padding: 10px;
  border-radius: 10px;
  margin: 6px auto;
  width: fit-content;
  border: 1px solid rgba(194, 177, 128, 0.2);
}

body.dark #moodHistory {
  color: #ede6d8;
}
body.dark .calendar-dates div.today-date {
  border: 3px dashed #ffffff !important;
  background: rgba(122, 108, 140, 0.7) !important;
  color: #ffffff !important;
  font-weight: 700;
}

body.dark .calendar-dates div.selected-date {
  border: 3px solid #ffffff !important;
  color: #ffffff !important;
  font-weight: 700;
}

body.dark .calendar-dates div.selected-date.today-date {
  border: 3px solid #ffffff !important;
  background: rgba(75, 59, 89, 0.95) !important;
  color: #ffffff !important;
}
.privacy-note {
  text-align: center;
  font-size: 12px;
  margin: 20px auto;
  margin-top: 95px;
  padding: 8px 12px;
  width: fit-content;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px);
  opacity: 0.7;
  color: #065f46;
}

body.dark .privacy-note {
  background: rgba(255, 255, 255, 0.08);
  color: #c2b180;
}

.note-row {
  position: relative;
  text-align: center;
  margin-top: 10px;
}

#detailNote {
  display: block;
  text-align: center;
  margin: 0 auto;
}

.edit-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: 0.7;
  transition: 0.2s;
}

.edit-icon:hover {
  opacity: 1;
  transform: translateY(-50%) scale(1.15);
}

body.dark .edit-icon {
  filter: invert(1) brightness(1.5);
}

.journal-box textarea {
  width: 90%;
  height: 420px;
  margin-top: 10px;
  border-radius: 12px;
  border: none;
  padding: 12px;
  resize: none;
  background: rgba(255, 255, 255, 0.6);
  color: #065f46;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.journal-history {
  max-width: 1000px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 15px;
  margin: 20px auto;
}

.journal-history .history-card {
  background: rgba(255, 255, 255, 0.5);
  padding: 14px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  text-align: left;
  display: flex;
  flex-direction: column;
}

.journal-history .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.journal-history .card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-history .card-actions .edit-icon,
.journal-history .card-actions .delete-icon {
  position: static !important;
  top: auto !important;
  right: auto !important;
  transform: none !important;
}

.journal-history .card-actions .edit-icon {
  order: 1;
}

.journal-history .card-actions .delete-icon {
  order: 2;
}

.journal-history .card-actions img {
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: 0.75;
  transition: 0.2s;
}

.journal-history .card-actions img:hover {
  opacity: 1;
  transform: scale(1.12);
}

.journal-history .history-text {
  font-size: 14px;
  margin-top: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  pointer-events: none;
}

.journal-history .read-more {
  font-size: 13px;
  color: #16a34a;
  cursor: pointer;
  margin-top: 6px;
  display: inline-block;
  pointer-events: auto;
  z-index: 2;
}

.journal-history .edit-area {
  width: 100%;
  min-height: 100px;
  max-height: 180px;
  margin-top: 8px;
  border-radius: 10px;
  padding: 10px;
  border: none;
  resize: none;
  font-size: 13px;
  line-height: 1.4;
  box-sizing: border-box;
  overflow-y: auto;
  scrollbar-width: none;
}

.journal-history .edit-area::-webkit-scrollbar {
  display: none;
}

.journal-history .edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.journal-history .edit-actions button {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: white;
}

.journal-history .edit-actions button:first-child {
  background: #22c55e;
}

.journal-history .edit-actions button:last-child {
  background: #ef4444;
}

body.dark .journal-box textarea {
  background: rgba(26, 30, 41, 0.85);
  color: #ede6d8;
}

body.dark .journal-history .history-card {
  background: rgba(46, 42, 59, 0.75);
  color: #ede6d8;
  border: 1px solid rgba(194, 177, 128, 0.15);
}

body.dark .journal-history .card-actions img {
  filter: invert(1) brightness(1.4);
}

body.dark .journal-history .read-more {
  color: #c2b180;
}

body.dark .journal-history .edit-area {
  background: rgba(26, 30, 41, 0.8);
  color: #ede6d8;
}

body.dark textarea::placeholder {
  color: #c2b180;
}
