/* 全站樣式 9/16：自訂日曆元件、老師快速日期、手機模擬框、TimeTree 風格行事曆、活動類型卡 */
/* ============================================
   自訂日曆元件
   ============================================ */
.custom-calendar {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--separator);
  user-select: none;
}

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

.cal-header .cal-title {
  font-size: 1.0625rem;
  font-weight: 700;
}

.cal-header button {
  background: none;
  border: none;
  font-size: 1.375rem;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
}

.cal-header button:active {
  background: rgba(0,122,255,0.1);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
}

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  font-weight: 500;
  transition: background 0.15s;
}

.cal-day:hover {
  background: rgba(0,0,0,0.05);
}

.cal-day.empty {
  cursor: default;
}

.cal-day.empty:hover {
  background: none;
}

.cal-day.today {
  color: var(--accent);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.cal-day.has-record::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.cal-day.selected.has-record::after {
  background: white;
}

.cal-day.other-month {
  color: var(--separator);
}

.cal-today-btn {
  display: block;
  margin: 10px auto 0;
  padding: 6px 20px;
  background: none;
  border: 1px solid var(--accent);
  border-radius: 16px;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.cal-today-btn:active {
  background: rgba(0,122,255,0.1);
}

/* 老師快速日期選擇器 */
.quick-dates {
  background: var(--card);
  border-radius: 16px;
  padding: 12px 12px 8px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
}
.quick-dates-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
}
.quick-dates-header .qd-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.quick-dates-header button {
  background: none;
  border: 1px solid var(--separator);
  border-radius: 16px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
}
.quick-dates-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: none;
  will-change: scroll-position;
}
.quick-dates-scroll::-webkit-scrollbar { display: none; }
.qd-item {
  flex-shrink: 0;
  scroll-snap-align: center;
  width: 48px;
  padding: 6px 2px 5px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: transparent;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.qd-item:active { transform: scale(0.93); }
.qd-item .qd-weekday {
  font-size: 0.6rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.5px;
}
.qd-item .qd-day {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}
.qd-item .qd-month {
  font-size: 0.55rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.qd-item .qd-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--green);
  margin: 2px auto 0;
}
.qd-item.today .qd-day {
  color: var(--accent);
}
.qd-item.selected {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,122,255,0.25);
}
.qd-item.selected .qd-weekday,
.qd-item.selected .qd-day,
.qd-item.selected .qd-month { color: white; }
.qd-item.selected .qd-dot { background: rgba(255,255,255,0.8); }
.qd-item.cancelled { opacity: 0.4; }
.qd-item.cancelled .qd-day { text-decoration: line-through; color: var(--red); }
.qd-item.selected.cancelled .qd-day { color: white; text-decoration: line-through; }

/* 點名卡片優化 */
.att-card {
  will-change: transform;
  transform: translateZ(0);
  -webkit-tap-highlight-color: transparent;
}
.att-card:active {
  transform: scale(0.95) !important;
}

/* 收費系統 - 班級選擇卡片 active 狀態 */
#fee-assign-class-grid .class-card.active {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
}

/* 手機模擬框（iPhone 風格） */
.phone-frame {
  width: 300px;
  height: 620px;
  border-radius: 44px;
  border: 8px solid #2D2A26;
  background: #2D2A26;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 0 0 2px #2D2A26,
    0 12px 48px rgba(0,0,0,0.2),
    inset 0 0 0 1px rgba(255,255,255,0.05);
}
.phone-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 22px;
  background: #2D2A26;
  border-radius: 0 0 16px 16px;
  z-index: 10;
}
.phone-notch::after {
  content: '';
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2D2A26;
}
.phone-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 36px;
  background: var(--bg);
}
.phone-frame::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  border-radius: 2px;
  background: #2D2A26;
}

