/* Olga's Studio Assistant — chat widget styles
 * Self-contained. Inherits Cormorant Garamond / Manrope from host page.
 * Palette aligns with site CSS variables; values duplicated for resilience.
 */

:root {
  --osa-olive: #4a4d2e;
  --osa-olive-deep: #353720;
  --osa-olive-soft: #6b6e4d;
  --osa-canvas: #f7f5ee;
  --osa-surface-soft: #efece1;
  --osa-surface-card: #e8e3d2;
  --osa-hairline: #ddd6c0;
  --osa-hairline-soft: #e6e0cd;
  --osa-primary: #d8a5a0;
  --osa-primary-soft: #ecd0cc;
  --osa-on-primary: #2a1f1d;
  --osa-ink: #2b2c1e;
  --osa-body: #4f5040;
  --osa-muted: #76755f;
  --osa-on-dark: #f7f5ee;
}

/* ── Launcher button (closed state) ── */
.osa-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--osa-olive);
  color: var(--osa-on-dark);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(43, 44, 30, 0.28);
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 220ms ease, background-color 200ms ease;
  font-family: inherit;
}
.osa-launcher:hover {
  transform: scale(1.06);
  background: var(--osa-olive-deep);
  box-shadow: 0 16px 36px rgba(43, 44, 30, 0.36);
}
.osa-launcher:focus-visible {
  outline: 3px solid var(--osa-primary);
  outline-offset: 3px;
}
.osa-launcher svg {
  width: 28px;
  height: 28px;
  display: block;
}
.osa-launcher.is-hidden {
  display: none;
}
.osa-launcher__dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--osa-primary);
  border: 2px solid var(--osa-olive);
  display: none;
}
.osa-launcher.has-unread .osa-launcher__dot {
  display: block;
}

/* ── Panel (open state) ── */
.osa-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 48px);
  background: var(--osa-canvas);
  border-radius: 18px;
  border: 1px solid var(--osa-hairline);
  box-shadow: 0 24px 60px rgba(43, 44, 30, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--osa-body);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 220ms ease, transform 260ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.osa-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── Header ── */
.osa-header {
  padding: 18px 20px;
  background: var(--osa-olive);
  color: var(--osa-on-dark);
  display: flex;
  align-items: center;
  gap: 12px;
}
.osa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--osa-primary);
  overflow: hidden;
  flex-shrink: 0;
}
.osa-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.osa-header-text {
  flex: 1;
  min-width: 0;
}
.osa-header-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.2;
}
.osa-header-sub {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}
.osa-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8fb572;
  margin-right: 6px;
  vertical-align: middle;
}
.osa-close {
  background: transparent;
  border: 0;
  color: var(--osa-on-dark);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0.7;
  transition: opacity 160ms ease, background-color 160ms ease;
}
.osa-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}
.osa-close svg {
  width: 18px;
  height: 18px;
}

/* ── Message log ── */
.osa-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: var(--osa-canvas);
}
.osa-log::-webkit-scrollbar {
  width: 6px;
}
.osa-log::-webkit-scrollbar-track {
  background: transparent;
}
.osa-log::-webkit-scrollbar-thumb {
  background: var(--osa-hairline);
  border-radius: 3px;
}

