/**
 * UNA Chatbot Styles
 * Plugin: UNA Chatbot
 * Author: UNA Team
 */

/* Chatbot Toggler Button */
#una-chatbot-toggler {
  position: fixed;
  bottom: 30px;
  right: 35px;
  height: 50px;
  width: 50px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  background: #08715b;
  transition: all 0.2s ease;
  z-index: 999998;
}

body.una-show-chatbot #una-chatbot-toggler {
  transform: rotate(90deg);
}

#una-chatbot-toggler .una-toggler-icon {
  fill: #fff;
  width: 28px;
  height: 28px;
  position: absolute;
  transition: opacity 0.2s ease;
}

#una-chatbot-toggler .una-close-icon {
  color: #fff;
  position: absolute;
  opacity: 0;
  font-size: 1.5rem;
  transition: opacity 0.2s ease;
}

body.una-show-chatbot #una-chatbot-toggler .una-toggler-icon {
  opacity: 0;
}

body.una-show-chatbot #una-chatbot-toggler .una-close-icon {
  opacity: 1;
}

/* Chatbot Popup Container */
.una-chatbot-popup {
  position: fixed;
  right: 25px;
  bottom: 90px;
  width: 420px;
  background: #fff;
  overflow: hidden;
  border-radius: 15px;
  opacity: 0;
  transform: scale(0.2);
  transform-origin: bottom right;
  pointer-events: none;
  box-shadow: 0 0 128px rgba(0, 0, 0, 0.1), 0 32px 64px -48px rgba(0, 0, 0, 0.5);
  transition: all 0.1s ease;
  z-index: 999999;
  font-family: "Tajawal", sans-serif;
}

/* Apply Tajawal font to all elements except Material Icons */
.una-chatbot-popup *:not(.material-symbols-rounded):not(.material-symbols-outlined) {
  font-family: "Tajawal", sans-serif;
}

/* Ensure Material Icons keep their font */
.una-chatbot-popup .material-symbols-rounded,
.una-chatbot-popup .material-symbols-outlined {
  font-family: "Material Symbols Rounded", "Material Symbols Outlined", sans-serif !important;
}

body.una-show-chatbot .una-chatbot-popup {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* Chat Header */
.una-chat-header {
  display: flex;
  align-items: center;
  background: #08715b;
  padding: 15px 22px;
  justify-content: space-between;
}

.una-chat-header .una-header-info {
  display: flex;
  gap: 10px;
  align-items: center;
}

.una-header-info .una-chatbot-logo {
  height: 35px;
  width: 35px;
  padding: 6px;
  fill: #08715b;
  flex-shrink: 0;
  background: #fff;
  border-radius: 50%;
}

.una-header-info .una-logo-text {
  color: #fff;
  font-size: 1.31rem;
  font-weight: 600;
  margin: 0;
  padding: 0;
}

.una-chat-header #una-close-chatbot {
  border: none;
  color: #fff;
  height: 40px;
  width: 40px;
  font-size: 1.9rem;
  margin-right: -10px;
  padding-top: 2px;
  cursor: pointer;
  border-radius: 50%;
  background: none;
  transition: 0.2s ease;
}

.una-chat-header #una-close-chatbot:hover {
  background: #034a3b;
}

/* Chat Body */
.una-chat-body {
  padding: 25px 22px;
  display: flex;
  gap: 20px;
  height: 460px;
  margin-bottom: 82px;
  overflow-y: auto;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: #ccccf5 transparent;
}

.una-chat-body .una-message {
  display: flex;
  gap: 11px;
  align-items: center;
}

.una-chat-body .una-bot-message .una-bot-avatar {
  height: 35px;
  width: 35px;
  padding: 6px;
  fill: #fff;
  flex-shrink: 0;
  margin-bottom: 2px;
  align-self: flex-end;
  background: #08715b;
  border-radius: 50%;
}

.una-chat-body .una-user-message {
  flex-direction: column;
  align-items: flex-end;
}