/* ===== TimeTree 風格行事曆 ===== */
.tt-calendar {
  background: var(--card);
  border-radius: 16px;
  padding: 16px 12px 12px;
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
  overflow: hidden;
  max-width: 100%;
}
.tt-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
}
.tt-cal-header .tt-cal-title {
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--text);
}
.tt-cal-header button {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  font-family: inherit;
}
.tt-cal-header button:hover { background: var(--separator); }
.tt-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 4px;
}
.tt-cal-weekdays div {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 4px 0;
}
.tt-cal-weekdays div:first-child { color: #CF4130; }
.tt-cal-weekdays div:last-child { color: #3872B8; }
.tt-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  transition: opacity 0.2s ease;
}
.tt-day {
  min-height: 68px;
  padding: 3px 1px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
  min-width: 0;
  overflow: hidden;
}
.tt-day:hover { background: rgba(0,0,0,0.03); }
.tt-day.empty { cursor: default; min-height: 0; }
.tt-day.empty:hover { background: none; }
.tt-day.selected { background: rgba(244,162,97,0.1); }
.tt-day-num {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  width: 26px; height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-bottom: 2px;
  color: var(--text);
}
.tt-day.sunday .tt-day-num { color: #CF4130; }
.tt-day.saturday .tt-day-num { color: #3872B8; }
.tt-day.today .tt-day-num {
  background: var(--accent);
  color: #fff !important;
  font-weight: 800;
}
.tt-day.other-month .tt-day-num { color: var(--separator); }
.tt-day-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 0 2px;
  margin-top: 2px;
}
.tt-evt-bar {
  height: 15px;
  border-radius: 8px;
  width: 100%;
  padding: 0 4px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.tt-evt-label {
  font-size: 0.62rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  pointer-events: none;
}
.tt-day-more {
  font-size: 0.52rem;
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1;
  margin-top: 1px;
}
.tt-today-btn {
  display: block;
  margin: 10px auto 0;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: none;
  border-radius: 16px;
  padding: 5px 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.tt-today-btn:hover { background: rgba(244,162,97,0.08); }

/* 事件卡片 */
.tt-event-card {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(60,40,20,.08);
  transition: transform 0.1s;
  cursor: default;
}
.tt-event-card:active { transform: scale(0.985); }
.tt-event-stripe {
  width: 5px;
  border-radius: 8px;
  min-height: 40px;
  flex-shrink: 0;
}
.tt-event-body { flex: 1; min-width: 0; }
.tt-event-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.tt-event-title {
  font-weight: 700;
  font-size: 1.0625rem;
  margin-bottom: 4px;
  color: var(--text);
  line-height: 1.3;
}
.tt-event-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.tt-event-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

/* 顏色設定 */
.tt-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.tt-color-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 12px;
  position: relative;
}
.tt-color-item input[type="color"] {
  width: 36px; height: 36px;
  border: 2px solid var(--separator);
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
  background: none;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
.tt-color-item input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.tt-color-item input[type="color"]::-webkit-color-swatch { border-radius: 8px; border: none; }
.tt-color-item input[type="color"]::-moz-color-swatch { border-radius: 8px; border: none; }
.tt-color-item label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 480px) {
  .tt-day { min-height: 60px; }
  .tt-evt-bar { height: 13px; }
  .tt-evt-label { font-size: 0.58rem; }
  .tt-day-num { font-size: 0.75rem; width: 24px; height: 24px; }
  .tt-color-grid { grid-template-columns: 1fr 1fr; }
}

/* ====== 活動類型卡片選擇器 ====== */
.evt-type-picker {
  display:flex; flex-direction:column; gap:6px;
}
.evt-type-group  { display:flex; flex-direction:column; gap:4px; }
.evt-type-group-label {
  font-size:0.75rem; font-weight:700;
  color:var(--text-secondary); letter-spacing:0.06em;
  padding:0 2px; margin-top:2px;
}
.evt-type-cards { display:flex; flex-wrap:wrap; gap:5px; }
.evt-type-card {
  display:flex; align-items:center; gap:5px;
  padding:5px 10px; border-radius:16px;
  border:1.5px solid var(--separator);
  background:var(--card);
  cursor:pointer; font-size:0.75rem; font-weight:600;
  color:var(--text); transition:var(--transition);
  -webkit-tap-highlight-color:transparent;
  user-select:none;
}
.evt-type-card:hover { border-color:var(--accent); }
.evt-type-card:active { opacity:0.75; }
.evt-type-card .type-dot {
  width:8px; height:8px; border-radius:50%; flex-shrink:0;
}
.evt-type-card.active { border-color:transparent; color:white; }

