/**
 * Easy AI Chatbot - Admin Settings Helper Styles
 */

/* Push WordPress content area when sidebar is open */
#wpcontent {
  transition: margin-right 0.3s ease;
}

/* Main sidebar container */
.easy-ai-chatbot-admin-helper {
  position: fixed;
  top: 32px; /* WordPress admin bar height */
  right: 0;
  width: 360px;
  height: calc(100vh - 32px);
  background: #fff;
  border-left: 1px solid #c3c4c7;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Collapsed state */
.easy-ai-chatbot-admin-helper.collapsed {
  transform: translateX(100%);
}

/* Toggle button (visible when collapsed) */
.easy-ai-chatbot-admin-helper-toggle {
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.easy-ai-chatbot-admin-helper.collapsed .easy-ai-chatbot-admin-helper-toggle {
  opacity: 1;
}

.easy-ai-chatbot-admin-helper-toggle button {
  background: #FF6A00;
  color: #fff;
  border: none;
  border-radius: 4px 0 0 4px;
  padding: 12px 8px;
  cursor: pointer;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.1);
  transition: background 0.2s ease;
}

.easy-ai-chatbot-admin-helper-toggle button:hover {
  background: #E55F00;
}

.easy-ai-chatbot-admin-helper-toggle .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

/* Header */
.easy-ai-chatbot-admin-helper-header {
  background: #e6e6e6;
  color: #1d2327;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #c3c4c7;
  flex-shrink: 0;
}

.easy-ai-chatbot-admin-helper-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1d2327;
  flex: 1;
}

.easy-ai-chatbot-admin-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.easy-ai-chatbot-admin-close {
  background: transparent;
  color: #1d2327;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.easy-ai-chatbot-admin-close:hover {
  opacity: 1;
}

.easy-ai-chatbot-admin-close .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

/* Content area */
.easy-ai-chatbot-admin-helper-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Messages container */
.easy-ai-chatbot-admin-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f6f7f7;
}

.easy-ai-chatbot-admin-message {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
}

.easy-ai-chatbot-admin-message.user {
  background: #FF6A00;
  color: #fff;
  margin-left: auto;
  text-align: right;
  border-radius: 8px 8px 2px 8px;
}

.easy-ai-chatbot-admin-message.bot {
  background: #fff;
  color: #1d2327;
  border: 1px solid #c3c4c7;
  margin-right: auto;
  border-radius: 8px 8px 8px 2px;
}

.easy-ai-chatbot-admin-message.bot strong {
  color: #FF6A00;
}

/* Reply buttons in bot messages */
.easy-ai-chatbot-admin-reply-btn {
  display: inline-block;
  background: #fff;
  border: 1px solid #FF6A00;
  color: #FF6A00;
  padding: 6px 12px;
  margin: 4px 4px 4px 0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
}

.easy-ai-chatbot-admin-reply-btn:hover {
  background: #FF6A00;
  color: white;
  transform: translateY(-1px);
}

.easy-ai-chatbot-admin-reply-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.easy-ai-chatbot-admin-reply-btn:disabled:hover {
  background: #fff;
  color: #FF6A00;
}

/* Typing indicator */
.easy-ai-chatbot-admin-message.typing {
  background: #fff;
  border: 1px solid #c3c4c7;
  margin-right: auto;
  padding: 10px 14px;
  border-radius: 8px 8px 8px 2px;
}

.easy-ai-chatbot-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.easy-ai-chatbot-typing-dots span {
  animation: easy-ai-chatbot-typing-animation 1.4s infinite;
  font-size: 20px;
  line-height: 1;
  color: #FF6A00;
}

