/* Global Styles */
body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f7f9;
    color: #333;
}

/* Header with background image and gradient overlay */
header {
    position: relative;
    background: url('../images/header-bg.jpg') no-repeat center center;
    background-size: cover;
    color: #fff;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
header::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5); /* semi-transparent overlay */
    z-index: 0;
}
header h1 {
    position: relative;
    z-index: 1;
    margin: 0;
    font-size: 2rem;
}
nav {
    position: relative;
    z-index: 1;
    text-align: right;
}
nav a {
    color: #fff;
    margin-left: 1rem;
    text-decoration: none;
    font-weight: bold;
}
nav a:hover {
    text-decoration: underline;
}

/* View Toggle and Legend */
.view-toggle {
    text-align: center;
    margin: 1rem 0;
}
.category-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1rem 0;
}
.legend-item, .clear-filter {
    margin: 0 10px;
    text-decoration: none;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    padding: 2px 5px;
}
.legend-item.active {
    border-color: #333;
    font-weight: bold;
}
.legend-color {
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 5px;
    border: 1px solid #ccc;
}
.legend-name {
    font-size: 0.9rem;
}

/* Main Content Area */
main {
    margin: 2rem auto;
    max-width: 1200px;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* Calendar Controls and Grid */
.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.calendar-controls button {
    margin: 0 1rem;
    padding: 0.5rem 1rem;
    border: none;
    background: #007bff;
    color: #fff;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.3s;
}
.calendar-controls button:hover {
    background: #0056b3;
}

#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #ccc;
    max-width: 800px;
    margin: 0 auto;
}
.day-name {
    background-color: #eee;
    text-align: center;
    font-weight: bold;
    padding: 0.5rem;
}
.day-cell {
    background-color: #fff;
    min-height: 100px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    position: relative;
}
.day-cell.today {
    background-color: #fffae6;
    border: 2px solid #f0c36d;
}
.day-number {
    position: absolute;
    top: 5px;
    right: 5px;
    font-weight: bold;
    color: #888;
}
.event {
    margin-top: 5px;
    padding: 2px 4px;
    border-radius: 2px;
    font-size: 0.85rem;
    cursor: pointer;
    /* default event background if no category color */
    background-color: #e8f0fe;
    color: #333;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.6);
}
.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 20px;
  max-width: 600px;
  border-radius: 4px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.close-button {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
.close-button:hover {
  color: #000;
}

/* Day view table */
.day-view-table {
  margin: 2rem auto;
  width: 80%;
  border-collapse: collapse;
}
.day-view-table th, .day-view-table td {
  padding: 8px;
  border: 1px solid #ddd;
}
/* Timeline container */
.timeline {
  display: flex;
  flex-direction: column;
  margin: 1rem auto;
  max-width: 800px;
}

/* Each hour block in the timeline */
.timeline-hour {
  display: flex;
  border-bottom: 1px solid #ddd;
  padding: 5px 0;
}

/* Time label on the left */
.time-label {
  width: 80px;
  text-align: right;
  padding-right: 10px;
  font-weight: bold;
  color: #555;
}

/* Container for event cards in this hour */
.events-container {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* Event card styling */
.timeline-event {
  background-color: #e8f0fe;
  color: #333;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.timeline-event a {
  color: inherit;
  text-decoration: underline;
}
/* Cards container for day view */
.cards-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px auto;
  max-width: 800px;
  padding: 0 10px;
}

/* Individual event card */
.card {
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s;
  background-color: #fff;
}
.card:hover {
  transform: scale(1.02);
}

/* Card header */
.card-header {
  padding: 10px;
  font-size: 1.2rem;
  font-weight: bold;
}

/* Card body */
.card-body {
  padding: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.card-body p {
  margin: 5px 0;
}
.card a {
  color: inherit;
  text-decoration: underline;
}
.select2-container--default .select2-results__option--highlighted {
  background-color: #007bff !important;
  color: white !important;
}


