.schedule {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-16);
}

/* View Switcher */
.schedule__switcher {
  display: flex;
  gap: var(--space-1);
  background: var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  margin-bottom: var(--space-4);
}

.schedule__switcher-tab {
  flex: 1;
  text-align: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-foreground-muted);
  text-decoration: none;
  transition: all 0.15s ease;

  &:hover {
    color: var(--color-foreground);
  }

  &--active {
    background: var(--color-background-card);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
  }
}

/* Date Navigation */
.schedule__date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.schedule__nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-foreground-muted);
  text-decoration: none;
  transition: background 0.15s;

  &:hover {
    background: var(--color-border);
  }
}

.schedule__date-label {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-foreground);
}

.schedule__today-badge {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

/* Events List */
.schedule__events {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.schedule__event {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-background-card);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
}

.schedule__event-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-foreground-muted);
  min-width: 72px;
}

.schedule__event-emoji {
  font-size: 1.5rem;
}

.schedule__event-name {
  flex: 1;
  font-weight: 600;
  color: var(--color-foreground);
}

.schedule__event-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  color: var(--color-foreground-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;

  &:hover {
    background: #fef2f2;
    color: var(--color-destructive);
  }
}

.schedule__empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-foreground-muted);
  font-size: 0.9rem;
}

/* Add Button */
.schedule__add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3);
  background: var(--gradient-warm);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.15s;

  &:hover {
    opacity: 0.9;
  }
}

/* Overlay (bottom sheet style) */
.schedule__overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
}

.schedule__overlay[hidden] {
  display: none;
}

.schedule__overlay-content {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--color-background-card);
  border-radius: var(--radius-3xl);
  padding: var(--space-4) var(--space-4) var(--space-8);
  margin: var(--space-4);
}

.schedule__overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.schedule__overlay-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-foreground);
}

.schedule__overlay-cancel {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Activity Picker Grid */
.schedule__frequency-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-foreground-muted);
  margin: var(--space-3) 0 var(--space-2);
}

.schedule__activity-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.schedule__activity-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--color-background);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;

  &:hover {
    border-color: var(--color-primary);
    background: var(--color-background-card);
  }
}

.schedule__activity-emoji {
  font-size: 1.5rem;
}

.schedule__activity-photo {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.schedule__event-photo {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.schedule__selected-photo {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: cover;
  border-radius: var(--radius-md);
  vertical-align: middle;
  margin-inline-end: 0.25rem;
}

.schedule__activity-name {
  font-weight: 600;
  font-size: 0.7rem;
  color: var(--color-foreground);
  line-height: 1.2;
}

/* Time Picker */
.schedule__selected-label {
  text-align: center;
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  color: var(--color-foreground);
}

.schedule__time-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.schedule__time-select {
  flex: 1;
  padding: var(--space-3);
  background: var(--color-background);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-foreground);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237a6e63' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);

  &:focus {
    outline: none;
    border-color: var(--color-primary);
  }
}

.schedule__time-submit {
  margin-top: var(--space-4);

  & .btn-primary {
    width: 100%;
    border: none;
    cursor: pointer;
    padding: var(--space-3);
    font-size: 1rem;
  }

  & .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

/* Year Grid */
.schedule__year-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.schedule__month-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-2);
  background: var(--color-background-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: all 0.15s;

  &:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }

  &--current {
    border: 2px solid var(--color-primary);
  }
}

.schedule__month-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-foreground);
}

.schedule__month-count {
  font-size: 0.75rem;
  color: var(--color-foreground-muted);
}

/* simple_calendar overrides */
.simple-calendar__table {
  width: 100%;
  border-collapse: separate;
  border-spacing: var(--space-1);

  & thead th {
    padding: var(--space-2);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-foreground-muted);
    text-align: center;
    text-transform: uppercase;
  }

  & tbody td {
    padding: var(--space-1);
    vertical-align: middle;
    text-align: center;
    height: 56px;
    background: var(--color-background-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
  }

  & .today {
    background: var(--color-background);
    border-color: var(--color-primary);
  }

  & .other-month {
    background: transparent;
    border-color: transparent;
    opacity: 0.35;
  }
}

.schedule__cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
}

.schedule__cal-date {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-foreground);
  text-decoration: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);

  &:hover {
    background: var(--color-border);
  }

  &--today {
    background: var(--color-primary);
    color: white;

    &:hover {
      background: var(--color-primary);
      opacity: 0.9;
    }
  }
}

.schedule__cal-count {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-border);
  border-radius: var(--radius-full);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
