/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
}

body {
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
  color: #f1f5f9;
  height: 100vh;
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Glassmorphism Styles */
.glass-container {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  border-radius: 24px;
  width: 90%;
  max-width: 400px;
  padding: 40px 30px;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.4s ease;
}

.glass-container.active {
  display: flex;
  animation: fadeIn 0.5s ease-out;
}

/* Login Card */
.logo {
  font-size: 48px;
  margin-bottom: 15px;
  animation: float 3s ease-in-out infinite;
}

h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 30px;
}

.input-group {
  width: 100%;
  margin-bottom: 20px;
}

input[type="password"] {
  width: 100%;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  outline: none;
  transition: all 0.3s ease;
  text-align: center;
}

input[type="password"]:focus {
  border-color: #10b981;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.error-msg {
  color: #ef4444;
  font-size: 14px;
  margin-top: 15px;
  font-weight: 500;
}

/* Chat Screen */
.chat-container {
  display: none;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: 800px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-container.active {
  display: flex;
}

/* Chat Header */
.chat-header {
  padding: 20px 24px;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
}

.chat-header h1 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.chat-header p {
  font-size: 12px;
  color: #94a3b8;
}

.btn-secondary {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Chat Messages */
.chat-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.message {
  display: flex;
  width: 100%;
}

.message.user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
}

.message.assistant .message-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  border-top-left-radius: 4px;
}

.message.user .message-bubble {
  background: #10b981;
  color: #fff;
  border-top-right-radius: 4px;
}

/* Markdown spacing inside messages */
.message-bubble p {
  margin-bottom: 10px;
}
.message-bubble p:last-child {
  margin-bottom: 0;
}
.message-bubble ul, .message-bubble ol {
  margin-left: 20px;
  margin-bottom: 10px;
}
.message-bubble li {
  margin-bottom: 5px;
}

/* Chat Footer */
.chat-footer {
  padding: 20px 24px;
  background: rgba(15, 23, 42, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#chat-form {
  display: flex;
  gap: 12px;
  width: 100%;
}

.input-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

#chat-input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: all 0.3s;
}

#chat-input:focus {
  border-color: #10b981;
  background: rgba(255, 255, 255, 0.06);
}

.btn-mic {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  border-radius: 50%;
}

.btn-mic:hover {
  color: #10b981;
}

.btn-mic.listening {
  color: #ef4444;
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-voice-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-voice-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #10b981;
}

.btn-voice-toggle.active {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}

.voice-dropdown {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  outline: none;
  max-width: 140px;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-dropdown:focus {
  border-color: #10b981;
}

.voice-dropdown option {
  background: #0f172a;
  color: #cbd5e1;
}

.btn-send {
  padding: 12px 18px;
  background: #10b981;
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-send:hover {
  background: #059669;
}

/* Micro-animations */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

/* Loader Animation */
.loader-container {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

.loader-dot {
  width: 6px;
  height: 6px;
  background-color: #94a3b8;
  border-radius: 50%;
  animation: loaderPulse 1.2s infinite ease-in-out;
}

.loader-dot:nth-child(2) { animation-delay: 0.2s; }
.loader-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes loaderPulse {
  0%, 100% { transform: scale(0.6); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .chat-header {
    padding: 15px;
  }
  .chat-main {
    padding: 15px;
    gap: 15px;
  }
  .chat-footer {
    padding: 15px 15px 25px 15px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
  }
  .message-bubble {
    max-width: 90%;
  }
}
