/**
 * CleanClaw — Schedule Builder Styles (S2.5)
 *
 * FullCalendar overrides + summary bar + side panel + team filter.
 * Matches CleanClaw design tokens from app.css.
 */

/* ===== Schedule Page Layout ===== */
.cc-schedule-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 0;
}

/* ===== Summary Bar ===== */
.cc-schedule-summary {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  background: #fff;
  border-bottom: 1px solid var(--color-neutral-200);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.cc-summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}

.cc-summary-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-neutral-900);
  line-height: 1.2;
}

.cc-summary-label {
  font-size: 12px;
  color: var(--color-neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cc-summary-warning {
  color: var(--color-warning) !important;
}

.cc-summary-clickable {
  cursor: pointer;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.cc-summary-clickable:hover {
  background: var(--color-neutral-100);
}

.cc-summary-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.cc-summary-sse {
  display: flex;
  align-items: center;
}

/* ===== Team Filter ===== */
.cc-team-filter {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  background: #fff;
  border-bottom: 1px solid var(--color-neutral-200);
  flex-shrink: 0;
  overflow-x: auto;
}

.cc-filter-label {
  font-size: 13px;
  color: var(--color-neutral-500);
  white-space: nowrap;
}

.cc-filter-chips {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.cc-filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  background: var(--color-neutral-100);
  transition: background 0.15s;
  white-space: nowrap;
}

.cc-filter-chip:hover {
  background: var(--color-neutral-200);
}

.cc-filter-chip input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--chip-color, var(--color-primary));
}

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

/* ===== Calendar Container ===== */
.cc-calendar-container {
  flex: 1;
  overflow: auto;
  padding: var(--spacing-md);
  background: #fff;
}

/* ===== FullCalendar Overrides ===== */

/* Header toolbar */
.fc .fc-toolbar {
  margin-bottom: var(--spacing-md) !important;
}

.fc .fc-toolbar-title {
  font-family: var(--font-display);
  font-size: 18px !important;
  font-weight: 600;
  color: var(--color-neutral-900);
}

.fc .fc-button {
  font-family: var(--font-primary) !important;
  font-size: 13px !important;
  padding: 6px 14px !important;
  border-radius: var(--radius-sm) !important;
  text-transform: none !important;
}

.fc .fc-button-primary {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary.fc-button-active {
  background-color: var(--color-primary-dark) !important;
  border-color: var(--color-primary-dark) !important;
}

.fc .fc-button-primary:not(:disabled):hover {
  background-color: var(--color-primary-dark) !important;
}

.fc .fc-today-button {
  background-color: #fff !important;
  color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
}

.fc .fc-today-button:hover {
  background-color: var(--color-primary-light) !important;
}

/* Resource area */
.fc .fc-resource-area {
  background: var(--color-neutral-50);
}

.fc .fc-datagrid-cell-main {
  font-size: 13px;
  font-weight: 500;
}

/* Time slots */
.fc .fc-timegrid-slot,
.fc .fc-timeline-slot {
  height: 28px;
}

.fc .fc-timegrid-slot-label {
  font-size: 11px;
  color: var(--color-neutral-500);
}

/* Events */
.fc-event {
  border-radius: var(--radius-sm) !important;
  border: none !important;
  font-size: 12px !important;
  cursor: pointer;
}

.fc-event:hover {
  opacity: 0.9;
  box-shadow: var(--shadow-2);
}

.cc-fc-event {
  padding: 2px 6px;
  overflow: hidden;
}

.cc-fc-event-time {
  font-size: 10px;
  opacity: 0.85;
}

.cc-fc-event-title {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-fc-event-address {
  font-size: 10px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status-specific event styles */
.cc-fc-status-cancelled {
  text-decoration: line-through;
  opacity: 0.5;
}

.cc-fc-status-completed {
  opacity: 0.6;
}

.cc-fc-status-in_progress {
  border-left: 3px solid var(--color-success) !important;
}

/* Today column highlight */
.fc .fc-day-today {
  background: var(--color-primary-light) !important;
  opacity: 0.3;
}

/* Now indicator */
.fc .fc-timegrid-now-indicator-line,
.fc .fc-timeline-now-indicator-line {
  border-color: var(--color-danger) !important;
}

.fc .fc-timegrid-now-indicator-arrow {
  border-color: var(--color-danger) !important;
}

/* Unassigned resource row */
.fc [data-resource-id="unassigned"] {
  background: #FFF8E1;
}

/* ===== Side Panel ===== */
.cc-side-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: var(--z-panel);
}

.cc-side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: #fff;
  box-shadow: var(--shadow-4);
  z-index: calc(var(--z-panel) + 1);
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.cc-side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-neutral-200);
}

.cc-side-panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-neutral-900);
}

.cc-side-panel-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-neutral-500);
  padding: 4px;
  line-height: 1;
}

.cc-side-panel-close:hover {
  color: var(--color-neutral-900);
}

.cc-side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.cc-side-panel-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-neutral-200);
  display: flex;
  gap: var(--spacing-sm);
}

.cc-panel-section {
  margin-bottom: var(--spacing-lg);
}

.cc-panel-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--spacing-sm);
}

.cc-panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-neutral-100);
}

.cc-panel-label {
  font-size: 13px;
  color: var(--color-neutral-500);
}

.cc-panel-value-lg {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-neutral-900);
}

/* Status badges */
.cc-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.cc-status-scheduled   { background: #DBEAFE; color: #2563EB; }
.cc-status-confirmed   { background: #DBEAFE; color: #2563EB; }
.cc-status-in_progress { background: #D1FAE5; color: #059669; }
.cc-status-completed   { background: var(--color-neutral-100); color: var(--color-neutral-500); }
.cc-status-cancelled   { background: #FEE2E2; color: #DC2626; }
.cc-status-rescheduled { background: #FEF3C7; color: #D97706; }
.cc-status-no_show     { background: #FEE2E2; color: #DC2626; }
.cc-status-draft       { background: var(--color-neutral-100); color: var(--color-neutral-500); }

/* ===== Undo Toast ===== */
.cc-undo-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--color-neutral-900);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  z-index: var(--z-toast);
  font-size: 14px;
  animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.cc-undo-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--color-primary-light);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.cc-undo-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  .cc-schedule-summary {
    padding: var(--spacing-sm) var(--spacing-md);
    gap: var(--spacing-sm);
  }

  .cc-summary-stat {
    min-width: 60px;
  }

  .cc-summary-value {
    font-size: 18px;
  }

  .cc-summary-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: var(--spacing-sm);
  }

  .cc-side-panel {
    width: 100vw;
  }

  .cc-calendar-container {
    padding: var(--spacing-sm);
  }

  /* Stack resource timeline vertically on mobile */
  .fc .fc-resource-area {
    width: 100px !important;
  }

  .fc .fc-toolbar {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .cc-undo-toast {
    bottom: 70px;
    left: var(--spacing-md);
    right: var(--spacing-md);
    transform: none;
  }
}
