/* Global Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  line-height: 1.6;
  color: #4A5668;
  background: url('/static/assets/background.jpg') center/cover no-repeat fixed;
  min-height: 100vh;
  position: relative;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(202, 206, 208, 0.55);
  z-index: 1;
  pointer-events: none;
}

.header-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(27, 104, 168, 0.1);
  position: relative;
  z-index: 30;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0;
  box-shadow: 0 8px 32px 0 rgba(27, 104, 168, 0.15);
  padding: 2rem;
  width: 100%;
  margin: 0;
}

.header-logo img {
  width: 100px;
  height: 100px;
  object-fit: cover;
}

.header-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2rem;
}

.header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2em;
  align-items: flex-start;
}

.header-title {
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 2.7rem;
  font-weight: 700;
  color: #2980D0;
  margin: 0;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.header-subtitle {
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 1.8rem;
  font-weight: 400;
  color: #4A5668;
  margin: 0;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

/* Language Selector Styles */
.language-row {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 10;
}

.language-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(27, 104, 168, 0.2);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #4A5668;
}

.language-selector:hover {
  border-color: #1B68A8;
  box-shadow: 0 2px 8px rgba(27, 104, 168, 0.1);
}

.language-selector.active {
  border-color: #1B68A8;
  background: rgba(255, 255, 255, 1);
}

.language-flag {
  width: 20px;
  height: 15px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.language-name {
  font-weight: 600;
}

.language-dropdown {
  position: fixed;
  top: 120px;
  right: 2rem;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(27, 104, 168, 0.2);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  z-index: 9999;
  min-width: 150px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
}

.language-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.language-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 0.9rem;
  color: #4A5668;
}

.language-option:hover {
  background: rgba(27, 104, 168, 0.1);
}

.language-option.selected {
  background: rgba(27, 104, 168, 0.15);
  color: #1B68A8;
  font-weight: 600;
}

.chat-container {
  background: rgba(255, 255, 255, 1);
  border-radius: 18px;
  box-shadow: 0 8px 32px 0 rgba(27, 104, 168, 0.15);
  padding: 2rem;
  max-width: 800px;
  width: 90%;
  margin: 2rem auto;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 20;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid rgba(27, 104, 168, 0.1);
}



.chat-logo {
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 16px rgba(27,104,168,0.10);
  overflow: hidden;
}

.chat-logo img {
  width: 60px;
  height: 60px;
  object-fit: cover;
}

.chat-title {
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: #2980D0;
  margin: 0;
}

.chat-subtitle {
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 1rem;
  color: #4A5668;
  margin: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(248, 249, 250, 0.5);
  border-radius: 12px;
  max-height: 400px;
}

