* {
  font-family: "Tajawal", sans-serif;
}

.full-height {
  min-height: 100vh;
}

body {
  background: linear-gradient(135deg, #fafafab8 0%, #f5f5f5 100%);
  margin: 0;
  padding: 0;
}

/* Integrated brand section */
.brand-section {
  animation: fadeInUp 0.8s ease-out;
  background: transparent;
}

.brand-logo {
  transition: transform 0.3s ease;
}

.brand-logo:hover {
  transform: scale(1.05);
}

.brand-title {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  font-family: "Aref Ruqaa", serif;
  color: #1d1b22;
}

/* Fade animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Saudia Airlines green styling */
.saudia-green {
  color: #006847 !important;
}

.chat-block .content .how-help {
  font-size: 40px;
  font-weight: 600;
  color: #1d1b22;
}

.chat-block .content .transform {
  font-size: 15px;
  color: #797483;
}

#how-can {
  width: 70%;
}

.chat-block .content .send-block {
  width: 100%;
  position: sticky !important;
  bottom: 0;
  z-index: 999;
  background: transparent;
}

.chat-block .content .input-send {
  width: 60%;
  min-height: 70px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #d7dae0;
}

.chat-block .content .input-send textarea {
  border: none;
  resize: none;
  height: 100%;
  font-size: 16px;
  color: #1d1b22;
  background: transparent;
}

.chat-block .content .input-send input ::-webkit-input-placeholder {
  color: #989ca4;
}

.chat-block .content .input-send input :-ms-input-placeholder {
  color: #989ca4;
}

.chat-block .content .input-send input ::placeholder {
  color: #989ca4;
}

.chat-block .content .input-send button#send-button {
  left: 10px;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  top: calc(50% - 26px);
  border-color: #006847;
  background-color: #006847;
}

.chat-block .content .input-send button#mic-button {
  left: 72px;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  top: calc(50% - 26px);
  border-color: #6c757d;
  background-color: #6c757d;
  transition: all 0.3s ease;
}

.chat-block .content .input-send button#mic-button.recording {
  background-color: #dc3545;
  border-color: #dc3545;
  animation: pulseRecording 2s infinite;
}

.chat-block .content .input-send button#mic-button.recording svg {
  animation: fadeInOut 1s infinite;
}

.chat-block .content .input-send button#mic-button.loading {
  background-color: #6c757d;
  border-color: #6c757d;
  opacity: 0.7;
  cursor: wait;
}

.chat-block .content .input-send button#mic-button.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes pulseRecording {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
  }
  
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
  }
  
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
  }
}

@keyframes fadeInOut {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes highlightUpdate {
  0% { background-color: rgba(149, 119, 17, 0.1); }
  100% { background-color: transparent; }
}

.chat-block .content .input-send textarea.highlight-update {
  animation: highlightUpdate 0.3s ease-out;
}

.chat-block .content .input-send textarea {
  padding-left: 135px;
}

.powered-by {
  color: #777;
  font-size: 14px;
  font-family: "Aref Ruqaa", serif;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.powered-footer {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

.powered-by span {
  color: #006847;
}

#chat-history {
  width: 80%;
  scroll-behavior: smooth;
}

.user-message {
  font-size: 20px;
  font-weight: 600;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  border-top: 1px solid #eaecf0;
  border-left: 1px solid #eaecf0;
  border-right: 1px solid #eaecf0;
  background: #fff url(../img/icon.png) no-repeat left center / contain;
}

.audio-area {
  background: #fff;
  border-left: 1px solid #eaecf0;
  border-right: 1px solid #eaecf0;
}

.audio-area.last {
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  border-bottom: 1px solid #eaecf0;
}

.audio-area .mejs__container {
  direction: ltr;
  max-width: 100%;
  border-radius: 4px;
}

.audio-area .mejs__controls:not([style*="display: none"]) {
  border-radius: 4px;
  background: #006847;
}

.chat-block .content .input-send .history-nav {
  display: none !important;
}

@media (max-width: 767px) {
  #how-can,
  #chat-history,
  .chat-block .content .input-send {
    width: 100%;
  }

  .chat-block .content .how-help {
    font-size: 28px;
    line-height: 1.3;
  }

  .chat-block .content .transform {
    font-size: 14px;
    line-height: 1.6;
    padding: 0 15px;
  }

  .chat-block .content .input-send {
    min-height: 60px;
    margin: 0 15px;
  }

  .chat-block .content .input-send button#send-button,
  .chat-block .content .input-send button#mic-button {
    width: 44px;
    height: 44px;
    top: calc(50% - 22px);
  }

  .chat-block .content .input-send button#mic-button {
    left: 64px;
  }

  .chat-block .content .input-send textarea {
    padding-left: 120px;
  }

  .user-message {
    font-size: 16px;
    margin: 0 15px;
  }

  .audio-area {
    margin: 0 15px;
  }

  .container {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-width: 480px) {
  .chat-block .content .how-help {
    font-size: 24px;
  }

  .chat-block .content .transform {
    font-size: 13px;
  }
}

.chat-block .content {
  max-width: 1000px;
  width: 100%;
}

.chat-message {
  width: 100%;
  padding: 1.5rem 0;
}

.chat-message.user-message-block {
  background-color: rgba(247, 247, 248, 0.7);
}

.chat-message.assistant-message-block {
  background-color: #fff;
}

.chat-message .message-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1rem;
  position: relative;
}

