/* =============================================
   FORMAX CHATBOT – Styl (jasny motyw)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Hind:wght@400;500;600;700&display=swap');

:root {
  --fc-red:         #b2001a;
  --fc-red-dark:    #92001a;
  --fc-red-light:   rgba(178,0,26,0.07);
  --fc-red-border:  rgba(178,0,26,0.22);
  --fc-bg:          #ffffff;
  --fc-surface:     #f5f5f5;
  --fc-surface2:    #eeeeee;
  --fc-border:      #e0e0e0;
  --fc-text:        #1a1a1a;
  --fc-muted:       #888888;
  --fc-white:       #ffffff;
  --fc-green:       #25D366;
  --fc-radius:      12px;
  --fc-shadow:      0 8px 32px rgba(0,0,0,.12);
  --fc-font-head:   'Hind', sans-serif;
  --fc-font-body:   Arial, Helvetica, sans-serif;
}

#formax-chatbot-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--fc-font-body);
}

.fc-trigger {
  width: 60px !important; height: 60px !important;
  border-radius: 50% !important;
  background: #25D366 !important;
  background-color: #25D366 !important;
  border: none !important; cursor: pointer !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  box-shadow: 0 4px 20px rgba(37,211,102,.4) !important;
  transition: transform .2s, box-shadow .2s;
  position: relative !important;
  padding: 0 !important;
  margin: 0 !important;
  outline: none !important;
  line-height: 1 !important;
}
.fc-trigger:hover { transform: scale(1.08) !important; box-shadow: 0 6px 28px rgba(37,211,102,.6) !important; }
.fc-trigger svg { width: 30px !important; height: 30px !important; fill: #fff !important; display: block !important; }
.fc-trigger::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--fc-green);
  animation: fcPulse 2.2s ease-out infinite; pointer-events: none;
}
@keyframes fcPulse {
  0%   { opacity: .6; transform: scale(1); }
  70%  { opacity: 0;  transform: scale(1.45); }
  100% { opacity: 0; }
}

.fc-badge {
  position: absolute; top: -4px; right: -4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--fc-red); color: #fff;
  font-size: 11px; font-weight: 700; font-family: var(--fc-font-head);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: fcBounce .4s .5s both;
}
@keyframes fcBounce {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.fc-panel {
  position: absolute; bottom: 76px; right: 0;
  width: 360px;
  height: 540px;
  max-height: 90vh;
  background: var(--fc-bg);
  border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius);
  box-shadow: var(--fc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: fcSlideIn .25s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes fcSlideIn {
  from { opacity: 0; transform: scale(.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.fc-panel.fc-closing { animation: fcSlideOut .2s ease-in forwards; }
@keyframes fcSlideOut { to { opacity: 0; transform: scale(.85) translateY(20px); } }

/* Logo bar */
.fc-logo-bar {
  background: #fff;
  border-bottom: 1px solid var(--fc-border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fc-logo-bar img {
  height: 36px;
  width: auto;
  display: block;
}

.fc-header {
  background: var(--fc-red);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
}
.fc-logo {
  width: 42px; height: 42px; border-radius: 8px;
  background: rgba(255,255,255,.2);
  border: 1.5px solid rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fc-font-head); font-weight: 700;
  color: #fff; font-size: 15px; flex-shrink: 0;
}
.fc-header-text { flex: 1; }
.fc-header-title {
  color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2;
  font-family: var(--fc-font-head);
}
.fc-header-sub {
  color: rgba(255,255,255,.75); font-size: 12px; margin-top: 2px;
  font-family: var(--fc-font-body);
}
.fc-close-btn {
  background: rgba(255,255,255,.15) !important;
  border: 1px solid rgba(255,255,255,.35) !important;
  color: #fff !important;
  cursor: pointer !important;
  padding: 5px 10px 5px 8px !important;
  border-radius: 20px !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 12px !important;
  font-family: var(--fc-font-head) !important;
  font-weight: 600 !important;
  transition: background .15s;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}
.fc-close-btn svg {
  width: 14px !important; height: 14px !important;
  fill: #fff !important;
  display: inline-block !important;
  vertical-align: middle !important;
  flex-shrink: 0 !important;
}
.fc-close-btn span { color: #fff !important; }
.fc-close-btn:hover { background: rgba(255,255,255,.28) !important; color: #fff !important; }

.fc-online {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 20px;
  background: #fff8f8;
  border-bottom: 1px solid var(--fc-border);
  font-size: 12px; color: var(--fc-muted); font-family: var(--fc-font-body);
}
.fc-online-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #4ade80;
  animation: fcBlink 2s ease-in-out infinite;
}
@keyframes fcBlink { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Step wrapper – musi rosnąć i dzielić przestrzeń z input */
.fc-step {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fc-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex; flex-direction: column; gap: 10px;
  background: #fafafa;
  scrollbar-width: thin; scrollbar-color: var(--fc-border) transparent;
}

.fc-bubble {
  max-width: 88%; padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.5; font-family: var(--fc-font-body);
  animation: fcFadeUp .22s ease-out both;
}
@keyframes fcFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fc-bubble.bot {
  background: #fff; border: 1px solid var(--fc-border);
  color: var(--fc-text); border-bottom-left-radius: 4px;
  align-self: flex-start; box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.fc-bubble.user {
  background: var(--fc-red); color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end; font-weight: 500;
}
.fc-bubble-time { font-size: 10px; opacity: .5; margin-top: 4px; text-align: right; }

.fc-typing {
  display: flex; gap: 5px; align-items: center;
  padding: 10px 14px;
  background: #fff; border: 1px solid var(--fc-border);
  border-radius: 14px; border-bottom-left-radius: 4px;
  align-self: flex-start; box-shadow: 0 1px 4px rgba(0,0,0,.06);
  animation: fcFadeUp .22s ease-out both;
}
.fc-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #ccc;
  animation: fcDot 1.2s ease-in-out infinite;
}
.fc-dot:nth-child(2) { animation-delay: .2s; }
.fc-dot:nth-child(3) { animation-delay: .4s; }
@keyframes fcDot {
  0%,80%,100% { transform: scale(.8); opacity: .4; }
  40%         { transform: scale(1.1); opacity: 1; }
}

.fc-branches { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.fc-branch-card {
  background: #fff; border: 1.5px solid var(--fc-border);
  border-radius: 10px; padding: 12px 16px;
  cursor: pointer; display: flex; align-items: center; gap: 12px;
  transition: border-color .18s, background .18s, transform .15s, box-shadow .18s;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.fc-branch-card:hover {
  border-color: var(--fc-red);
  background: var(--fc-red-light);
  transform: translateX(3px);
  box-shadow: 0 2px 10px rgba(178,0,26,.1);
}
.fc-branch-card.selected { border-color: var(--fc-red); background: var(--fc-red-light); }
.fc-branch-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--fc-red);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
}
.fc-branch-icon svg { width: 18px; height: 18px; fill: currentColor; }
.fc-branch-name {
  font-weight: 600; color: var(--fc-text); font-size: 14px;
  font-family: var(--fc-font-head);
}
.fc-branch-hint {
  font-size: 11px; color: var(--fc-muted); margin-top: 2px;
  font-family: var(--fc-font-body);
}
.fc-branch-arrow { margin-left: auto; color: var(--fc-red); opacity: 0; transition: opacity .15s; }
.fc-branch-card:hover .fc-branch-arrow,
.fc-branch-card.selected .fc-branch-arrow { opacity: 1; }


/* Bottom container - input area, always pinned to bottom */
.fc-bottom {
  flex-shrink: 0;
}
.fc-input-area {
  padding: 12px 16px; background: #fff;
  border-top: 1px solid var(--fc-border);
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;   /* nigdy nie ściskaj pola input */
}
.fc-textarea {
  flex: 1; background: #f5f5f5;
  border: 1.5px solid var(--fc-border); border-radius: 10px;
  color: var(--fc-text); font-size: 14px; font-family: var(--fc-font-body);
  padding: 10px 14px; resize: none;
  min-height: 40px; max-height: 120px; outline: none;
  transition: border-color .18s, background .18s; line-height: 1.4;
}
.fc-textarea:focus { border-color: var(--fc-red); background: #fff; }
.fc-textarea::placeholder { color: #bbb; }

.fc-send-btn {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--fc-red); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .18s, transform .15s;
}
.fc-send-btn:hover  { background: var(--fc-red-dark); transform: scale(1.05); }
.fc-send-btn:active { transform: scale(.95); }
.fc-send-btn svg { width: 18px; height: 18px; fill: #fff; }
.fc-send-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

.fc-back-btn {
  background: none; border: 1.5px solid var(--fc-border);
  color: var(--fc-muted); border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-family: var(--fc-font-body);
  cursor: pointer; transition: color .15s, border-color .15s;
}
.fc-back-btn:hover { color: var(--fc-text); border-color: #aaa; }

.fc-selected-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--fc-red-light);
  border: 1px solid var(--fc-red-border);
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; color: var(--fc-red); font-weight: 600;
  font-family: var(--fc-font-head); margin-bottom: 8px;
}

.fc-success { text-align: center; padding: 20px; background: #fafafa; animation: fcFadeUp .3s ease-out both; }
.fc-success-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: rgba(37,211,102,.1); border: 2px solid var(--fc-green);
  margin: 0 auto 14px; display: flex; align-items: center; justify-content: center;
}
.fc-success-icon svg { width: 32px; height: 32px; fill: var(--fc-green); }
.fc-success h3 {
  color: var(--fc-text); font-size: 16px;
  font-family: var(--fc-font-head); font-weight: 700; margin: 0 0 6px;
}
.fc-success p  { color: var(--fc-muted); font-size: 13px; font-family: var(--fc-font-body); margin: 0 0 16px; }
.fc-success-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--fc-green); color: #fff; border: none; border-radius: 10px;
  padding: 10px 20px; font-size: 14px; font-weight: 600; font-family: var(--fc-font-head);
  cursor: pointer; text-decoration: none; transition: opacity .18s;
}
.fc-success-btn:hover { opacity: .88; }

#formax-chatbot-inline .fc-panel {
  position: static; width: 100%; max-width: 400px;
  height: auto; max-height: none; animation: none; border-radius: var(--fc-radius);
  display: flex; flex-direction: column;
  grid-template-rows: none;
}
#formax-chatbot-inline .fc-step {
  flex: none;
}
#formax-chatbot-inline .fc-messages {
  min-height: 180px; max-height: 340px;
}

