/* ══════════════════════════════════════════════════
   FYNO DIGITAL — Premium Glossy Chatbot Widget CSS
   ══════════════════════════════════════════════════ */

:root {
  --chat-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --chat-black: #000000;
  --chat-white: #ffffff;
  --chat-dark-gray: #121212;
  --chat-soft-gray: #1e1e1e;
  --chat-border: rgba(255, 255, 255, 0.1);
  --chat-border-glow: rgba(255, 255, 255, 0.2);
  --chat-w80: rgba(255, 255, 255, 0.8);
  --chat-w50: rgba(255, 255, 255, 0.5);
  --chat-w15: rgba(255, 255, 255, 0.15);
  
  --chat-shadow-lux: 
    0 24px 60px rgba(0, 0, 0, 0.8), 
    0 0 40px rgba(255, 255, 255, 0.04), 
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
    
  --chat-glow-hover: 
    0 0 25px rgba(255, 255, 255, 0.25),
    0 8px 24px rgba(0, 0, 0, 0.4);
    
  --chat-radius-lg: 24px;
  --chat-radius-md: 16px;
  --chat-radius-sm: 10px;
  
  --chat-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ── TRIGGER BUTTON ── */
.fyno-chat-trigger {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--chat-black);
  color: var(--chat-white);
  border: 1px solid var(--chat-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 255, 255, 0.05);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--chat-transition);
  animation: chat-breathe 4s infinite ease-in-out;
}

/* Breathing animation */
@keyframes chat-breathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 255, 255, 0.05);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 255, 255, 0.12);
  }
}

.fyno-chat-trigger:hover {
  animation-play-state: paused;
  transform: scale(1.08) translateY(-2px);
  background: #080808;
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: var(--chat-glow-hover);
}

.fyno-chat-trigger:active {
  transform: scale(0.96);
}

.fyno-chat-trigger svg {
  position: absolute;
  width: 24px;
  height: 24px;
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
  fill: none;
  stroke: var(--chat-white);
}

.fyno-chat-trigger .icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.fyno-chat-trigger.open {
  background: var(--chat-black);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.fyno-chat-trigger.open .icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.fyno-chat-trigger.open .icon-close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* ── CHAT WINDOW ── */
.fyno-chat-window {
  position: fixed;
  bottom: 105px;
  right: 30px;
  width: 380px;
  height: 560px;
  max-height: calc(100vh - 140px);
  border-radius: var(--chat-radius-lg);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--chat-border);
  box-shadow: var(--chat-shadow-lux);
  backdrop-filter: blur(35px) saturate(180%);
  -webkit-backdrop-filter: blur(35px) saturate(180%);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--chat-font);
  opacity: 0;
  transform: translateY(30px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Glass glare reflection overlay */
.fyno-chat-window::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 50%);
  pointer-events: none;
  z-index: 10;
}

.fyno-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ── HEADER ── */
.fyno-chat-header {
  position: relative;
  z-index: 20;
  padding: 18px 24px;
  background: rgba(18, 18, 18, 0.8);
  border-bottom: 1px solid var(--chat-border);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fyno-chat-header__profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fyno-chat-header__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #222222 0%, #000000 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fyno-chat-header__icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--chat-white);
  fill: none;
}

.fyno-chat-header__info {
  display: flex;
  flex-direction: column;
}

.fyno-chat-header__name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--chat-white);
  letter-spacing: -0.01em;
}

.fyno-chat-header__status {
  font-size: 0.72rem;
  color: var(--chat-w50);
  margin-top: 1px;
}

.fyno-chat-header__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--chat-w50);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: var(--chat-transition);
}

.fyno-chat-header__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--chat-white);
}

