/* ================ EO COMPANY — APPLY MODAL ================ */
/* Conversational lead intake. Inherits brand tokens from styles.css */

/* ---- Modal shell ---- */
.apply-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}

@media (min-width: 720px) {
  .apply-modal { align-items: center; padding: clamp(1.5rem, 3vw, 3rem); }
}

.apply-modal.is-open {
  display: flex;
  opacity: 1;
}

.apply-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 4, 24, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.apply-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top, rgba(74, 27, 111, 0.45), transparent 65%),
    linear-gradient(180deg, var(--purple-velvet) 0%, var(--purple-night) 100%);
  color: var(--ivory);
  border: 1.5px solid rgba(201, 162, 75, 0.45);
  border-radius: 22px 22px 0 0;
  box-shadow:
    0 -30px 80px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(201, 162, 75, 0.15) inset;
  overflow: hidden;
  animation: applyPop 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (min-width: 720px) {
  .apply-card {
    border-radius: 22px;
    max-height: 84vh;
  }
}

@keyframes applyPop {
  from { opacity: 0; transform: translateY(28px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

body.apply-locked { overflow: hidden; }

/* ---- Header strip ---- */
.apply-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid rgba(201, 162, 75, 0.18);
  background: linear-gradient(180deg, rgba(201, 162, 75, 0.07), transparent);
  flex-shrink: 0;
}

.apply-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-script);
  font-size: 1.8rem;
  line-height: 1;
  padding-bottom: 0.18em;
  background: linear-gradient(135deg, #8C6A1F 0%, #C9A24B 35%, #F4D98C 60%, #C9A24B 100%);
  color: var(--purple-night);
  box-shadow: 0 6px 18px -6px rgba(201, 162, 75, 0.55);
  letter-spacing: -0.04em;
}

.apply-header-text { flex: 1; min-width: 0; line-height: 1.2; }
.apply-header-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ivory);
}
.apply-header-status {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  margin-top: 2px;
}
.apply-header-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Subtle turn counter — 12 small dots, faint by default */
.apply-progress {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-right: 0.5rem;
  opacity: 0.45;
  transition: opacity 0.3s ease;
}
.apply-header:hover .apply-progress { opacity: 0.85; }
.apply-progress-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(201, 162, 75, 0.3);
  transition: background 0.4s ease, transform 0.3s ease;
}
.apply-progress-dot.done { background: var(--gold); transform: scale(1.1); }
.apply-progress-dot.current {
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(229, 199, 127, 0.7);
}

.apply-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 239, 227, 0.65);
  border: 1px solid rgba(245, 239, 227, 0.18);
  background: transparent;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
  flex-shrink: 0;
}
.apply-close:hover, .apply-close:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(201, 162, 75, 0.08);
  transform: scale(1.05);
  outline: none;
}

/* ---- Conversation feed ---- */
.apply-feed {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem 1.1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.apply-feed::-webkit-scrollbar { width: 6px; }
.apply-feed::-webkit-scrollbar-track { background: transparent; }
.apply-feed::-webkit-scrollbar-thumb {
  background: rgba(201, 162, 75, 0.25);
  border-radius: 3px;
}

/* Bubbles */
.bubble {
  max-width: 86%;
  padding: 0.7rem 1rem;
  border-radius: 18px;
  font-size: 0.96rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  animation: bubbleIn 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  word-wrap: break-word;
  text-wrap: pretty;
}

@keyframes bubbleIn {
  to { opacity: 1; transform: translateY(0); }
}

.bubble-bot {
  align-self: flex-start;
  background: var(--cream);
  color: var(--ink);
  border-bottom-left-radius: 5px;
  border: 1px solid rgba(201, 162, 75, 0.25);
  box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.4);
}

.bubble-bot strong {
  color: var(--purple-royal);
  font-weight: 700;
}

.bubble-bot em {
  font-style: italic;
  color: var(--purple-royal);
}

.bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--purple-royal) 0%, #5e2789 100%);
  color: var(--ivory);
  border-bottom-right-radius: 5px;
  border: 1px solid rgba(201, 162, 75, 0.35);
  box-shadow: 0 4px 14px -6px rgba(74, 27, 111, 0.7);
  font-weight: 500;
}

/* Typing indicator */
.typing {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.8rem 1rem;
  background: var(--cream);
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  border: 1px solid rgba(201, 162, 75, 0.25);
  opacity: 0;
  animation: bubbleIn 0.3s ease forwards;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple-royal);
  opacity: 0.45;
  animation: typingDot 1.3s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Input zone ---- */
.apply-input-zone {
  padding: 0.9rem 1.1rem 1.1rem;
  border-top: 1px solid rgba(201, 162, 75, 0.18);
  background: linear-gradient(180deg, transparent, rgba(14, 4, 24, 0.4));
  flex-shrink: 0;
  min-height: 0;
}

.apply-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  animation: bubbleIn 0.4s ease 0.05s forwards;
}

.choice-btn {
  width: 100%;
  text-align: left;
  padding: 0.8rem 1rem;
  background: rgba(245, 239, 227, 0.04);
  color: var(--ivory);
  border: 1.5px solid rgba(201, 162, 75, 0.35);
  border-radius: 12px;
  font-size: 0.93rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.18s ease, color 0.22s ease;
  font-family: var(--font-body);
  line-height: 1.35;
}

