/* ============================================
   Coach Ava Widget - Stylesheet
   goyolocalboost.com
   ============================================ */

/* ---- Variables (matching GOYO theme) ---- */
:root {
  --goyo-bg-darkest: #0A0A0B;
  --goyo-bg-dark: #121214;
  --goyo-bg-mid: #1A1A1C;
  --goyo-emerald: #10B981;
  --goyo-emerald-hover: #A1A1AA;
  --goyo-emerald-dim: rgba(16, 185, 129, 0.15);
  --goyo-emerald-glow: rgba(16, 185, 129, 0.3);
  --goyo-text-primary: #D4D4D8;
  --goyo-text-secondary: #A1A1AA;
  --goyo-text-bright: #FFFFFF;
  --goyo-border: #27272A;
  --goyo-border-light: #3F3F46;
  --goyo-input-bg: #1A1A1C;
  --goyo-radius: 12px;
  --goyo-radius-sm: 8px;
  --goyo-radius-full: 9999px;
  --goyo-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --goyo-font: -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
  --goyo-z-widget: 9999;
  --goyo-z-chat: 10000;
  --goyo-z-modal: 10001;
}

/* ---- Widget Reset ---- */
.goyo-coach-widget *,
.goyo-coach-widget *::before,
.goyo-coach-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.goyo-coach-widget {
  font-family: var(--goyo-font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Chat Button (floating) ---- */
.goyo-coach-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--goyo-z-widget);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: var(--goyo-radius-full);
  background: var(--goyo-emerald);
  color: var(--goyo-text-bright);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.18);
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.goyo-coach-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.25);
}

.goyo-coach-toggle:active {
  transform: scale(0.95);
}

.goyo-coach-toggle svg {
  width: 28px;
  height: 28px;
}

/* ---- Chat Window Overlay ---- */
.goyo-coach-overlay {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: var(--goyo-z-chat);
  width: 380px;
  max-height: 580px;
  height: auto;
  margin-bottom: 96px;
  margin-right: 24px;
  border-radius: var(--goyo-radius);
  background: var(--goyo-bg-dark);
  border: 1px solid var(--goyo-border);
  box-shadow: var(--goyo-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.goyo-coach-overlay.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ---- Header ---- */
.goyo-coach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--goyo-bg-mid);
  border-bottom: 1px solid var(--goyo-border);
  flex-shrink: 0;
}

.goyo-coach-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.goyo-coach-g-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--goyo-radius-full);
  background: var(--goyo-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--goyo-text-bright);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.goyo-coach-header-title {
  color: var(--goyo-text-bright);
  font-size: 15px;
  font-weight: 600;
}

.goyo-coach-header-subtitle {
  color: var(--goyo-text-secondary);
  font-size: 11px;
  margin-top: 1px;
}

.goyo-coach-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--goyo-radius-sm);
  background: transparent;
  color: var(--goyo-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  font-size: 18px;
}

.goyo-coach-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--goyo-text-bright);
}

/* ---- Messages Area ---- */
.goyo-coach-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--goyo-bg-dark);
  min-height: 200px;
  max-height: 360px;
  scroll-behavior: smooth;
}

.goyo-coach-messages::-webkit-scrollbar {
  width: 4px;
}

.goyo-coach-messages::-webkit-scrollbar-track {
  background: transparent;
}

.goyo-coach-messages::-webkit-scrollbar-thumb {
  background: var(--goyo-border-light);
  border-radius: 4px;
}

/* ---- Chat Bubbles ---- */
.goyo-coach-bubble {
  max-width: 85%;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: goyoBubbleIn 0.25s ease;
}

@keyframes goyoBubbleIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.goyo-coach-bubble-user {
  align-self: flex-end;
  background: var(--goyo-emerald);
  color: var(--goyo-text-bright);
  border-radius: 16px 16px 4px 16px;
}

.goyo-coach-bubble-coach {
  align-self: flex-start;
  background: var(--goyo-bg-mid);
  color: var(--goyo-text-primary);
  border: 1px solid var(--goyo-border);
  border-radius: 16px 16px 16px 4px;
}

.goyo-coach-bubble strong {
  font-weight: 600;
}

.goyo-coach-bubble p {
  margin: 0;
}

.goyo-coach-bubble p + p {
  margin-top: 8px;
}

/* ---- Typing Indicator ---- */
.goyo-coach-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--goyo-bg-mid);
  border: 1px solid var(--goyo-border);
  border-radius: 16px 16px 16px 4px;
}

.goyo-coach-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--goyo-text-secondary);
  animation: goyoDotPulse 1.4s infinite ease-in-out both;
}

.goyo-coach-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.goyo-coach-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.goyo-coach-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes goyoDotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ---- Input Area ---- */
.goyo-coach-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--goyo-border);
  background: var(--goyo-bg-mid);
  flex-shrink: 0;
}

