/* Horsepal Calendar */

.cal-page-header {
  margin-bottom: 1.25rem;
}

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 12px 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.25rem;
}

.cal-toolbar-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  background: #f8f9fb;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  min-width: 140px;
}

.cal-toolbar-filter:hover {
  border-color: #24e290;
  background: rgba(36, 226, 144, 0.06);
}

.cal-filter-avatar,
.cal-filter-thumb,
.cal-event-horse-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e9ecef;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.cal-filter-label {
  font-weight: 600;
  color: #343a40;
  font-size: 15px;
}

.cal-toolbar-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 220px;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  background: #fff;
  color: #495057;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.cal-nav-btn:hover {
  border-color: #24e290;
  color: #24e290;
  background: rgba(36, 226, 144, 0.08);
}

.cal-week-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #212529;
  min-width: 120px;
  text-align: center;
}

.cal-week-title-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 140px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #212529;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cal-week-title-btn:hover {
  background: rgba(36, 226, 144, 0.1);
  border-color: rgba(36, 226, 144, 0.35);
}

.cal-week-title-btn i {
  font-size: 18px;
  color: #24e290;
}

.cal-date-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cal-date-modal-body .datepicker {
  width: 100%;
  max-width: 280px;
}

.cal-date-modal-body .datepicker-inline {
  width: 100%;
}

.cal-date-modal-body table {
  width: 100%;
}

.cal-date-modal-body .datepicker table tr td.active,
.cal-date-modal-body .datepicker table tr td.active:hover,
.cal-date-modal-body .datepicker table tr td.active.disabled,
.cal-date-modal-body .datepicker table tr td.active.disabled:hover {
  background: #24e290 !important;
  background-image: none;
}

.cal-date-modal-body .datepicker table tr td.today {
  background: rgba(36, 226, 144, 0.2) !important;
  color: #1a9d63;
}

.cal-btn-today {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  border: none;
  background: rgba(36, 226, 144, 0.15);
  color: #1a9d63;
}

.cal-btn-today:hover {
  background: #24e290;
  color: #fff;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: #6c757d;
  margin-left: auto;
}

.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.cal-dot-event {
  background: #24e290;
}

.cal-dot-training {
  background: #4f8cff;
}