.osa-msg {
  max-width: 85%;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: osa-msg-in 280ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes osa-msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.osa-msg--bot {
  align-self: flex-start;
  background: var(--osa-surface-soft);
  color: var(--osa-ink);
  border-bottom-left-radius: 4px;
}
.osa-msg--user {
  align-self: flex-end;
  background: var(--osa-primary);
  color: var(--osa-on-primary);
  border-bottom-right-radius: 4px;
}
.osa-msg a {
  color: var(--osa-olive);
  text-decoration: underline;
}
.osa-msg--user a {
  color: var(--osa-on-primary);
}
.osa-msg strong {
  font-weight: 600;
}
.osa-msg p {
  margin: 0;
}
.osa-msg p + p {
  margin-top: 8px;
}
.osa-msg ul,
.osa-msg ol {
  margin: 6px 0;
  padding-left: 20px;
}
.osa-msg li {
  margin-bottom: 2px;
}

/* ── Typing indicator ── */
.osa-typing {
  align-self: flex-start;
  background: var(--osa-surface-soft);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.osa-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--osa-olive-soft);
  animation: osa-typing 1.2s infinite ease-in-out;
}
.osa-typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.osa-typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes osa-typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ── Newsletter card (inline subscribe in chat) ── */
.osa-newsletter-card {
  align-self: stretch;
  background: var(--osa-surface-soft);
  border: 1px solid var(--osa-hairline);
  border-radius: 14px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
}
.osa-newsletter-card__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  color: var(--osa-ink);
}
.osa-newsletter-card__hint {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--osa-muted);
  line-height: 1.5;
}
.osa-newsletter-card__email {
  width: 100%;
  border: 1px solid var(--osa-hairline);
  background: var(--osa-canvas);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--osa-ink);
  outline: 0;
  transition: border-color 160ms ease, box-shadow 200ms ease;
}
.osa-newsletter-card__email:focus {
  border-color: var(--osa-olive);
  box-shadow: 0 0 0 3px rgba(74, 77, 46, 0.12);
}
.osa-newsletter-card__consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--osa-body);
  cursor: pointer;
}
.osa-newsletter-card__consent-box {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.osa-newsletter-card__consent a {
  color: var(--osa-olive);
  text-decoration: underline;
}
.osa-newsletter-card__submit {
  align-self: flex-start;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--osa-olive);
  color: var(--osa-on-dark);
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 160ms ease, transform 180ms ease;
}
.osa-newsletter-card__submit:hover:not(:disabled) {
  background: var(--osa-olive-deep);
  transform: translateY(-1px);
}
.osa-newsletter-card__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.osa-newsletter-card__status {
  font-size: 12.5px;
  color: var(--osa-muted);
  min-height: 16px;
}
.osa-newsletter-card__sent {
  font-size: 14px;
  color: var(--osa-olive);
  text-align: center;
  padding: 6px 0;
}

/* ── Booking lead card (inline form in chat) ── */
.osa-booking-card {
  align-self: stretch;
  background: var(--osa-canvas);
  border: 1px solid var(--osa-olive);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 2px;
  box-shadow: 0 8px 24px -16px rgba(43, 44, 30, 0.18);
}
.osa-booking-card__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 19px;
  color: var(--osa-ink);
}
.osa-booking-card__hint {
  margin: -4px 0 4px;
  font-size: 12.5px;
  color: var(--osa-muted);
  line-height: 1.5;
}
.osa-booking-card__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.osa-booking-card__row label {
  font-size: 12px;
  font-weight: 500;
  color: var(--osa-body);
  letter-spacing: 0.2px;
}
.osa-booking-card__row input,
.osa-booking-card__row textarea {
  width: 100%;
  border: 1px solid var(--osa-hairline);
  background: var(--osa-canvas);
  border-radius: 10px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--osa-ink);
  outline: 0;
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 200ms ease;
}
.osa-booking-card__row textarea {
  min-height: 52px;
}
.osa-booking-card__row input:focus,
.osa-booking-card__row textarea:focus {
  border-color: var(--osa-olive);
  box-shadow: 0 0 0 3px rgba(74, 77, 46, 0.12);
}
.osa-booking-card__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}
.osa-booking-card__send,
.osa-booking-card__cancel {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  border: 1px solid var(--osa-hairline);
  transition: background-color 160ms ease, transform 180ms ease, border-color 160ms ease;
}
.osa-booking-card__send {
  background: var(--osa-olive);
  color: var(--osa-on-dark);
  border-color: var(--osa-olive);
}
.osa-booking-card__send:hover:not(:disabled) {
  background: var(--osa-olive-deep);
  transform: translateY(-1px);
}
.osa-booking-card__send:disabled,
.osa-booking-card__cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.osa-booking-card__cancel {
  background: transparent;
  color: var(--osa-ink);
}
.osa-booking-card__cancel:hover:not(:disabled) {
  background: var(--osa-surface-soft);
}
.osa-booking-card__status {
  font-size: 12.5px;
  color: var(--osa-primary-active);
  min-height: 16px;
}
.osa-booking-card__sent {
  font-size: 14px;
  color: var(--osa-olive);
  text-align: center;
  padding: 8px 0;
  line-height: 1.5;
}

