/* EDRA Chatbot Widget - Fernando CNC */
.fcnc-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00B4D8, #1B2A5C);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 180, 216, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  transition: transform .2s, box-shadow .2s;
}
.fcnc-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0, 180, 216, 0.55); }
.fcnc-fab svg { width: 32px; height: 32px; }
.fcnc-fab--hidden { display: none !important; }
.fcnc-fab__pulse {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0, 180, 216, 0.4);
  animation: fcnc-pulse 2s infinite;
}
@keyframes fcnc-pulse { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.4); opacity: 0; } }

.fcnc-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  font-family: 'Inter', -apple-system, sans-serif;
}
.fcnc-panel--open { display: flex; }

@media (max-width: 480px) {
  .fcnc-fab { bottom: 16px; right: 16px; width: 56px; height: 56px; }
  .fcnc-fab svg { width: 28px; height: 28px; }
  .fcnc-panel { bottom: 0; right: 0; left: 0; top: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
}

.fcnc-header {
  background: linear-gradient(135deg, #1B2A5C, #00B4D8);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.fcnc-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.fcnc-header__info { flex: 1; min-width: 0; }
.fcnc-header__title { font-size: 14px; font-weight: 700; }
.fcnc-header__subtitle { font-size: 11px; opacity: 0.85; display: flex; align-items: center; gap: 6px; }
.fcnc-header__subtitle::before { content:''; display:inline-block; width:8px; height:8px; border-radius:50%; background:#10B981; box-shadow:0 0 0 2px rgba(16,185,129,0.3); }
.fcnc-close {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.fcnc-close:hover { background: rgba(255,255,255,0.15); }
.fcnc-close svg { width: 18px; height: 18px; }

/* Disclaimer */
.fcnc-disclaimer {
  background: #FEF3C7;
  color: #78350F;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  border-bottom: 1px solid #F59E0B33;
}

/* Body */
.fcnc-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fcnc-msg { display: flex; }
.fcnc-msg--bot { justify-content: flex-start; }
.fcnc-msg--user { justify-content: flex-end; }
.fcnc-msg__bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.fcnc-msg--bot .fcnc-msg__bubble {
  background: #fff; color: #0F172A;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.fcnc-msg--user .fcnc-msg__bubble {
  background: #1B2A5C; color: #fff;
  border-bottom-right-radius: 4px;
}
.fcnc-msg__file {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
  font-style: italic;
}

/* Typing indicator */
.fcnc-typing {
  background: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: inline-flex;
  gap: 4px;
  width: fit-content;
}
.fcnc-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #94A3B8;
  animation: fcnc-typing 1.2s infinite;
}
.fcnc-typing span:nth-child(2) { animation-delay: .15s; }
.fcnc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes fcnc-typing { 0%, 60%, 100% { transform: scale(0.8); opacity: 0.4; } 30% { transform: scale(1.1); opacity: 1; } }

/* Form (capture phase) */
.fcnc-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: #fff;
  border-top: 1px solid #E2E8F0;
}
.fcnc-form__label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}
.fcnc-form__input,
.fcnc-form__select,
.fcnc-form__textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
}
.fcnc-form__input:focus,
.fcnc-form__select:focus,
.fcnc-form__textarea:focus {
  border-color: #00B4D8;
  box-shadow: 0 0 0 3px rgba(0,180,216,0.15);
}
.fcnc-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fcnc-form__btn {
  padding: 11px 16px;
  background: linear-gradient(135deg, #00B4D8, #1B2A5C);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: opacity .2s, transform .15s;
}
.fcnc-form__btn:hover { transform: translateY(-1px); }
.fcnc-form__btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.fcnc-form__error { color: #DC2626; font-size: 12px; }

/* Composer (chat input) */
.fcnc-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #E2E8F0;
}
.fcnc-composer__textarea {
  flex: 1;
  resize: none;
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  max-height: 100px;
  min-height: 40px;
  line-height: 1.4;
}
.fcnc-composer__textarea:focus { border-color: #00B4D8; }
.fcnc-composer__btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #1B2A5C;
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.fcnc-composer__btn:hover { background: #00B4D8; }
.fcnc-composer__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fcnc-composer__btn svg { width: 18px; height: 18px; }
.fcnc-composer__attach {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  color: #64748B;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fcnc-composer__attach:hover { background: #F1F5F9; }
.fcnc-composer__attach svg { width: 18px; height: 18px; }
.fcnc-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #DBEAFE;
  color: #1E40AF;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  margin: 0 10px 8px;
}
.fcnc-file-pill__remove { cursor: pointer; font-weight: 700; }

/* Closed state */
.fcnc-closed {
  text-align: center;
  padding: 24px 16px;
  background: #F0FDF4;
  border-top: 1px solid #BBF7D0;
  color: #14532D;
  font-size: 13px;
}
.fcnc-closed--lost { background: #FEF2F2; border-top-color: #FECACA; color: #7F1D1D; }