.choice-btn:hover, .choice-btn:focus-visible {
  background: rgba(201, 162, 75, 0.12);
  border-color: var(--gold);
  color: var(--gold-bright);
  outline: none;
  transform: translateX(2px);
}

.choice-btn:active {
  transform: scale(0.985);
  background: rgba(201, 162, 75, 0.2);
}

.choice-btn.is-secondary {
  border-color: rgba(245, 239, 227, 0.2);
  color: rgba(245, 239, 227, 0.65);
}
.choice-btn.is-secondary:hover {
  color: var(--ivory);
  border-color: rgba(245, 239, 227, 0.4);
}

/* Text input */
.apply-text-form {
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  animation: bubbleIn 0.4s ease 0.05s forwards;
}

.apply-text-input {
  flex: 1;
  padding: 0.85rem 1rem;
  background: rgba(245, 239, 227, 0.06);
  color: var(--ivory);
  border: 1.5px solid rgba(201, 162, 75, 0.35);
  border-radius: 12px;
  font-size: 0.97rem;
  font-family: var(--font-body);
  transition: border-color 0.22s ease, background 0.22s ease;
  min-width: 0;
}
.apply-text-input::placeholder { color: rgba(245, 239, 227, 0.4); }
.apply-text-input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(245, 239, 227, 0.09);
}

.apply-send {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #B8902F 0%, #E5C77F 50%, #C9A24B 100%);
  color: var(--purple-velvet);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, opacity 0.2s ease;
  flex-shrink: 0;
}
.apply-send:hover:not(:disabled) {
  box-shadow: 0 10px 24px -10px rgba(201, 162, 75, 0.75);
  transform: scale(1.04);
}
.apply-send:active:not(:disabled) { transform: scale(0.95); }
.apply-send:disabled { opacity: 0.45; cursor: not-allowed; }

.apply-helper {
  font-size: 0.74rem;
  color: rgba(245, 239, 227, 0.5);
  margin-top: 0.55rem;
  text-align: center;
  line-height: 1.4;
  font-style: italic;
}

.apply-error {
  font-size: 0.78rem;
  color: #ff9a8a;
  margin-top: 0.5rem;
  text-align: left;
  padding: 0 0.2rem;
}

/* ---- Success screen ---- */
.apply-success {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  animation: bubbleIn 0.5s ease forwards;
  opacity: 0;
  transform: translateY(8px);
  gap: 0;
}

.apply-success-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #B8902F 0%, #E5C77F 50%, #C9A24B 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--purple-night);
  margin-bottom: 1.2rem;
  box-shadow: 0 14px 38px -10px rgba(201, 162, 75, 0.65);
  animation: floatGently 4.5s ease-in-out infinite;
}
.apply-success-mark svg { width: 30px; height: 30px; }

.apply-success-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--ivory);
  margin-bottom: 0.5rem;
  line-height: 1.2;
  text-wrap: balance;
}
.apply-success-title .script-accent {
  font-size: 1.4em;
  margin: 0 0.04em;
}

.apply-success-sub {
  font-size: 0.98rem;
  color: rgba(245, 239, 227, 0.78);
  margin-bottom: 1.6rem;
  max-width: 30rem;
  text-wrap: pretty;
}

.apply-success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.apply-success-primary {
  display: inline-block;
  padding: 0.9rem 1.6rem;
  background: linear-gradient(135deg, #B8902F 0%, #E5C77F 50%, #C9A24B 100%);
  color: var(--purple-velvet);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.82rem;
  border-radius: 999px;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  font-family: var(--font-body);
}
.apply-success-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px -14px rgba(201, 162, 75, 0.7);
}

.apply-success-secondary {
  font-size: 0.82rem;
  color: rgba(245, 239, 227, 0.6);
  text-decoration: underline;
  text-underline-offset: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: color 0.22s ease;
  padding: 0.4rem;
}
.apply-success-secondary:hover { color: var(--gold); }

.apply-success-quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--gold-soft);
  margin-top: 1.6rem;
  letter-spacing: 0.02em;
}
.apply-success-quote .script-accent { font-size: 1.4em; }

/* ---- Exit / "not for me" screen ---- */
.apply-exit {
  padding: 2rem 1.5rem;
  text-align: center;
  animation: bubbleIn 0.4s ease forwards;
  opacity: 0;
  transform: translateY(8px);
}
.apply-exit-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ivory);
  margin-bottom: 0.6rem;
}
.apply-exit-sub {
  color: rgba(245, 239, 227, 0.7);
  font-size: 0.95rem;
  margin-bottom: 1.4rem;
  text-wrap: pretty;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .bubble, .typing, .apply-choices, .apply-text-form,
  .apply-success, .apply-exit, .apply-card {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---- Mobile fine-tune ---- */
@media (max-width: 480px) {
  .apply-card { max-height: 95dvh; }
  .apply-feed { padding: 1rem 0.85rem 0.5rem; }
  .apply-input-zone { padding: 0.8rem 0.85rem 1rem; }
  .bubble { font-size: 0.94rem; max-width: 90%; }
  .choice-btn { padding: 0.78rem 0.9rem; font-size: 0.92rem; }
  .apply-header { padding: 0.85rem 0.95rem; }
  .apply-progress { display: none; }
}