.una-chat-body .una-message .una-message-text {
  padding: 12px 16px;
  max-width: 75%;
  font-size: 0.95rem;
  background: #f2f2ff;
  line-height: 1.5;
}

.una-chat-body .una-bot-message.una-thinking .una-message-text {
  padding: 2px 16px;
}

.una-chat-body .una-bot-message .una-message-text {
  background-color: #f2f2ff;
  border-radius: 13px 13px 13px 3px;
}

.una-chat-body .una-user-message .una-message-text {
  color: #fff;
  background-color: #08715b;
  border-radius: 13px 13px 3px 13px;
}

/* Thinking Indicator */
.una-chat-body .una-bot-message .una-thinking-indicator {
  display: flex;
  gap: 4px;
  padding-block: 15px;
}

.una-chat-body .una-bot-message .una-thinking-indicator .una-dot:nth-child(1) {
  animation-delay: 0.2s;
}

.una-chat-body .una-bot-message .una-thinking-indicator .una-dot:nth-child(2) {
  animation-delay: 0.3s;
}

.una-chat-body .una-bot-message .una-thinking-indicator .una-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.una-chat-body .una-bot-message .una-thinking-indicator .una-dot {
  height: 7px;
  width: 7px;
  opacity: 0.7;
  border-radius: 50%;
  background: #6bc2a2;
  animation: unaDotPulse 1.8s ease-in-out infinite;
}

@keyframes unaDotPulse {
  0%,
  44% {
    transform: translateY(0);
  }

  28% {
    opacity: 0.4;
    transform: translateY(-4px);
  }

  44% {
    opacity: 0.2;
  }
}

/* Chat Footer */
.una-chat-footer {
  position: absolute;
  bottom: 0;
  width: 90%;
  background: white;
  padding: 15px 22px 20px;
}

.una-chat-footer .una-chat-form {
  display: flex;
  align-items: center;
  background: white;
  border-radius: 32px;
  outline: 1px solid #cccce5;
}

.una-chat-footer .una-chat-form:focus-within {
  outline: 2px solid #08715b;
}

.una-chat-form .una-message-input {
  border: none;
  outline: none;
  min-height: 20px;
  height: 20px;
  width: 100%;
  resize: none;
  max-height: 180px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  font-size: 1rem;
  line-height: 1.4;
  padding: 10px 13px;
  border-radius: inherit;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  font-family: "Tajawal", sans-serif;
}

.una-chat-form .una-message-input:hover {
  scrollbar-color: #ccccf5 transparent;
}

.una-chat-form .una-chat-controls {
  display: flex;
  height: 45px;
  gap: 3px;
  align-items: center;
  align-self: flex-end;
  padding-right: 6px;
}

.una-chat-form .una-chat-controls button {
  height: 35px;
  width: 35px;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  color: #706db0;
  background: none;
  border-radius: 50%;
  transition: 0.2s ease;
}

.una-chat-form .una-chat-controls #una-send-message {
  color: #fff;
  display: none;
  background: #08715b;
}

.una-chat-form .una-message-input:valid ~ .una-chat-controls #una-send-message {
  display: block;
}

.una-chat-form .una-chat-controls #una-send-message:hover {
  background: #034a3b;
}

.una-chat-form .una-chat-controls button:hover {
  background: #f1f1f1;
}

/* Emoji Picker */
.una-chatbot-popup em-emoji-picker {
  position: absolute;
  left: 50%;
  top: -337px;
  width: 100%;
  max-width: 350px;
  max-height: 330px;
  visibility: hidden;
  transform: translateX(-50%);
}

body.una-show-emoji-picker .una-chatbot-popup em-emoji-picker {
  visibility: visible;
}

