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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
  color: #e0e6ed;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(30, 30, 46, 0.95);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px 30px;
  text-align: center;
  position: relative;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
}

.header * {
  position: relative;
  z-index: 1;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 400;
}

.chat-controls {
  padding: 15px 30px;
  background: rgba(20, 20, 35, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-info {
  font-size: 12px;
  color: #8b949e;
  font-family: 'Courier New', monospace;
}

#clear-chat {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

#clear-chat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
  background: linear-gradient(135deg, #ff5252, #d32f2f);
}

#clear-chat:active {
  transform: translateY(0);
}

.chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 20px 30px;
  background: rgba(15, 15, 30, 0.5);
  position: relative;
}

.chat-box::-webkit-scrollbar {
  width: 6px;
}

.chat-box::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.chat-box::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.message {
  margin: 15px 0;
  padding: 12px 18px;
  border-radius: 18px;
  max-width: 75%;
  display: inline-block;
  word-wrap: break-word;
  white-space: pre-wrap;
  position: relative;
  animation: messageSlide 0.3s ease-out;
  line-height: 1.5;
}

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

.message.user {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  float: right;
  clear: both;
  margin-left: auto;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  border-bottom-right-radius: 6px;
}

.message.user::before {
  content: '👤';
  position: absolute;
  right: -25px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
}

.message.bot {
  background: rgba(40, 44, 52, 0.9);
  color: #e0e6ed;
  float: left;
  clear: both;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.message.bot::before {
  content: '🤖';
  position: absolute;
  left: -25px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
}

.message.is_temporary {
  background: rgba(255, 193, 7, 0.2);
  color: #ffc107;
  border: 1px solid rgba(255, 193, 7, 0.3);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.input-container {
  padding: 20px 30px;
  background: rgba(20, 20, 35, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

form {
  display: flex;
  gap: 12px;
  align-items: center;
}

input[type="text"] {
  flex: 1;
  padding: 14px 20px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 16px;
  background: rgba(40, 44, 52, 0.8);
  color: #e0e6ed;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
  background: rgba(40, 44, 52, 1);
}

input[type="text"]::placeholder {
  color: #8b949e;
}

button[type="submit"] {
  padding: 14px 24px;
  border: none;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  min-width: 80px;
}

button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

button[type="submit"]:active {
  transform: translateY(0);
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #8b949e;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 18px;
  margin-bottom: 8px;
}

.empty-state-subtext {
  font-size: 14px;
  opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .container {
    height: calc(100vh - 20px);
    border-radius: 15px;
  }
  
  .header {
    padding: 15px 20px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  .chat-controls {
    padding: 12px 20px;
  }
  
  .chat-box {
    padding: 15px 20px;
  }
  
  .message {
    max-width: 85%;
    padding: 10px 14px;
  }
  
  .input-container {
    padding: 15px 20px;
  }
  
  input[type="text"] {
    padding: 12px 16px;
    font-size: 16px;
  }
  
  button[type="submit"] {
    padding: 12px 20px;
    min-width: 70px;
  }
}

@media (max-width: 480px) {
  .message.user::before,
  .message.bot::before {
    display: none;
  }
  
  .message {
    max-width: 90%;
  }
  
  form {
    gap: 8px;
  }
  
  button[type="submit"] {
    padding: 12px 16px;
    min-width: 60px;
    font-size: 14px;
  }
}