/* ── BODY CONTROLLER ── */
.fyno-chat-body {
  position: relative;
  z-index: 15;
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* Transition wrapper layouts */
.fyno-chat-view {
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: chat-fade-in 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes chat-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── STATE 1: WELCOME & FAQS ── */
.fyno-chat-welcome {
  text-align: center;
  margin-bottom: 24px;
}

.fyno-chat-welcome__emoji {
  font-size: 2.2rem;
  margin-bottom: 12px;
  display: inline-block;
  animation: emoji-wave 2s infinite ease-in-out;
  transform-origin: 70% 70%;
}

@keyframes emoji-wave {
  0%, 100% { transform: rotate(0deg); }
  20%, 60% { transform: rotate(-10deg); }
  40%, 80% { transform: rotate(14deg); }
}

.fyno-chat-welcome__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--chat-white);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.fyno-chat-welcome__desc {
  font-size: 0.88rem;
  color: var(--chat-w80);
  line-height: 1.5;
}

/* Question Pill Buttons */
.fyno-chat-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fyno-chat-opt-btn {
  background: var(--chat-dark-gray);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-md);
  padding: 14px 20px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--chat-white);
  text-align: left;
  cursor: pointer;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.fyno-chat-opt-btn:hover {
  background: var(--chat-white);
  color: var(--chat-black);
  border-color: var(--chat-white);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.12);
}

.fyno-chat-opt-btn:active {
  transform: translateY(0);
}

.fyno-chat-opt-btn::after {
  content: '→';
  font-size: 0.95rem;
  color: var(--chat-w50);
  transition: transform 0.25s;
}

.fyno-chat-opt-btn:hover::after {
  transform: translateX(4px);
  color: var(--chat-black);
}

/* ── STATE 2: ANSWER DISPLAY ── */
.fyno-chat-answer-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.fyno-chat-question-header {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--chat-w50);
  margin-bottom: 8px;
  font-weight: 600;
}

.fyno-chat-question-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--chat-white);
  margin-bottom: 16px;
  line-height: 1.3;
}

/* Dark Glossy Answer Card */
.fyno-chat-answer-card {
  background: rgba(30, 30, 30, 0.45);
  border: 1px solid var(--chat-border);
  border-radius: var(--chat-radius-md);
  padding: 20px 24px;
  color: var(--chat-white);
  font-size: 0.92rem;
  line-height: 1.6;
  white-space: pre-line;
  margin-bottom: 24px;
  box-shadow: 
    inset 0 0 15px rgba(255, 255, 255, 0.05),
    0 10px 30px rgba(0, 0, 0, 0.4);
  animation: card-expand 0.35s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.fyno-chat-book-call {
  width: fit-content;
  max-width: 100%;
  margin-top: 18px;
  white-space: normal;
  background: var(--chat-white);
  color: var(--chat-black);
  border-color: var(--chat-white);
}

.fyno-chat-book-call:hover {
  background: rgba(255, 255, 255, 0.88);
  color: var(--chat-black);
  border-color: var(--chat-white);
}

@keyframes card-expand {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Reset pill button */
.fyno-chat-reset-btn {
  background: var(--chat-white);
  color: var(--chat-black);
  border: 1px solid var(--chat-white);
  border-radius: 100px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--chat-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
}

.fyno-chat-reset-btn:hover {
  background: transparent;
  color: var(--chat-white);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.1);
}

.fyno-chat-reset-btn:active {
  transform: translateY(0);
}

/* ── STICKY FOOTER ── */
.fyno-chat-footer {
  position: relative;
  z-index: 20;
  padding: 14px 24px;
  background: rgba(12, 12, 12, 0.85);
  border-top: 1px solid var(--chat-border);
  text-align: center;
  font-size: 0.7rem;
  color: var(--chat-w50);
  letter-spacing: 0.04em;
}

.fyno-chat-footer span {
  color: var(--chat-white);
  font-weight: 600;
}

/* ── MOBILE ADAPTATION ── */
@media (max-width: 480px) {
  .fyno-chat-trigger {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }
  
  .fyno-chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    transform: translateY(100%);
  }

  .fyno-chat-window.open {
    transform: translateY(0);
  }

  .fyno-chat-header {
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }
}
