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

body {
  font-family: 'Segoe UI', 'Inter', system-ui, sans-serif;
  background: #0B1E3C;
  color: #E6EDF5;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.background-grid {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: 
    linear-gradient(rgba(212, 175, 55, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: 0;
}

.chat-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 800px;
  margin: 0 auto;
  background: rgba(11, 30, 60, 0.8);
  backdrop-filter: blur(15px);
  border-left: 1px solid rgba(212,175,55,0.3);
  border-right: 1px solid rgba(212,175,55,0.3);
}

.chat-header {
  background: linear-gradient(135deg, #0B1E3C, #0F2A4A);
  padding: clamp(14px, 2vh, 25px) clamp(16px, 3vw, 30px);
  border-bottom: 1px solid #D4AF37;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-header i {
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  color: #D4AF37;
}

.chat-header h2 {
  color: #FFFFFF;
  font-size: clamp(1.1rem, 3vw, 1.8rem);
}

.chat-header p {
  color: #B0C4DE;
  font-size: clamp(0.68rem, 1.5vw, 0.95rem);
  margin-top: 3px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: clamp(14px, 2vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.ai {
  align-self: flex-start;
}

.message .avatar {
  width: clamp(28px, 5vw, 40px);
  height: clamp(28px, 5vw, 40px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  flex-shrink: 0;
}

.message.user .avatar {
  background: #D4AF37;
  color: #0B1E3C;
}

.message.ai .avatar {
  background: #0B1E3C;
  border: 1px solid #D4AF37;
  color: #D4AF37;
}

.message .bubble {
  background: rgba(15, 35, 65, 0.9);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 16px;
  padding: 0.8em 1em;        
  color: #E6EDF5;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: clamp(0.78rem, 1.6vw, 0.9rem);
}

.message.ai .bubble strong {
  display: block;
  margin-bottom: 0.15em;
  color: #D4AF37;
  font-weight: 700;
}
.message.user .bubble {
  background: #D4AF37;
  color: #0B1E3C;
  border: none;
}

.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: #D4AF37;
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-input-area {
  padding: clamp(10px, 2vh, 20px) clamp(14px, 3vw, 30px);
  border-top: 1px solid rgba(212,175,55,0.4);
  display: flex;
  gap: 10px;
  background: rgba(11, 30, 60, 0.9);
  flex-shrink: 0;
}

.chat-input-area input {
  flex: 1;
  padding: clamp(10px, 1.5vw, 14px) clamp(14px, 2vw, 20px);
  background: #0A1529;
  border: 1px solid rgba(212,175,55,0.4);
  border-radius: 25px;
  color: white;
  font-size: clamp(0.78rem, 1.6vw, 0.9rem);
  outline: none;
  min-width: 0;
}

.chat-input-area button {
  background: #D4AF37;
  color: #0B1E3C;
  border: none;
  border-radius: 50%;
  width: clamp(40px, 7vw, 50px);
  height: clamp(40px, 7vw, 50px);
  font-size: clamp(1rem, 2vw, 1.3rem);
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
}

.chat-input-area button:hover {
  background: #F5E6A3;
}

.back-link {
  color: #D4AF37;
  text-decoration: none;
  font-size: 1.2rem;
  margin-right: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: 0.2s;
}

.back-link:hover {
  color: #F5E6A3;
}

/* Adjust header layout for small screens */
@media (max-width: 480px) {
  .chat-header {
    flex-wrap: nowrap;
    padding: 10px 12px;
  }
  .back-link {
    font-size: 1rem;
    margin-right: 6px;
  }
  .chat-header i.fa-shield-virus {
    font-size: 1.2rem;
    margin-right: 8px;
  }
  .chat-header h2 {
    font-size: 1rem;
  }
  .chat-header p {
    font-size: 0.7rem;
  }
}
/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
  .chat-container {
    border-left: none;
    border-right: none;
  }
  .message {
    max-width: 90%;
  }
}

/* Language Switcher */
.lang-switcher {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.lang-btn {
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #C8D6E5;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: 0.2s;
  font-weight: 500;
}

.lang-btn:hover {
  border-color: #D4AF37;
  color: #D4AF37;
}

.lang-btn.active {
  background: #D4AF37;
  color: #0B1E3C;
  border-color: #D4AF37;
}
