/* Base layout for screen */
body {
  font-family: Arial, sans-serif;
  background: #f8f8f8;
  margin: 20px;
  font-size: 20px;
}

h1 {
  text-align: center;
  font-size: 20px;
}

label {
  display: block;
  text-align: center;
  margin-bottom: 10px;
}

#year-select {
  display: block;
  margin: 0 auto 20px;
  font-size: 20px;
}

#calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 0 auto;
  max-width: 1300px;
  padding: 16px;
  position: relative;
}

.month {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  padding: 10px;
}

.month h2 {
  text-align: center;
  margin-bottom: 10px;
  font-size: 20px;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-weight: bold;
  text-align: center;
  margin-bottom: 5px;
  font-size: 20px;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  justify-content: center;
  margin: 0 auto;
  max-width: 300px;
}

.day {
  width: 100%;
  max-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 4px;
  font-size: 20px;
  text-align: center;
  box-sizing: border-box;
  background-color: transparent;
}

/* Color classes */
.red    { color: #e74c3c; font-weight: bold; }
.blue   { color: #3498db; font-weight: bold; }
.orange { color: #e67e22; font-weight: bold; }
.green  { color: #2ecc71; font-weight: bold; }
.purple { color: #8e44ad; font-weight: bold; }
.black  { color: #2c3e50; font-weight: bold; }

.sunday {
  background-color: white;
  color: grey;
  font-weight: normal;
}

.holiday {
  background-color: #e0e0e0;
  font-weight: bold;
  border: none;
}

.empty {
  background-color: transparent;
}

/* Responsive layout for small screens */
@media (max-width: 600px) {
  .day {
    max-width: 30px;
    height: 30px;
    font-size: 20px;
  }

  .days {
    max-width: 240px;
  }

  #calendar-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    padding: 5px;
  }

  .month h2,
  .weekdays {
    font-size: 16px;
  }
}

/* Hidden on screen, visible in print */
.year-print-banner,
.print-title-row {
  display: none;
}

@media print {
  body {
    margin: 0;
    background: white;
  }

  #print-year-display {
  font-size: 1.5rem;
  font-weight: bold;
  color: purple;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}


  h1,
  label,
  #year-select {
    display: none;
  }

  #calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 0;
    width: 100vw;
  }

  .month {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
    break-inside: avoid-column;
    padding: 4px;
  }

  .weekdays,
  .days {
    gap: 1px;
  }

  .day {
    height: 22px;
    line-height: 22px;
    padding: 0;
  }

  /* Uniform font size for all calendar elements */
  .month,
  .month h2,
  .weekdays,
  .days,
  .day {
    font-size: 18px;
  }

  @page {
    size: landscape;
    margin: 0.5in;
  }

  /* Print-only title row with year */
  .print-title-row {
    display: flex;
    color: purple;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
  }

  #print-year-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: purple;
  }

  h1 {
    font-size: 1.5rem;
  }
}
