/* === KALENTERIN PÄÄRAKENTEEN TYYLIT === */
.calendar {
  width: 100%;
  max-width: 1400px;
  background-color: var(--accent);
  border-radius: 16px;
  padding: 1.5rem;
  display: grid;
  grid-template-rows: auto 1fr; /* Otsikko ja body, body vie lopun tilan */
  gap: 1rem;
}

.calendar-head {
  display: grid;
  /* grid-template-columns asetetaan JS:llä */
  text-align: center;
  font-weight: bold;
  color: var(--text-bright);
  padding-bottom: 0.5rem;
}
.calendar-head > div {
    padding: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 2px;
  background: #1a1a27; /* Taustaväri päivien väleille */
}

.calendar-week {
  display: grid;
  /* grid-template-columns asetetaan JS:llä */
  gap: 2px;
}

/* === KALENTERISOLUJEN TYYLIT (VIIKKONUMERO, PÄIVÄT) === */
.calendar-body .week-number,
.calendar-body .day-box {
  min-height: 120px;
  padding: 0.5rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  font-size: 1rem;
  overflow: hidden;
  position: relative;
  border: 1px solid transparent;
}

.calendar-body .week-number {
  background: var(--highlight);
  color: var(--text-bright);
  font-weight: bold;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
}

.calendar-body .day-box {
  background: var(--highlight);
  color: var(--text-light);
  cursor: pointer;
  transition: background-color 0.2s ease;
}
/* .calendar-body .day-box::first-line {
    align-self: flex-end;
    font-weight: bold;
    color: var(--text-bright);
    padding-bottom: 0.2em;
} */

.day-box .day-number {
    position: absolute; /* Sijoita absoluuttisesti day-boxin sisälle */
    top: 5px; /* Sijoita oikeaan yläkulmaan */
    right: 8px;
    font-size: 0.9em; /* Hieman pienempi tai sama kuin aiemmin */
    font-weight: bold;
    color: var(--text-bright);
    line-height: 1; /* Estää ylimääräisen rivivälin */
    z-index: 1; /* Varmista, että on muistiinpanojen päällä */
}

.day-box .day-number.highlighted {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px; /* Tai 50% pyöreälle */
    padding: 2px 5px;
    min-width: 20px; /* Varmista, että numerot mahtuvat */
    text-align: center;
}

.calendar-body .day-box:hover { background-color: #3a3a55; }
.calendar-body .day-box.empty { background-color: var(--accent); cursor: default; }
.calendar-body .day-box.empty:hover { background-color: var(--accent); }
.calendar-body .day-box.today { background-color: var(--today-highlight); outline: 2px solid #aaaaff; }

.day-entries-container {
  width: 100%;
  margin-top: 0.25rem;
  padding-top: 1.5em;
  font-size: 0.7rem;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: calc(100% - 1.8em);
  overflow-y: auto;
  align-items: flex-start;
}

.day-note-preview,
.day-event-title {
  width: calc(100% - 2px);
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  text-align: left;
}

.day-note-preview {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-light);
}

.day-event-more {
    font-style: italic;
    font-size: 0.85em;
    color: var(--text-light);
    opacity: 0.8;
    text-align: center;
    margin-top: auto;
    padding: 2px 4px;
    align-self: center;
    cursor: pointer;
    border-radius: 3px;
}
.day-event-more:hover {
    opacity: 1;
    text-decoration: underline;
    background-color: rgba(255,255,255,0.1);
}