.chat-message .user-query {
  font-size: 16px;
  color: #1d1b22;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.25rem;
  border-radius: 8px;
  position: relative;
}

.chat-message .message-actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  gap: 5px;
  align-items: center;
}

.chat-message .user-query:hover .message-actions {
  display: flex;
}

.chat-message .message-actions button {
  background: none;
  border: none;
  padding: 0.25rem;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s ease;
}

.chat-message .message-actions button:hover {
  color: #006847;
}

.chat-message .message-actions button.delete-btn:hover {
  color: #dc3545;
}

.chat-message .message-number {
  position: absolute;
  right: 0;
  bottom: -1.5rem;
  font-size: 12px;
  color: #6c757d;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  z-index: 1;
}

.chat-message.assistant-message-block .message-number {
  bottom: -2rem;
}

.chat-message .message-number button {
  background: none;
  border: none;
  padding: 0;
  color: #006847;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  line-height: 1;
}

.chat-message .message-number button:hover {
  opacity: 1;
}

.chat-message .message-number button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chat-message .editable-text {
  flex-grow: 1;
  min-height: 24px;
}

.chat-message .editable-text[contenteditable="true"] {
  outline: 2px solid #006847;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  min-width: 200px;
}

.chat-message .user-query img {
  width: 30px;
  height: 30px;
  border-radius: 4px;
}

.chat-message .assistant-response {
  font-size: 16px;
  color: #1d1b22;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.chat-message .assistant-response img {
  width: 30px;
  height: 30px;
  border-radius: 4px;
}

#chat-history {
  width: 100%;
  max-width: 100%;
  margin-top: 1rem;
}

.chat-message .response-content {
  flex-grow: 1;
  max-width: calc(100% - 50px);
}

.chat-message .audio-player {
  margin: 0.5rem 0;
}

.chat-message .audio-player:first-child {
  margin-top: 0;
}

.chat-message .audio-player:last-child {
  margin-bottom: 0;
}

/* Text response styling */
.chat-message .text-response {
  margin: 0.5rem 0;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  line-height: 1.6;
  color: #1d1b22;
  font-size: 14px;
  border-left: 4px solid #006847;
}

.chat-message .text-response strong {
  font-weight: 600;
  color: #1d1b22;
}

.chat-message .text-response em {
  font-style: italic;
  color: #666;
}

.chat-message .text-response code {
  background-color: #e9ecef;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
}

.chat-message .text-response a {
  color: #006847;
  text-decoration: none;
}

.chat-message .text-response a:hover {
  color: #7a6009;
  text-decoration: underline;
}

.chat-message .text-response ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.chat-message .text-response li {
  margin: 0.5rem 0;
  list-style-type: disc;
}

