/* ===== View Toggle ===== */
.calendar-view-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.calendar-view-toggle .btn-outline.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

/* ===== Schedule View (positioned event blocks) ===== */
.calendar-schedule {
  overflow-x: auto;
}

.schedule-container {
  min-width: 900px;
}

/* Header row */
.schedule-header {
  display: grid;
  grid-template-columns: 56px repeat(8, 1fr);
  gap: 0;
}

.schedule-time-gutter {
  width: 56px;
  flex-shrink: 0;
}

.schedule-day-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: var(--white);
  padding: 8px 4px;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.schedule-day-header:last-child {
  border-right: none;
  border-radius: 0 6px 0 0;
}

.schedule-header .schedule-time-gutter + .schedule-day-header {
  border-radius: 6px 0 0 0;
}

.schedule-day-highlight {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-light) 100%) !important;
}

.btn-add-small {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.btn-add-small:hover {
  background: rgba(255,255,255,0.3);
}

/* Body: time gutter + day columns side by side */
.schedule-body-wrapper {
  display: grid;
  grid-template-columns: 56px repeat(8, 1fr);
  border: 1px solid #e0e0e0;
  border-top: none;
  border-radius: 0 0 6px 6px;
}

/* Time labels */
.schedule-body-wrapper .schedule-time-gutter {
  border-right: 1px solid #e0e0e0;
}

.schedule-time-label {
  font-size: 0.72rem;
  color: #888;
  text-align: right;
  padding: 2px 6px 0 0;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

/* Day columns - position relative for absolute event blocks */
.schedule-day-col {
  position: relative;
  border-right: 1px solid #f0f0f0;
  min-height: 780px; /* 15 hours x 52px */
}

.schedule-day-col:last-child {
  border-right: none;
}

.schedule-col-highlight {
  background: rgba(178,34,52,0.03);
}

/* Hour grid lines */
.schedule-hour-line {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: #f0f0f0;
  pointer-events: none;
}

/* Event blocks - absolutely positioned within day column */
.schedule-event-block {
  position: absolute;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  font-size: 0.72rem;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.schedule-event-block:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  transform: scale(1.02);
  z-index: 10;
}

.schedule-event-inner {
  display: flex;
  align-items: flex-start;
  gap: 2px;
  flex-wrap: wrap;
}

.schedule-event-inner .event-emoji {
  font-size: 0.85rem;
  line-height: 1.2;
}

.schedule-event-title {
  font-weight: 600;
  font-size: 0.72rem;
  word-break: break-word;
  line-height: 1.3;
}

.schedule-event-time {
  font-size: 0.65rem;
  color: #555;
  margin-top: 1px;
}

/* ===== Day Cards View ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1024px) {
  .calendar-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .calendar-grid {
    grid-template-columns: 1fr;
  }
}

.calendar-day {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  min-height: 120px;
}

.calendar-day-highlight {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(178,34,52,0.2);
}

.calendar-day-header {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  color: var(--white);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-day-highlight .calendar-day-header {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-light) 100%);
}

.calendar-day-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.calendar-day-header .btn {
  padding: 2px 8px;
  font-size: 0.8rem;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
}

.calendar-day-header .btn:hover {
  background: rgba(255,255,255,0.3);
}

.calendar-day-events {
  padding: 8px;
}

.calendar-empty {
  color: #999;
  font-size: 0.85rem;
  text-align: center;
  padding: 16px 0;
  font-style: italic;
}

.calendar-event {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.calendar-event:last-child { margin-bottom: 0; }

.calendar-event:hover {
  background: #eef0f4;
  transform: translateX(2px);
}

.calendar-event-top {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.calendar-event-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.calendar-event-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #666;
  margin-top: 2px;
  flex-wrap: wrap;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .calendar-schedule {
    -webkit-overflow-scrolling: touch;
    /* Scroll hint shadow */
    background:
      linear-gradient(to right, white 30%, transparent),
      linear-gradient(to left, white 30%, transparent),
      linear-gradient(to right, rgba(0,0,0,0.15), transparent 60%),
      linear-gradient(to left, rgba(0,0,0,0.15), transparent 60%);
    background-position: left center, right center, left center, right center;
    background-repeat: no-repeat;
    background-size: 20px 100%, 20px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
  }
  .schedule-container {
    min-width: 700px;
  }
  .schedule-day-header {
    font-size: 0.7rem;
    padding: 6px 3px;
  }
  .schedule-event-title {
    font-size: 0.65rem;
  }
  .calendar-view-toggle .btn {
    min-height: 40px;
    padding: 8px 14px;
  }
  .calendar-event {
    padding: 10px 10px;
  }
  .calendar-event-title {
    font-size: 0.88rem;
  }
  .calendar-event-meta {
    font-size: 0.8rem;
  }
  .calendar-day-header {
    padding: 10px 12px;
  }
  .calendar-day-label {
    font-size: 0.85rem;
  }
}

@media (max-width: 380px) {
  .schedule-container {
    min-width: 600px;
  }
  .schedule-day-header {
    font-size: 0.6rem;
    padding: 4px 2px;
  }
}