/* Responsive for mobile screen */
@media screen and (max-width: 600px) {
  .una-chatbot-popup {
    width: 100%;
    right: 0;
    bottom: 0;
    border-radius: 0;
    height: 100%;
  }

  .una-chat-header .una-header-info .una-logo-text {
    font-size: 1.1rem;
  }

  .una-chat-body {
    height: 100%;
    margin-bottom: 0;
  }

  .una-chat-body .una-message .una-message-text {
    max-width: 85%;
  }

  .una-chat-footer .una-chat-form {
    border-radius: 25px;
  }

  .una-chat-footer .una-chat-form .una-message-input {
    border-radius: 0;
  }

  .una-chat-footer .una-chat-form .una-chat-controls {
    padding-right: 10px;
  }

  .una-chat-footer .una-chat-form .una-chat-controls button {
    height: 40px;
    width: 40px;
  }
}

/* Mode Selection Styles */
.una-mode-selection {
  text-align: center;
  padding: 15px;
}

.una-welcome-message p {
  font-size: 1rem;
  margin: 8px 0;
  color: #333;
}

.una-mode-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.una-mode-btn {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 12px;
}

.una-mode-btn:hover {
  border-color: #08715b;
  background: #f9f9f9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(8, 113, 91, 0.1);
}

.una-mode-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.una-mode-content {
  flex: 1;
}

.una-mode-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #08715b;
  display: block;
}

.una-mode-desc {
  font-size: 0.8rem;
  color: #666;
  display: block;
  margin-top: 2px;
}

/* Chat Messages Container */
.una-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* News Card Styles */
.una-news-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 15px;
  transition: box-shadow 0.3s ease;
}

.una-news-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.una-news-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.una-news-card-content {
  padding: 15px;
}

.una-news-card-date {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 8px;
}

.una-news-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
  line-height: 1.4;
}

.una-news-card-text {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.5;
  margin-bottom: 12px;
}

.una-news-card-link {
  display: inline-block;
  padding: 8px 16px;
  background: #08715b;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.3s ease;
}

.una-news-card-link:hover {
  background: #065a48;
}

.una-more-news-link {
  display: block;
  text-align: center;
  padding: 12px;
  background: #f0f8f6;
  color: #08715b;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  margin-top: 15px;
  transition: background 0.3s ease;
}

.una-more-news-link:hover {
  background: #e0f0ec;
}

/* FAQ Choice Buttons */
.una-choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.una-choice-btn {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px 15px;
  text-align: right;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  color: #333;
}

.una-choice-btn:hover {
  background: #08715b;
  color: #fff;
  border-color: #08715b;
}

/* FAQ Answer Display */
.una-faq-answer {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 15px;
  margin-top: 10px;
  line-height: 1.6;
}

.una-faq-answer p {
  margin-bottom: 10px;
}

.una-faq-answer a {
  color: #08715b;
  text-decoration: underline;
}

.una-faq-answer ul,
.una-faq-answer ol {
  padding-right: 20px;
  margin: 10px 0;
}

.una-faq-answer li {
  margin-bottom: 8px;
}

/* Back Button */
.una-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #08715b;
  margin-bottom: 15px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.una-back-btn:hover {
  background: #08715b;
  color: #fff;
  border-color: #08715b;
}

.una-back-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Main back to modes button */
.una-main-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #08715b;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #fff;
  margin-bottom: 15px;
  transition: all 0.3s ease;
  font-weight: 500;
}

.una-main-back-btn:hover {
  background: #065a48;
}

.una-main-back-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* FAQ Content Container */
.una-faq-container {
  padding: 10px 0;
}

/* Microphone Button */
.una-mic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.3s ease;
  flex-shrink: 0;
  color: #6c757d;
}

.una-mic-btn:hover {
  background: rgba(8, 113, 91, 0.1);
  color: #08715b;
}

.una-mic-btn.una-listening {
  background: #ff4444;
  color: #fff;
  animation: una-pulse 1.5s infinite;
}

.una-mic-btn.una-listening:hover {
  background: #cc0000;
}

.una-mic-btn .material-symbols-rounded {
  font-size: 1.3rem;
}

@keyframes una-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
  }
}

/* Mic not supported state */
.una-mic-btn.una-mic-unsupported {
  opacity: 0.4;
  cursor: not-allowed;
}

.una-mic-btn.una-mic-unsupported:hover {
  background: transparent;
  color: #6c757d;
}