.cal-week-card {
  border: none;
  border-radius: 18px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.cal-week-card .card-body {
  padding: 8px 16px 16px;
}

.cal-day-row {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f1f3;
  animation: calDayIn 0.3s ease both;
}

.cal-day-row:last-child {
  border-bottom: none;
}

@keyframes calDayIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cal-day-row:nth-child(1) { animation-delay: 0.02s; }
.cal-day-row:nth-child(2) { animation-delay: 0.04s; }
.cal-day-row:nth-child(3) { animation-delay: 0.06s; }
.cal-day-row:nth-child(4) { animation-delay: 0.08s; }
.cal-day-row:nth-child(5) { animation-delay: 0.1s; }
.cal-day-row:nth-child(6) { animation-delay: 0.12s; }
.cal-day-row:nth-child(7) { animation-delay: 0.14s; }

.cal-day-today {
  background: linear-gradient(90deg, rgba(36, 226, 144, 0.1) 0%, rgba(36, 226, 144, 0.02) 100%);
  border-radius: 14px;
  margin: 4px -10px;
  padding: 14px 10px;
  border-bottom-color: transparent;
}

.cal-day-col {
  flex-shrink: 0;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cal-day-pill {
  width: 52px;
  text-align: center;
  padding: 8px 4px;
  border-radius: 14px;
  background: #f4f5f7;
}

.cal-day-today .cal-day-pill {
  background: #24e290;
  color: #fff;
  box-shadow: 0 4px 12px rgba(36, 226, 144, 0.35);
}

.cal-day-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

.cal-day-num {
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.cal-day-today .cal-day-name,
.cal-day-today .cal-day-num {
  opacity: 1;
  color: #fff;
}

.cal-day-badge-today {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #1a9d63;
  margin-top: 4px;
}

.cal-day-today .cal-day-badge-today {
  color: #fff;
  opacity: 0.9;
}

.cal-day-events {
  flex: 1;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cal-day-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 1px dashed #dee2e6;
  border-radius: 12px;
  color: #adb5bd;
  font-size: 13px;
  background: #fafbfc;
}

.cal-event-card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 12px 14px 12px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.cal-event-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
  background: var(--cal-accent, #24e290);
}

.cal-event-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  border-color: rgba(36, 226, 144, 0.35);
}

.cal-event-card.cal-type-0 { --cal-accent: #24e290; }
.cal-event-card.cal-type-1 { --cal-accent: #8b5cf6; }
.cal-event-card.cal-type-2 { --cal-accent: #a16207; }
.cal-event-card.cal-type-3 { --cal-accent: #0ea5e9; }
.cal-event-card.cal-type-4 { --cal-accent: #ef4444; }
.cal-event-card.cal-type-5 { --cal-accent: #f97316; }
.cal-event-card.cal-type-6 { --cal-accent: #06b6d4; }
.cal-event-card.cal-type-7 { --cal-accent: #84cc16; }
.cal-event-card.cal-type-8 { --cal-accent: #64748b; }
.cal-event-card.cal-type-9 { --cal-accent: #6b7280; }

.cal-training-card {
  --cal-accent: #4f8cff;
}

.cal-training-card::before {
  background: linear-gradient(180deg, #4f8cff 0%, #2563eb 100%);
}

.cal-event-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.cal-event-type-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  background: rgba(36, 226, 144, 0.12);
  color: #1a9d63;
}

.cal-training-card .cal-event-type-pill {
  background: rgba(79, 140, 255, 0.12);
  color: #2563eb;
}

.cal-type-1 .cal-event-type-pill { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.cal-type-2 .cal-event-type-pill { background: rgba(161, 98, 7, 0.12); color: #a16207; }
.cal-type-3 .cal-event-type-pill { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.cal-type-4 .cal-event-type-pill { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.cal-type-5 .cal-event-type-pill { background: rgba(249, 115, 22, 0.12); color: #ea580c; }
.cal-type-6 .cal-event-type-pill { background: rgba(6, 182, 212, 0.12); color: #0891b2; }
.cal-type-7 .cal-event-type-pill { background: rgba(132, 204, 22, 0.12); color: #65a30d; }
.cal-type-8 .cal-event-type-pill { background: rgba(100, 116, 139, 0.12); color: #475569; }
.cal-type-9 .cal-event-type-pill { background: rgba(107, 114, 128, 0.12); color: #4b5563; }

.cal-event-horse {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cal-event-horse-name {
  font-weight: 600;
  font-size: 13px;
  color: #495057;
}

.cal-event-title {
  font-weight: 700;
  font-size: 15px;
  color: #212529;
  line-height: 1.3;
}

.cal-event-meta {
  font-size: 12px;
  color: #6c757d;
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cal-event-meta i {
  font-size: 14px;
  vertical-align: -2px;
}

.cal-training-stats {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #f0f4ff;
  border-radius: 6px;
  color: #2563eb;
  font-weight: 600;
}

#cal-add-btn {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  font-size: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #24e290 !important;
  border: none;
  box-shadow: 0 6px 20px rgba(36, 226, 144, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#cal-add-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 28px rgba(36, 226, 144, 0.55);
}

.cal-filter-horse {
  padding: 12px 16px !important;
}

.cal-filter-horse:hover {
  background: rgba(36, 226, 144, 0.06);
}

@media (max-width: 768px) {
  .cal-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cal-legend {
    margin-left: 0;
    justify-content: center;
  }

  .cal-toolbar-nav {
    order: -1;
  }

  .cal-day-col {
    width: 52px;
  }

  .cal-day-pill {
    width: 46px;
  }
}