.message-container {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.message-container.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.message {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  max-width: 70%;
  word-wrap: break-word;
}

.message.user {
  background: linear-gradient(135deg, #1B68A8 0%, #2980D0 100%);
  color: white;
  margin-left: auto;
  text-align: right;
}

.message.assistant {
  background: rgba(255, 255, 255, 0.9);
  color: #4A5668;
  border: 1px solid rgba(27, 104, 168, 0.1);
  margin-right: auto;
}

.message.typing {
  background: rgba(255, 255, 255, 0.7);
  color: #6c757d;
  font-style: italic;
  margin-right: auto;
}

.chat-input-container {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.8rem 1rem;
  border: 2px solid rgba(27, 104, 168, 0.2);
  border-radius: 8px;
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 1rem;
  resize: none;
  min-height: 50px;
  max-height: 120px;
  background: rgba(255, 255, 255, 0.9);
}

.chat-input:focus {
  outline: none;
  border-color: #1B68A8;
  box-shadow: 0 0 0 3px rgba(27, 104, 168, 0.1);
}

.chat-send {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(90deg, #1B68A8 0%, #060606 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'Urbanist', 'Inter', 'Segoe UI', Arial, sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
  align-self: center;
}

.chat-send:hover:not(:disabled) {
  background: linear-gradient(90deg, #060606 0%, #1B68A8 100%);
  transform: translateY(-1px);
}

.chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-back {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.6em 1.2em;
  font-size: 1rem;
  font-weight: 500;
  color: #FDFDFD;
  background: linear-gradient(90deg, #4A5668 0%, #6c757d 100%);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(74, 86, 104, 0.12);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.chat-back:hover {
  background: linear-gradient(90deg, #6c757d 0%, #4A5668 100%);
  color: #CACED0;
  box-shadow: 0 4px 16px rgba(74, 86, 104, 0.18);
}

.typing-indicator {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #1B68A8;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

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

/* RTL Support for Hebrew - Only affects chat container */
.rtl .chat-container {
  direction: rtl;
  text-align: right;
}

/* Chat header content alignment */
.chat-header-content {
  text-align: left;
}

.rtl .chat-container .chat-header-content {
  text-align: right;
}

/* Message container and avatar swapping */
.rtl .chat-container .message-container {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.rtl .chat-container .message-container.user {
  flex-direction: row;
  justify-content: flex-start;
}

.rtl .chat-container .chat-header {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.rtl .chat-container .chat-input-container {
  flex-direction: row-reverse;
}

/* Ensure proper order in RTL - send button on left, input on right */
.rtl .chat-container .chat-send {
  order: -1;
}

.rtl .chat-container .chat-input {
  order: 1;
}

@media (max-width: 600px) {
  /* Mobile Layout: Compact Header + Full-Screen Chat */

  
  
  /* Compact header */
  .header-container {
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
  }
  
  .header-logo img {
    width: 40px;
    height: 40px;
  }
  
  .header-title {
    font-size: 1.4rem;
  }
  
  .header-subtitle {
    font-size: 1rem;
  }
  
  /* Full-screen chat container */
  .chat-container {
    margin: 0;
    padding: 0;
    height: calc(100vh - 80px); /* Full height minus compact header */
    max-height: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  
  /* Compact chat header */
  .chat-header {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(27, 104, 168, 0.1);
  }
  
  .chat-title {
    font-size: 1.2rem;
  }
  
  .chat-subtitle {
    font-size: 0.9rem;
  }
  
  /* Flexible chat messages area */
  .chat-messages {
    flex: 1;
    max-height: none;
    margin-bottom: 0;
    padding: 0.5rem 1rem;
  }
  
  /* Message adjustments */
  .message {
    max-width: 85%;
  }
  
  .message-avatar {
    width: 32px;
    height: 32px;
  }
  
  .message-container {
    gap: 0.5rem;
  }
  
  /* Floating input container */
  .chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(27, 104, 168, 0.1);
    padding: 0.75rem 1rem;
    margin: 0;
    flex-direction: row;
    gap: 0.5rem;
    z-index: 1000;
  }
  
  .chat-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    border-radius: 20px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  
  .chat-send {
    width: auto;
    min-width: 60px;
    height: 44px;
    border-radius: 22px;
    padding: 0 1rem;
    font-size: 0.9rem;
  }
  
  /* Mobile language selector adjustments */
  .language-selector .language-name {
    display: none;
  }
  
  .language-selector {
    padding: 0.5rem;
    min-width: auto;
  }
  
  /* Add bottom padding to chat messages to prevent overlap with floating input */
  .chat-messages {
    padding-bottom: 80px;
  }
  
  /* Mobile-specific improvements */
  .chat-container {
    /* Prevent horizontal scrolling */
    overflow-x: hidden;
    width: 100%;
    margin: 1%;
  }
  
  /* Ensure proper touch targets */
  .chat-send {
    touch-action: manipulation;
  }
  
  .chat-input {
    touch-action: manipulation;
  }
  
  /* Smooth scrolling for messages */
  .chat-messages {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevent zoom on input focus (iOS) */
  .chat-input {
    font-size: 16px;
  }
}