.aiesec-chatbot {
  --cb-primary: #037EF3; /* AIESEC blue */
  --cb-primary-dark: #0268d1;
  --cb-bg: #ffffff;
  --cb-text: #1f2937;
  --cb-muted: #6b7280;
  --cb-border: rgba(0, 0, 0, 0.08);
  --cb-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  --cb-radius: 14px;

  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2147483000;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.aiesec-chatbot *,
.aiesec-chatbot *::before,
.aiesec-chatbot *::after {
  box-sizing: border-box;
}

.aiesec-chatbot__launcher {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 14px;
  background: var(--cb-primary);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: var(--cb-shadow);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.aiesec-chatbot__launcher.preloader-complete {
  opacity: 1;
  pointer-events: auto;
}

.aiesec-chatbot__launcher:focus-visible {
  outline: 3px solid rgba(3, 126, 243, 0.35);
  outline-offset: 3px;
}

.aiesec-chatbot__panel {
  width: min(380px, calc(100vw - 36px));
  height: min(560px, calc(100vh - 36px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--cb-radius);
  box-shadow: var(--cb-shadow);
  border: 1px solid var(--cb-border);
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.aiesec-chatbot[data-open="true"] .aiesec-chatbot__panel {
  display: flex;
}

.aiesec-chatbot[data-open="true"] .aiesec-chatbot__launcher {
  display: none;
}

.aiesec-chatbot__header {
  background: var(--cb-primary);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.aiesec-chatbot__title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.aiesec-chatbot__title strong {
  font-size: 14px;
}

.aiesec-chatbot__title span {
  font-size: 12px;
  opacity: 0.9;
}

.aiesec-chatbot__header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.aiesec-chatbot__iconbtn {
  appearance: none;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.aiesec-chatbot__iconbtn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.aiesec-chatbot__iconbtn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.35);
  outline-offset: 2px;
}

.aiesec-chatbot__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 8px;
  background: rgba(255, 255, 255, 0.35);
}

.aiesec-chatbot__messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aiesec-chatbot__row {
  display: flex;
}

.aiesec-chatbot__row--user {
  justify-content: flex-end;
}

.aiesec-chatbot__row--bot {
  justify-content: flex-start;
}

.aiesec-chatbot__bubble {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
  border: 1px solid var(--cb-border);
}

.aiesec-chatbot__bubble--user {
  background: var(--cb-primary);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
  border-top-right-radius: 6px;
}

.aiesec-chatbot__bubble--bot {
  background: rgba(248, 250, 252, 0.85);
  color: var(--cb-text);
  border-top-left-radius: 6px;
}

.aiesec-chatbot__buttons {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.aiesec-chatbot__btn {
  appearance: none;
  border-radius: 10px;
  border: 1px solid var(--cb-border);
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  background: #fff;
  text-decoration: none;
  display: block;
  color: inherit;
}

.aiesec-chatbot__btn:hover {
  background: #f3f4f6;
}

.aiesec-chatbot__btn[data-style="primary"] {
  border-color: rgba(3, 126, 243, 0.35);
}

.aiesec-chatbot__btn[data-style="primary"]:hover {
  background: rgba(3, 126, 243, 0.08);
  border-color: rgba(3, 126, 243, 0.6);
}

.aiesec-chatbot__btn[data-style="gv"] {
  background: rgba(248, 90, 64, 0.1);
  border-color: rgba(248, 90, 64, 0.6);
  color: #f85a40;
  font-weight: 600;
}

.aiesec-chatbot__btn[data-style="gv"]:hover {
  background: rgba(248, 90, 64, 0.15);
  border-color: rgba(248, 90, 64, 0.8);
  color: #f85a40;
}

.aiesec-chatbot__btn[data-style="gta"] {
  background: rgba(12, 185, 193, 0.1);
  border-color: rgba(12, 185, 193, 0.6);
  color: #0cb9c1;
  font-weight: 600;
}

.aiesec-chatbot__btn[data-style="gta"]:hover {
  background: rgba(12, 185, 193, 0.15);
  border-color: rgba(12, 185, 193, 0.8);
  color: #0cb9c1;
}

.aiesec-chatbot__btn[data-style="gte"] {
  background: rgba(244, 137, 36, 0.1);
  border-color: rgba(244, 137, 36, 0.6);
  color: #f48924;
  font-weight: 600;
}

.aiesec-chatbot__btn[data-style="gte"]:hover {
  background: rgba(244, 137, 36, 0.15);
  border-color: rgba(244, 137, 36, 0.8);
  color: #f48924;
}

.aiesec-chatbot__btn[data-style="fees"] {
  border-color: rgba(124, 58, 237, 0.45);
}

.aiesec-chatbot__btn[data-style="visa"] {
  border-color: rgba(3, 126, 243, 0.35);
}

.aiesec-chatbot__btn[data-style="visa"]:hover {
  background: rgba(3, 126, 243, 0.08);
  border-color: rgba(3, 126, 243, 0.6);
}

.aiesec-chatbot__btn[data-style="member"] {
  border-color: rgba(117, 82, 204, 0.45);
}

.aiesec-chatbot__btn[data-style="member"]:hover {
  background: rgba(117, 82, 204, 0.08);
  border-color: rgba(117, 82, 204, 0.7);
}

.aiesec-chatbot__btn[data-style="support"] {
  border-color: rgba(0, 192, 110, 0.45);
}

.aiesec-chatbot__btn[data-style="support"]:hover {
  background: rgba(0, 192, 110, 0.08);
  border-color: rgba(0, 192, 110, 0.7);
}

.aiesec-chatbot__typing {
  color: var(--cb-muted);
  font-style: italic;
  font-size: 13px;
  padding: 4px 2px 2px;
}

.aiesec-chatbot__composer {
  border-top: 1px solid var(--cb-border);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
}

.aiesec-chatbot__input {
  width: 100%;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

.aiesec-chatbot__input:focus {
  border-color: rgba(3, 126, 243, 0.45);
  box-shadow: 0 0 0 3px rgba(3, 126, 243, 0.15);
}

.aiesec-chatbot__send {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--cb-primary);
  color: #fff;
  font-weight: 700;
}

.aiesec-chatbot__send:hover {
  background: var(--cb-primary-dark);
}

.aiesec-chatbot__footer {
  border-top: 1px solid var(--cb-border);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--cb-muted);
  background: rgba(255, 255, 255, 0.85);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .aiesec-chatbot {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .aiesec-chatbot__launcher {
    padding: 14px 18px;
    font-size: 15px;
    min-height: 48px; /* Better touch target */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  }

  .aiesec-chatbot__panel {
    width: 100%;
    height: 75vh;
    max-height: 75vh;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
  }

  .aiesec-chatbot__header {
    padding: 16px 18px;
    min-height: 64px;
  }

  .aiesec-chatbot__title strong {
    font-size: 16px;
  }

  .aiesec-chatbot__title span {
    font-size: 13px;
    margin-top: 2px;
  }

  .aiesec-chatbot__iconbtn {
    width: 40px;
    height: 40px;
    font-size: 22px;
    min-width: 40px; /* Better touch target */
    min-height: 40px;
  }

  .aiesec-chatbot__body {
    padding: 16px 16px 12px;
    -webkit-overflow-scrolling: touch;
  }

  .aiesec-chatbot__messages {
    gap: 12px;
  }

  .aiesec-chatbot__bubble {
    max-width: 90%;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.5;
    border-radius: 16px;
  }

  .aiesec-chatbot__bubble--user {
    border-top-right-radius: 8px;
  }

  .aiesec-chatbot__bubble--bot {
    border-top-left-radius: 8px;
  }

  .aiesec-chatbot__buttons {
    gap: 10px;
    margin-top: 10px;
  }

  .aiesec-chatbot__btn {
    padding: 14px 16px;
    font-size: 15px;
    min-height: 48px; /* Better touch target */
    line-height: 1.4;
    border-radius: 12px;
    -webkit-tap-highlight-color: rgba(3, 126, 243, 0.1);
  }

  .aiesec-chatbot__composer {
    padding: 12px;
    gap: 12px;
    border-top-width: 2px;
  }

  .aiesec-chatbot__input {
    padding: 14px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 48px; /* Better touch target */
    border-radius: 14px;
  }

  .aiesec-chatbot__send {
    padding: 14px 20px;
    min-width: 70px;
    min-height: 48px; /* Better touch target */
    font-size: 15px;
    border-radius: 14px;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.2);
  }

  .aiesec-chatbot__typing {
    font-size: 14px;
    padding: 6px 2px 4px;
  }

  .aiesec-chatbot__footer {
    padding: 10px 14px;
    font-size: 13px;
  }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
  .aiesec-chatbot {
    right: 8px;
    bottom: 8px;
    left: 8px;
  }

  .aiesec-chatbot__panel {
    height: 70vh;
    max-height: 70vh;
    border-radius: 14px 14px 0 0;
  }

  .aiesec-chatbot__header {
    padding: 14px 16px;
  }

  .aiesec-chatbot__title strong {
    font-size: 15px;
  }

  .aiesec-chatbot__title span {
    font-size: 12px;
  }

  .aiesec-chatbot__body {
    padding: 14px 14px 10px;
  }

  .aiesec-chatbot__bubble {
    max-width: 92%;
    padding: 11px 13px;
    font-size: 14px;
  }

  .aiesec-chatbot__btn {
    padding: 13px 15px;
    font-size: 14px;
  }

  .aiesec-chatbot__composer {
    padding: 10px;
  }

  .aiesec-chatbot__input {
    padding: 13px 15px;
    font-size: 16px;
  }

  .aiesec-chatbot__send {
    padding: 13px 18px;
    min-width: 65px;
  }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
  .aiesec-chatbot__panel {
    height: 85vh;
    max-height: 85vh;
  }

  .aiesec-chatbot__header {
    padding: 12px 16px;
    min-height: 56px;
  }

  .aiesec-chatbot__body {
    padding: 12px 14px 8px;
  }
}

/* Prevent text selection on buttons for better mobile UX */
@media (max-width: 768px) {
  .aiesec-chatbot__btn,
  .aiesec-chatbot__send,
  .aiesec-chatbot__launcher {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

/* Improve scrolling on mobile */
@media (max-width: 768px) {
  .aiesec-chatbot__body {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overflow-x: hidden;
  }

  /* Prevent body scroll when chatbot is open on mobile */
  body.chatbot-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: none;
  }

  html.chatbot-open {
    overflow: hidden !important;
    height: 100%;
  }

  /* Ensure chatbot body can scroll independently */
  .aiesec-chatbot__body {
    touch-action: pan-y;
  }
}