/* Grid rows: input area i inne stałe elementy nie rosną */
.fc-logo-bar, .fc-header, .fc-online { flex-shrink: 0; }

/* Fallback: gdy brak .fc-step (stary JS) – messages bezpośrednio w panelu */
.fc-panel > .fc-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Bottom area (chip + back btn + input) nigdy się nie ściska */
.fc-panel > div:last-child:not(.fc-messages):not(.fc-online):not(.fc-header):not(.fc-logo-bar) {
  flex-shrink: 0;
}
.fc-step > div:last-child {
  flex-shrink: 0;
}

/* Branch details: phone + hours */
.fc-branch-info { flex: 1; min-width: 0; }
.fc-branch-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}
.fc-branch-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--fc-muted);
  font-family: var(--fc-font-body);
  white-space: nowrap;
}
.fc-branch-meta svg {
  width: 12px; height: 12px;
  fill: var(--fc-muted);
  flex-shrink: 0;
}
.fc-branch-card:hover .fc-branch-meta,
.fc-branch-card.selected .fc-branch-meta {
  color: var(--fc-red);
}
.fc-branch-card:hover .fc-branch-meta svg,
.fc-branch-card.selected .fc-branch-meta svg {
  fill: var(--fc-red);
}

/* Force SVG visibility inside chatbot – override theme resets */
#formax-chatbot-root svg,
#formax-chatbot-inline svg {
  display: inline-block !important;
  overflow: visible !important;
  vertical-align: middle !important;
}
#formax-chatbot-root svg path,
#formax-chatbot-inline svg path {
  vector-effect: none !important;
}

@media (max-width: 420px) {
  .fc-panel { width: calc(100vw - 24px); right: -12px; }
}