/* ── Action chip (book / whatsapp / studio) ── */
.osa-action {
  align-self: flex-start;
  margin-top: 2px;
}
.osa-action a,
.osa-action button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--osa-hairline);
  background: var(--osa-canvas);
  color: var(--osa-ink);
  text-decoration: none;
  transition: transform 180ms ease, background-color 160ms ease,
    border-color 160ms ease;
}
.osa-action a:hover,
.osa-action button:hover {
  transform: translateY(-1px);
  background: var(--osa-surface-soft);
  border-color: var(--osa-olive-soft);
  text-decoration: none;
}
.osa-action--primary a,
.osa-action--primary button {
  background: var(--osa-olive);
  color: var(--osa-on-dark);
  border-color: var(--osa-olive);
}
.osa-action--primary a:hover,
.osa-action--primary button:hover {
  background: var(--osa-olive-deep);
  border-color: var(--osa-olive-deep);
}
.osa-action svg {
  width: 16px;
  height: 16px;
}

/* ── Error fallback ── */
.osa-error {
  align-self: stretch;
  background: var(--osa-primary-soft);
  border: 1px solid var(--osa-primary);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--osa-on-primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.osa-error a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  font-weight: 500;
  text-decoration: none;
  font-size: 13px;
  align-self: flex-start;
}
.osa-error a:hover {
  text-decoration: none;
  background: #1ebe5a;
}

/* ── Input area ── */
.osa-input-wrap {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--osa-hairline-soft);
  background: var(--osa-canvas);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.osa-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.osa-textarea {
  flex: 1;
  border: 1px solid var(--osa-hairline);
  background: var(--osa-canvas);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--osa-ink);
  resize: none;
  outline: 0;
  min-height: 40px;
  max-height: 120px;
  transition: border-color 160ms ease, box-shadow 200ms ease;
}
.osa-textarea:focus {
  border-color: var(--osa-olive);
  box-shadow: 0 0 0 3px rgba(74, 77, 46, 0.12);
}
.osa-textarea::placeholder {
  color: var(--osa-muted);
}
.osa-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--osa-olive);
  color: var(--osa-on-dark);
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 160ms ease, transform 180ms ease;
}
.osa-send:hover:not(:disabled) {
  background: var(--osa-olive-deep);
  transform: scale(1.05);
}
.osa-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.osa-send svg {
  width: 18px;
  height: 18px;
}
.osa-disclaimer {
  font-size: 11px;
  color: var(--osa-muted);
  text-align: center;
  line-height: 1.4;
}
.osa-disclaimer a {
  color: var(--osa-olive);
  text-decoration: underline;
}

/* ── Calendly overlay ── */
.osa-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(43, 44, 30, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
}
.osa-overlay.is-open {
  display: flex;
}
.osa-overlay-card {
  position: relative;
  background: var(--osa-canvas);
  border-radius: 18px;
  width: 100%;
  max-width: 720px;
  height: 100%;
  max-height: 760px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}
.osa-overlay-header {
  padding: 14px 56px 14px 20px;
  border-bottom: 1px solid var(--osa-hairline);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 17px;
  color: var(--osa-ink);
}
.osa-overlay-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--osa-surface-soft);
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--osa-ink);
  transition: background-color 160ms ease;
}
.osa-overlay-close:hover {
  background: var(--osa-hairline);
}
.osa-overlay-close svg {
  width: 18px;
  height: 18px;
}
.osa-overlay-body {
  flex: 1;
  overflow: hidden;
}
.osa-overlay-body iframe,
.osa-overlay-body .calendly-inline-widget {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ── Mobile (≤ 560px) ── */
@media (max-width: 560px) {
  .osa-launcher {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }
  .osa-launcher svg {
    width: 26px;
    height: 26px;
  }
  .osa-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .osa-overlay {
    padding: 0;
  }
  .osa-overlay-card {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .osa-launcher,
  .osa-panel,
  .osa-msg,
  .osa-typing span,
  .osa-action a,
  .osa-action button,
  .osa-send {
    transition: none !important;
    animation: none !important;
  }
}