.goyo-coach-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.goyo-coach-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--goyo-border);
  border-radius: var(--goyo-radius-sm);
  background: var(--goyo-input-bg);
  color: var(--goyo-text-primary);
  font-size: 13px;
  font-family: var(--goyo-font);
  outline: none;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  transition: border-color 0.15s;
}

.goyo-coach-input::placeholder {
  color: var(--goyo-text-secondary);
}

.goyo-coach-input:focus {
  border-color: var(--goyo-emerald);
}

.goyo-coach-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--goyo-radius-sm);
  background: var(--goyo-emerald);
  color: var(--goyo-text-bright);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.goyo-coach-send-btn:hover {
  background: var(--goyo-emerald-hover);
}

.goyo-coach-send-btn:active {
  transform: scale(0.92);
}

.goyo-coach-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.goyo-coach-send-btn svg {
  width: 18px;
  height: 18px;
}

/* ---- Quick Actions ---- */
.goyo-coach-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.goyo-coach-quick-btn {
  padding: 5px 10px;
  border: 1px solid var(--goyo-border);
  border-radius: 20px;
  background: transparent;
  color: var(--goyo-text-secondary);
  font-size: 11.5px;
  font-family: var(--goyo-font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.goyo-coach-quick-btn:hover {
  border-color: var(--goyo-emerald);
  color: var(--goyo-emerald);
  background: var(--goyo-emerald-dim);
}

/* ---- Profile Form ---- */
.goyo-coach-profile-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  flex: 1;
}

.goyo-coach-form-title {
  color: var(--goyo-text-bright);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.goyo-coach-form-subtitle {
  color: var(--goyo-text-secondary);
  font-size: 12.5px;
  margin-bottom: 4px;
}

.goyo-coach-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.goyo-coach-form-label {
  color: var(--goyo-text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.goyo-coach-form-input,
.goyo-coach-form-select {
  padding: 10px 12px;
  border: 1px solid var(--goyo-border);
  border-radius: var(--goyo-radius-sm);
  background: var(--goyo-input-bg);
  color: var(--goyo-text-primary);
  font-size: 13px;
  font-family: var(--goyo-font);
  outline: none;
  transition: border-color 0.15s;
}

.goyo-coach-form-input:focus,
.goyo-coach-form-select:focus {
  border-color: var(--goyo-emerald);
}

.goyo-coach-form-select {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23A1A1AA' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.goyo-coach-form-select option {
  background: var(--goyo-bg-mid);
  color: var(--goyo-text-primary);
}

.goyo-coach-form-submit {
  padding: 11px;
  border: none;
  border-radius: var(--goyo-radius-sm);
  background: var(--goyo-emerald);
  color: var(--goyo-text-bright);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--goyo-font);
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.goyo-coach-form-submit:hover {
  background: var(--goyo-emerald-hover);
}

.goyo-coach-form-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Google Audit Modal ---- */
.goyo-coach-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--goyo-z-modal);
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.goyo-coach-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.goyo-coach-modal {
  width: 420px;
  max-width: 94%;
  max-height: 90vh;
  background: var(--goyo-bg-dark);
  border: 1px solid var(--goyo-border);
  border-radius: var(--goyo-radius);
  box-shadow: var(--goyo-shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: scale(0.92);
  transition: transform 0.2s;
}

.goyo-coach-modal-overlay.open .goyo-coach-modal {
  transform: scale(1);
}

.goyo-coach-modal-title {
  color: var(--goyo-text-bright);
  font-size: 17px;
  font-weight: 600;
}

.goyo-coach-modal-desc {
  color: var(--goyo-text-secondary);
  font-size: 13px;
}

.goyo-coach-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.goyo-coach-modal-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: var(--goyo-radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--goyo-font);
  cursor: pointer;
  transition: all 0.15s;
}

.goyo-coach-modal-btn-primary {
  background: var(--goyo-emerald);
  color: var(--goyo-text-bright);
}

.goyo-coach-modal-btn-primary:hover {
  background: var(--goyo-emerald-hover);
}

.goyo-coach-modal-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.goyo-coach-modal-btn-secondary {
  background: transparent;
  color: var(--goyo-text-secondary);
  border: 1px solid var(--goyo-border);
}

.goyo-coach-modal-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--goyo-text-primary);
}

/* ---- Error Banner ---- */
.goyo-coach-error {
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--goyo-radius-sm);
  color: #F87171;
  font-size: 12.5px;
  text-align: center;
}

/* ---- Welcome Message ---- */
.goyo-coach-welcome {
  align-self: flex-start;
  background: var(--goyo-bg-mid);
  color: var(--goyo-text-primary);
  border: 1px solid var(--goyo-border);
  border-radius: 16px 16px 16px 4px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
}

.goyo-coach-welcome strong {
  color: var(--goyo-emerald);
}

/* ---- Mobile: Full-screen modal ---- */
@media (max-width: 639px) {
  .goyo-coach-overlay {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
  }

  .goyo-coach-toggle {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }

  .goyo-coach-messages {
    max-height: none;
    flex: 1;
  }

  .goyo-coach-modal {
    width: 96%;
  }
}