.chat-message .text-response:first-child {
  margin-top: 0;
}

.chat-message .text-response:last-child {
  margin-bottom: 0;
}

.chat-message .audio-player .mejs__container {
  direction: ltr;
  max-width: 100%;
  border-radius: 8px;
}

.chat-message .audio-player .mejs__controls:not([style*="display: none"]) {
  border-radius: 8px;
  background: #006847;
}

@media (max-width: 767px) {
  .chat-message .message-content {
    padding: 0 0.75rem;
  }
  
  .chat-message {
    padding: 1rem 0;
  }
  
  .chat-message .user-query,
  .chat-message .assistant-response {
    font-size: 14px;
  }
  
  .chat-message .user-query img,
  .chat-message .assistant-response img {
    width: 24px;
    height: 24px;
  }

  .chat-message .message-actions {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin-top: 0.5rem;
  }
  
  .chat-message .message-number {
    position: relative;
    right: auto;
    bottom: auto;
    margin-top: 0.5rem;
    justify-content: flex-end;
  }
}

.chat-message.loading {
  opacity: 0.7;
  pointer-events: none;
}

.chat-message.loading .user-query::after {
  content: '';
  position: absolute;
  right: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid #006847;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Chat Container Styles */
.chat-container {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
}

.chat-main {
  flex: 1;
}

/* TTS Toggle Button */
.toggle-tts {
  display: block;
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #6c757d;
  border: none;
  color: #fff;
  z-index: 1001;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.toggle-tts:hover {
  background: #5a6268;
}

.toggle-tts.active {
  background: #006847;
}

.toggle-tts.active:hover {
  background: #7c6410;
}

.toggle-tts svg {
  width: 24px;
  height: 24px;
}

/* TTS Button in messages */
.tts-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s ease;
}

.tts-btn:hover {
  color: #006847;
}

.tts-btn.loading {
  color: #006847;
}

.tts-btn.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 991px) {
  .chat-main.with-history {
    margin-right: 0;
  }
}

/* Message actions positioning */
.user-query {
  position: relative;
}

.user-query .message-actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  gap: 5px;
}

.user-query:hover .message-actions {
  display: flex;
}

.message-actions .edit-btn,
.message-actions .delete-btn {
  background: transparent;
  border: none;
  padding: 5px;
  border-radius: 4px;
  color: #6c757d;
  transition: all 0.2s ease;
}

.message-actions .edit-btn:hover,
.message-actions .delete-btn:hover {
  background: #f8f9fa;
  color: #006847;
}

.assistant-response .message-actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}

.assistant-response:hover .message-actions {
  display: flex;
}

/* TTS controls green styling */
.toggle-tts.active {
  background: #006847 !important;
  border-color: #006847 !important;
  color: white !important;
}

.toggle-tts {
  background: #6c757d;
  border-color: #6c757d;
  color: white;
  transition: all 0.3s ease;
}

.toggle-tts:hover {
  background: #006847;
  border-color: #006847;
  color: white;
}

.tts-btn:hover {
  color: #006847;
  background: rgba(0, 104, 71, 0.1);
}

.tts-btn.active,
.tts-btn:active {
  color: #006847;
}

/* Powered by styling */
.powered-by span {
  color: #006847;
}

/* Input positioning fix */
.send-block {
  padding-bottom: 20px;
}

/* Compact header for chat mode */
.compact-header {
  background: transparent;
  border-bottom: 1px solid #e9ecef;
  backdrop-filter: none;
  border-radius: 8px;
  margin-bottom: 1rem;
  animation: slideDown 0.5s ease-out;
}

.compact-title {
  font-size: 18px;
  font-weight: 600;
  font-family: "Aref Ruqaa", serif;
  color: #1d1b22;
}

.compact-header .toggle-tts {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #6c757d;
  border: none;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.compact-header .toggle-tts svg {
  width: 24px;
  height: 24px;
}

.compact-header .toggle-tts:hover {
  background: #5a6268;
}

.compact-header .toggle-tts.active {
  background: #006847;
}

.compact-header .toggle-tts.active:hover {
  background: #7c6410;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
