/* ----------------------------------------------------
   Design System & Custom Properties
   ---------------------------------------------------- */
:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Color Palette - Vibrant Dark Mode */
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #311042 100%);
  --panel-bg: rgba(30, 41, 59, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --secondary: #a855f7;
  --secondary-hover: #9333ea;
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);

  --info: #0ea5e9;
  --info-bg: rgba(14, 165, 233, 0.12);
  --info-border: rgba(14, 165, 233, 0.3);

  --warning: #f59e0b;
  --danger: #ef4444;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: #090d16;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Animated Background */
.glass-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
  z-index: -2;
}

.glass-bg::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 60%),
              radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 50%);
  animation: bg-spin 25s linear infinite;
  z-index: -1;
}

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

/* Page Layout Container */
.container {
  width: 100%;
  max-width: 900px;
  height: 90vh;
  max-height: 800px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  z-index: 1;
}

/* Header Styles */
.app-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding: 10px 5px;
}

.header-logo {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 8px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-titles h1 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.header-titles p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Chat Main Layout Wrapper */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.chat-container {
  flex: 1;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.4);
}

.bot-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.status-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #0f172a;
}

.status-indicator.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.bot-info h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.bot-status {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 500;
}

/* Chat Messages Log Area */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar for Messages */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Chat Bubbles Base */
.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: message-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes message-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* Message Bubble Styling */
.message-bubble {
  padding: 12px 16px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.message.bot .message-bubble {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-md);
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  border-radius: var(--radius-md) 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 5px;
  align-self: flex-end;
}

.message.bot .message-time {
  align-self: flex-start;
  margin-left: 2px;
}

/* Interactive Choices/Buttons inside Bot responses */
.options-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.option-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.option-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

/* Card Templates */
.card {
  margin-top: 10px;
  padding: 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  width: 100%;
}

/* Stock Status Card */
.card.stock-card {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
}

.card.stock-card.out-of-stock {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.stock-card .card-title {
  color: var(--success);
}

.stock-card.out-of-stock .card-title {
  color: var(--info);
}

.card-content {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.card-content strong {
  color: var(--text-primary);
}

/* Form Container inside Chat bubble */
.chat-form-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.form-group input, 
.form-group select, 
.form-group textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 5px;
}

.form-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.form-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.form-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.form-btn.submit {
  background: var(--primary);
  color: #ffffff;
}

.form-btn.submit:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Autocomplete Panel Layout above Footer input */
.suggestions-panel {
  position: absolute;
  bottom: 70px;
  left: 20px;
  right: 20px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  animation: slide-up 0.2s ease-out;
}

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

.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background: rgba(99, 102, 241, 0.2);
}

.suggestion-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.suggestion-code {
  font-size: 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

/* Chat Input Footer container */
.chat-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--panel-border);
  background: rgba(15, 23, 42, 0.4);
}

.input-form {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 5px 5px 5px 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-form:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.input-form input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  padding: 10px 0;
}

.input-form input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  background: var(--primary);
  border: none;
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.send-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Typing Indicatordots */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 15px;
  align-items: center;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1s infinite ease-in-out;
}

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

@keyframes typing-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Summary Box in Confirm Step */
.summary-card {
  background: rgba(99, 102, 241, 0.08);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 10px;
  width: 100%;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.summary-item .label {
  color: var(--text-secondary);
  font-weight: 500;
}

.summary-item .value {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
}