.easy-ai-chatbot-typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.easy-ai-chatbot-typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes easy-ai-chatbot-typing-animation {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

/* Input area */
.easy-ai-chatbot-admin-input {
  border-top: 1px solid #c3c4c7;
  padding: 12px;
  background: #fff;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.easy-ai-chatbot-admin-input textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #8c8f94;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s ease;
}

.easy-ai-chatbot-admin-input textarea:focus {
  border-color: #FF6A00;
  box-shadow: 0 0 0 1px #FF6A00;
}

.easy-ai-chatbot-admin-input button {
  background: #FF6A00;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.easy-ai-chatbot-admin-input button:hover {
  background: #E55F00;
}

/* Footer */
.easy-ai-chatbot-admin-footer {
  padding: 8px 12px;
  background: #f6f7f7;
  border-top: 1px solid #c3c4c7;
  text-align: center;
  font-size: 11px;
  color: #646970;
  flex-shrink: 0;
}

.easy-ai-chatbot-admin-footer a {
  color: #FF6A00;
  text-decoration: none;
  transition: color 0.2s ease;
}

.easy-ai-chatbot-admin-footer a:hover {
  color: #E55F00;
  text-decoration: underline;
}

/* Help button (?) in form */
.easy-ai-chatbot-admin-help {
  background: #FF6A00;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  line-height: 1;
  padding: 0;
}

.easy-ai-chatbot-admin-help:hover {
  background: #E55F00;
}

/* Scrollbar styling */
.easy-ai-chatbot-admin-messages::-webkit-scrollbar {
  width: 8px;
}

.easy-ai-chatbot-admin-messages::-webkit-scrollbar-track {
  background: #f6f7f7;
}

.easy-ai-chatbot-admin-messages::-webkit-scrollbar-thumb {
  background: #c3c4c7;
  border-radius: 4px;
}

.easy-ai-chatbot-admin-messages::-webkit-scrollbar-thumb:hover {
  background: #8c8f94;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
  .easy-ai-chatbot-admin-helper {
    top: 46px; /* Mobile admin bar height */
    height: calc(100vh - 46px);
    width: 100%;
    min-width: unset;
  }

  .easy-ai-chatbot-admin-helper.collapsed {
    transform: translateX(100%);
  }

  .easy-ai-chatbot-admin-helper-toggle {
    left: -50px;
  }
}

/* =========================================================================
   Admin Test Bot Widget
   ========================================================================= */

.easy-ai-chatbot-test-widget {
  position: fixed;
  width: 380px;
  height: 550px;
  z-index: 100000;
  background: var(--test-color-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: var(--test-color-font, #333333);
}

/* Title bar (draggable) */
.easy-ai-test-titlebar {
  background: var(--test-color-primary, #FF6A00);
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}

.easy-ai-test-titlebar:active {
  cursor: grabbing;
}

.easy-ai-test-titlebar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.easy-ai-test-titlebar-avatar {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.easy-ai-test-avatar-circle {
  border-radius: 50%;
}

.easy-ai-test-avatar-original {
  border-radius: 4px;
}

.easy-ai-test-titlebar-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.easy-ai-test-titlebar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.easy-ai-test-badge {
  background: rgba(255, 255, 255, 0.2);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.easy-ai-test-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.easy-ai-test-close:hover {
  opacity: 1;
}

/* Body */
.easy-ai-test-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Messages area */
.easy-ai-test-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--test-color-bg, #ffffff);
}

/* Welcome section */
.easy-ai-test-welcome {
  text-align: center;
  padding: 20px 10px;
}

.easy-ai-test-welcome-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--test-color-font, #333);
  margin-bottom: 8px;
  line-height: 1.4;
}

.easy-ai-test-tagline {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
}

.easy-ai-test-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.easy-ai-test-question-btn {
  background: transparent;
  border: 1px solid var(--test-color-primary, #FF6A00);
  color: var(--test-color-primary, #FF6A00);
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.easy-ai-test-question-btn:hover {
  background: var(--test-color-primary, #FF6A00);
  color: #fff;
}

/* Chat messages */
.easy-ai-test-msg {
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 85%;
  word-wrap: break-word;
}

.easy-ai-test-msg-user {
  background: var(--test-color-primary, #FF6A00);
  color: #fff;
  margin-left: auto;
  border-radius: 12px 12px 2px 12px;
}

.easy-ai-test-msg-bot {
  background: #f0f0f0;
  color: var(--test-color-font, #333);
  margin-right: auto;
  border-radius: 12px 12px 12px 2px;
}

.easy-ai-test-msg-bot .easy-ai-chatbot-admin-reply-btn {
  border-color: var(--test-color-primary, #FF6A00);
  color: var(--test-color-primary, #FF6A00);
}

.easy-ai-test-msg-bot .easy-ai-chatbot-admin-reply-btn:hover {
  background: var(--test-color-primary, #FF6A00);
  color: #fff;
}

/* Typing indicator (reuses the existing keyframe animation) */
.easy-ai-test-typing .easy-ai-chatbot-typing-dots span {
  color: var(--test-color-primary, #FF6A00);
}

/* Input area */
.easy-ai-test-input-area {
  border-top: 1px solid #e0e0e0;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  background: var(--test-color-bg, #ffffff);
  flex-shrink: 0;
}

.easy-ai-test-input-area textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}

.easy-ai-test-input-area textarea:focus {
  border-color: var(--test-color-primary, #FF6A00);
}

.easy-ai-test-send {
  background: var(--test-color-primary, #FF6A00);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.easy-ai-test-send:hover {
  opacity: 0.9;
}

/* Scrollbar for test widget */
.easy-ai-test-messages::-webkit-scrollbar {
  width: 6px;
}

.easy-ai-test-messages::-webkit-scrollbar-track {
  background: transparent;
}

.easy-ai-test-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.easy-ai-test-messages::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Responsive - shrink test widget on small screens */
@media screen and (max-width: 480px) {
  .easy-ai-chatbot-test-widget {
    width: calc(100vw - 20px);
    height: calc(100vh - 80px);
    left: 10px !important;
    top: 42px !important;
  }
}

/* ============================================================
   Admin Page Layout (header, tabs, form tables)
   ============================================================ */

.easy-ai-chatbot-admin-header {
  background: #381b15;
  margin: 0 0 0 -20px;
  padding: 20px 40px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 20px;
}
.easy-ai-chatbot-admin-header img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
}
.easy-ai-chatbot-admin-header-text {
  flex: 1;
}
.easy-ai-chatbot-admin-header-text h1 {
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: 28px;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.easy-ai-chatbot-admin-header-text p {
  margin: 5px 0 0 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 400;
}
.easy-ai-chatbot-admin-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.easy-ai-chatbot-admin-header-actions .button {
  white-space: nowrap;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  color: #fff !important;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  text-shadow: none;
  box-shadow: none;
  transition: background 0.15s, border-color 0.15s;
  height: auto;
  line-height: 1.6;
  cursor: pointer;
}
.easy-ai-chatbot-admin-header-actions .button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.9);
  color: #fff !important;
  box-shadow: none;
}
#header-submit-btn,
#header-submit-btn:hover {
  background: #FF6A00;
  border-color: #FF6A00;
  color: #fff !important;
}
#header-submit-btn:hover {
  background: #E55F00;
  border-color: #E55F00;
}
.easy-ai-chatbot-admin-header-text .notice p {
  color: #000000;
}
.easy-ai-chatbot-tabs {
  margin: 25px 0 0 0;
  padding: 0;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  gap: 4px;
}
.easy-ai-chatbot-tabs li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.easy-ai-chatbot-tabs li a {
  display: block;
  padding: 12px 24px;
  text-decoration: none;
  border: 2px solid transparent;
  background: #f9fafb;
  color: #6b7280;
  border-radius: 8px 8px 0 0;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 14px;
  position: relative;
  top: 2px;
}
.easy-ai-chatbot-tabs li a:hover {
  background: #f3f4f6;
  color: #111827;
  transform: translateY(-2px);
}
.easy-ai-chatbot-tabs li a.active {
  background: #fff;
  border-color: #e5e7eb #e5e7eb #fff;
  color: #FF6A00;
  font-weight: 600;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}
.easy-ai-chatbot-tab-content {
  display: none;
  padding: 30px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.easy-ai-chatbot-tab-content.active {
  display: block;
}
.easy-ai-chatbot-tab-content h2 {
  margin-top: 0;
  color: #111827;
  font-size: 20px;
  font-weight: 600;
}
.easy-ai-chatbot-tab-content > p.description {
  color: #6b7280;
  margin-bottom: 20px;
}
.easy-ai-chatbot-tab-content .form-table th {
  padding: 15px 10px 15px 0;
}
.easy-ai-chatbot-tab-content .form-table td {
  padding: 15px 10px;
}
#submit-button-container {
  display: none;
}

/* ============================================================
   Content Sources / Endpoint Picker
   ============================================================ */

.eaicb-selected-posts {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 36px; padding: 6px;
  border: 1px solid #ddd; border-radius: 4px; background: #fff;
  margin-bottom: 6px;
}
.eaicb-post-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: #e8f4f8; border: 1px solid #b8d7e5; border-radius: 3px;
  padding: 2px 6px 2px 8px; font-size: 13px; line-height: 1.4;
}
.eaicb-remove-post {
  background: none; border: none; cursor: pointer;
  color: #888; font-size: 15px; line-height: 1; padding: 0 0 0 2px;
}
.eaicb-remove-post:hover { color: #c00; }
.eaicb-search-wrapper { position: relative; }
.eaicb-post-results {
  position: absolute; z-index: 200; background: #fff;
  border: 1px solid #ccd; border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  min-width: 300px; max-height: 240px; overflow-y: auto; margin-top: 2px;
}
.eaicb-results-list { margin: 0; padding: 0; list-style: none; }
.eaicb-result-item {
  padding: 7px 12px; cursor: pointer;
  border-bottom: 1px solid #f0f0f0; font-size: 13px;
}
.eaicb-result-item:last-child { border-bottom: none; }
.eaicb-result-item:hover { background: #f0f6fc; }
.eaicb-no-results { padding: 8px 12px; color: #888; font-style: italic; font-size: 13px; }
.eaicb-taxonomy-picker { margin-bottom: 4px; }
.eaicb-taxonomy-section { margin-bottom: 12px; }
.eaicb-term-list {
  max-height: 140px; overflow-y: auto;
  border: 1px solid #ddd; border-radius: 4px;
  padding: 8px 10px; background: #fff; margin-top: 4px;
}
.eaicb-term-list label {
  display: block; margin-bottom: 4px; font-size: 13px; cursor: pointer;
}
.eaicb-discover-list {
  max-height: 180px; overflow-y: auto;
  border: 1px solid #ddd; border-radius: 4px;
  padding: 8px 10px; background: #fff; margin-top: 6px;
  display: none;
}
.eaicb-discover-list label {
  display: block; margin-bottom: 4px; font-size: 13px; cursor: pointer;
}
