/* ═══════════════════════════════════════════
   BASE RESET
   ═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  font-family: var(--font-primary);
  font-size: 0.8rem;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   APP BAR
   ═══════════════════════════════════════════ */
.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  padding: 0 12px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-bar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-2);
  border-radius: var(--radius-md);
  min-width: unset;
  font-size: unset;
  padding: 4px;
}
@media (prefers-reduced-motion: no-preference) {
  .app-bar-back { transition: color var(--transition-fast); }
}
.app-bar-back:hover { color: var(--color-cyan-dark); }
.app-bar-back:focus-visible {
  outline: 2px solid var(--color-cyan-dark);
  outline-offset: 2px;
}
.app-bar-back svg { display: block; }

.app-bar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.app-bar-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  display: block;
}

.app-bar-subtitle {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--color-cyan-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.app-bar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-cyan-dark));
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

/* Right slot: home button + avatar */
.app-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-bar-home {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.app-bar-home:hover {
  background: rgba(6, 182, 212, 0.1);
}
.app-bar-home:active {
  background: rgba(6, 182, 212, 0.2);
}
.app-bar-home svg { display: block; }

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
button {
  cursor: pointer;
  font-family: var(--font-primary);
  border: none;
  outline: none;
}
button:focus-visible {
  outline: 2px solid var(--color-cyan-dark);
  outline-offset: 2px;
}

.btn-primary {
  display: block;
  width: 100%;
  background: var(--color-cyan);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: none;
  min-width: unset;
  height: unset;
  font-family: var(--font-primary);
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  .btn-primary { transition: background var(--transition-fast); }
}
.btn-primary:hover  { background: var(--color-cyan-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: var(--color-text-3);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: block;
  width: 100%;
  background: var(--color-surface);
  color: var(--color-cyan-dark);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-cyan);
  min-width: unset;
  height: unset;
  font-family: var(--font-primary);
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  .btn-secondary { transition: background var(--transition-fast), border-color var(--transition-fast); }
}
.btn-secondary:hover { background: var(--color-cyan-light); }
.btn-secondary:active { transform: scale(0.98); }

/* ═══════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-3);
}

.form-input {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.85rem;
  font-family: var(--font-primary);
  color: var(--color-text);
  width: 100%;
  outline: none;
}
@media (prefers-reduced-motion: no-preference) {
  .form-input { transition: border-color var(--transition-fast); }
}
.form-input:focus { border-color: var(--color-cyan); }
.form-input::placeholder { color: var(--color-text-3); }
.form-input[readonly] {
  background: var(--color-border-2);
  color: var(--color-text-2);
  cursor: default;
}

/* ═══════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════ */
.loading {
  border: 3px solid var(--color-border);
  border-top-color: var(--color-cyan);
  width: 36px;
  height: 36px;
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .loading { animation: spin 0.8s linear infinite; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════
   CANCEL CONFIRM MODAL
   ═══════════════════════════════════════════ */
.cancel_confirm {
  display: none;
  justify-content: center;
  align-items: center;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.4);
}

.cancel_confirm_modal_content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  width: min(90%, 360px);
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

.cancel_confirm_modal_content p {
  margin: 0 0 16px;
}

.cancel_confirm_modal_content .btn-row {
  display: flex;
  gap: 10px;
}

.cancel_confirm_button_confirm {
  flex: 1;
  background: var(--color-cyan);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  min-width: unset;
  height: unset;
}
.cancel_confirm_button_confirm:hover { background: var(--color-cyan-dark); }

.cancel_confirm_button_cancel {
  flex: 1;
  background: var(--color-surface);
  color: var(--color-text-2);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  cursor: pointer;
  font-family: var(--font-primary);
  min-width: unset;
  height: unset;
}
.cancel_confirm_button_cancel:hover { background: var(--color-bg); }

/* Compat aliases for inline styles already in pages */
button.primary {
  background: var(--color-cyan);
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: 11px 16px;
  font-family: var(--font-primary);
  cursor: pointer;
  min-width: unset;
  height: unset;
  font-size: 0.85rem;
}
button.primary:hover { background: var(--color-cyan-dark); }
button.disabled {
  background: var(--color-text-3);
  cursor: not-allowed;
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
button.primary:focus-visible {
  outline: 2px solid var(--color-cyan-dark);
  outline-offset: 2px;
}

/* ── Therapist selected (collapsed row) ── */
.ca-therapist-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.ca-therapist-selected-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-cyan, #06b6d4);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ca-therapist-selected-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text, #0f172a);
}

.ca-therapist-selected-change {
  background: none;
  border: none;
  color: var(--color-cyan, #06b6d4);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
  font-family: inherit;
}

.ca-therapist-selected-change:hover {
  color: var(--color-cyan-dark, #0891b2);
}

.ca-therapist-selected-change:active {
  opacity: 0.7;
}

.ca-therapist-selected-change:focus-visible {
  outline: 2px solid var(--color-cyan-dark, #0891b2);
  outline-offset: 2px;
  border-radius: 2px;
}
