* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
}

/* Calendar day cell */
.calendar-cell {
  min-height: 100px;
  padding: 6px;
  border-right: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  transition: background-color 0.2s;
  position: relative;
}

.calendar-cell:hover {
  background-color: rgba(255,255,255,0.04);
}

.calendar-cell.other-month {
  opacity: 0.25;
  pointer-events: none;
}

.calendar-cell.past {
  opacity: 0.5;
  cursor: not-allowed;
}

.calendar-cell.past:hover {
  background-color: transparent;
}

.calendar-cell.today {
  background-color: rgba(59, 130, 246, 0.08);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.calendar-cell.has-event {
  cursor: pointer;
}

.day-number {
  font-size: 0.875rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 4px;
}

.calendar-cell.today .day-number {
  background-color: #3b82f6;
  color: white;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.cell-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.event-tag {
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: 500;
}

.event-tag.practice {
  background-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.event-tag.match {
  background-color: rgba(251, 146, 60, 0.2);
  color: #fdba74;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.event-tag.holiday {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.event-tag.other {
  background-color: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.attendance-badge {
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 3px;
  background-color: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Responsive cells */
@media (min-width: 640px) {
  .calendar-cell {
    min-height: 110px;
    padding: 8px;
  }
  .event-tag, .attendance-badge {
    font-size: 0.7rem;
    padding: 1px 6px;
  }
}

@media (min-width: 768px) {
  .calendar-cell {
    min-height: 120px;
    padding: 10px;
  }
}

@media (min-width: 1024px) {
  .calendar-cell {
    min-height: 130px;
    padding: 12px;
  }
  .event-tag, .attendance-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* Custom select styling */
select option {
  background: #1e293b;
}

/* Input date picker dark mode */
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background-color: rgba(16, 185, 129, 0.9);
  color: white;
  backdrop-filter: blur(8px);
}
/* Attendance inline display */
.attendance-inline {
  font-size: 0.6rem;
  color: #6ee7b7;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  padding: 1px 2px;
}

@media (min-width: 640px) {
  .attendance-inline {
    font-size: 0.65rem;
  }
}

/* Date Picker Popup */
.date-picker-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  width: 280px;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.date-picker-popup.hidden {
  display: none;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dp-nav {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.15s;
}

.dp-nav:hover {
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
}

.dp-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
}

.dp-days-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.7rem;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 4px;
}

.dp-days-row span {
  padding: 4px 0;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day {
  text-align: center;
  padding: 6px 2px;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  color: #cbd5e1;
  transition: all 0.15s;
  border: none;
  background: transparent;
}

.dp-day:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #e2e8f0;
}

.dp-day.other-month {
  color: #475569;
  pointer-events: none;
}

.dp-day.today {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  font-weight: 600;
}

.dp-day.selected {
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  font-weight: 700;
}

.dp-day.selected:hover {
  background: rgba(139, 92, 246, 0.35);
}

/* ===== Day Detail Modal ===== */
.day-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.day-modal.hidden {
  display: none;
}

.day-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.day-modal-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  background: #1e293b;
  border-radius: 20px 20px 0 0;
  border: 1px solid rgba(255,255,255,0.1);
  border-bottom: none;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 640px) {
  .day-modal {
    align-items: center;
  }
  .day-modal-panel {
    border-radius: 20px;
    max-height: 80vh;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    animation: fadeIn 0.2s ease-out;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.day-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: #94a3b8;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
}

.day-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 60px;
}

.day-modal-footer {
  flex-shrink: 0;
  padding: 12px 20px 20px;
}

.modal-signup-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-signup-btn.signup {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white;
}

.modal-signup-btn.signup:hover {
  background: linear-gradient(135deg, #047857, #059669);
}

.modal-signup-btn.cancel {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: white;
}

.modal-signup-btn.cancel:hover {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.modal-signup-btn.past {
  background: rgba(255,255,255,0.08);
  color: #64748b;
  cursor: not-allowed;
}

.modal-holiday {
  padding: 10px 14px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.modal-event {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.modal-event.practice {
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  color: #93c5fd;
}

.modal-event.match {
  background: rgba(251,146,60,0.12);
  border: 1px solid rgba(251,146,60,0.25);
  color: #fdba74;
}

.modal-event.other {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
}

.modal-attendance-title {
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6ee7b7;
  margin-bottom: 4px;
}

.modal-attendance-list {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.modal-no-attendance {
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
  padding: 20px 0;
}

/* ===== Mobile Compact Calendar Cells ===== */
.mobile-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 1px;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.dot-practice { background: #3b82f6; }
.dot.dot-match { background: #fb923c; }
.dot.dot-red { background: #ef4444; }
.dot.dot-attendance { background: #10b981; }
.dot.dot-other { background: #e2e8f0; }

/* On mobile, hide rich cell content and show compact view */
@media (max-width: 639px) {
  .calendar-cell {
    min-height: 50px;
    padding: 3px;
  }
  .calendar-cell .cell-content .event-tag,
  .calendar-cell .cell-content .attendance-inline {
    display: none;
  }
  .day-number {
    font-size: 0.75rem;
    margin-bottom: 1px;
  }
  .calendar-cell.today .day-number {
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
  }
  .day-modal-panel {
    width: 100%;
    border-radius: 16px 16px 0 0;
  }
}

.toast.error {
  background-color: rgba(239, 68, 68, 0.9);
  color: white;
  backdrop-filter: blur(8px);
}

.toast.info {
  background-color: rgba(59, 130, 246, 0.9);
  color: white;
  backdrop-filter: blur(8px);
}
