:root {
  /* Light theme colors */
  --primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --primary-solid: #667eea;
  --primary-hover: #5a6fd8;
  --secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Background colors */
  --bg-main: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-surface: rgba(255, 255, 255, 0.95);
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-input: rgba(255, 255, 255, 0.9);
  --bg-overlay: rgba(255, 255, 255, 0.1);
  
  /* Text colors */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;
  
  /* Border and shadows */
  --border-color: rgba(255, 255, 255, 0.2);
  --border-solid: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  
  /* Message bubbles */
  --user-bubble: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --ai-bubble: rgba(255, 255, 255, 0.85);
  
  /* Animation */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.35s ease;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
}

/* Dark theme */
body.dark-theme {
  --bg-main: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 100%);
  --bg-surface: rgba(17, 24, 39, 0.95);
  --bg-card: rgba(31, 41, 55, 0.8);
  --bg-input: rgba(55, 65, 81, 0.9);
  --bg-overlay: rgba(0, 0, 0, 0.3);
  
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  
  --border-solid: #374151;
  --ai-bubble: rgba(31, 41, 55, 0.85);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: all var(--transition-normal);
}

/* Animated Background */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
  backdrop-filter: blur(10px);
}

.shape-1 { width: 80px; height: 80px; top: 10%; left: 10%; animation-delay: 0s; }
.shape-2 { width: 60px; height: 60px; top: 70%; left: 80%; animation-delay: 2s; }
.shape-3 { width: 40px; height: 40px; top: 40%; left: 60%; animation-delay: 4s; }
.shape-4 { width: 100px; height: 100px; top: 80%; left: 20%; animation-delay: 1s; }
.shape-5 { width: 50px; height: 50px; top: 20%; left: 70%; animation-delay: 3s; }

.gradient-orbs {
  position: absolute;
  width: 100%;
  height: 100%;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  animation: drift 8s ease-in-out infinite;
}

.orb-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.4) 0%, transparent 70%);
  top: -150px;
  right: -150px;
  animation-delay: 0s;
}

.orb-2 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(245, 87, 108, 0.3) 0%, transparent 70%);
  bottom: -125px;
  left: -125px;
  animation-delay: 3s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 6s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(180deg); }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* App Container */
.app-container {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg);
  gap: var(--space-lg);
}

/* Premium Header */
.premium-header {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: var(--space-lg);
  box-shadow: var(--shadow-glass);
  animation: slideInDown 0.6s ease-out;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo-icon {
  width: 60px;
  height: 60px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
  animation: pulse 2s infinite;
}

.title-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.main-title {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin: 0;
}

.gradient-text {
  background: var(--primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.1));
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.subtitle i {
  color: var(--primary-solid);
  animation: sparkle 1.5s ease-in-out infinite;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--bg-card);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  color: var(--text-secondary);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: var(--primary-solid);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

.status-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chat Wrapper */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-glass);
  overflow: hidden;
  animation: slideInUp 0.6s ease-out;
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
  scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: var(--space-2xl);
  animation: fadeInScale 0.8s ease-out;
}

.welcome-icon {
  width: 80px;
  height: 80px;
  background: var(--secondary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  font-size: 32px;
  color: var(--text-inverse);
  box-shadow: var(--shadow-xl);
  animation: bounce 2s infinite;
}

.welcome-message h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.welcome-message p {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto var(--space-xl);
  line-height: 1.6;
}

/* Suggestion Chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
}

.chip {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 25px;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--primary);
  color: var(--text-inverse);
  border-color: transparent;
}

.chip i {
  font-size: 12px;
}

/* Message Styles */
.message {
  margin-bottom: var(--space-lg);
  animation: messageSlideIn 0.4s ease-out;
}

.user-message {
  margin-left: auto;
  max-width: 70%;
  background: var(--user-bubble);
  color: var(--text-inverse);
  padding: var(--space-md) var(--space-lg);
  border-radius: 20px 20px 8px 20px;
  box-shadow: var(--shadow-md);
  font-weight: 500;
}

.ai-message {
  margin-right: auto;
  max-width: 80%;
  background: var(--ai-bubble);
  border: 1px solid var(--border-color);
  padding: var(--space-lg);
  border-radius: 20px 20px 20px 8px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.ai-message-content pre {
  background: var(--bg-card);
  padding: var(--space-lg);
  border-radius: 12px;
  overflow-x: auto;
  margin: var(--space-md) 0;
  border: 1px solid var(--border-solid);
  box-shadow: var(--shadow-sm);
}

/* Input Container */
.input-container {
  border-top: 1px solid var(--border-color);
  padding: var(--space-xl);
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
}

.input-wrapper {
  margin-bottom: var(--space-md);
}

.input-field-container {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: 20px;
  padding: var(--space-sm);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.input-field-container.focused {
  border-color: transparent;   /* remove border highlight */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); /* light subtle shadow */
  transform: none; /* remove jump-up animation */
}


.input-icon {
  padding: var(--space-sm) var(--space-md);
  color: var(--text-muted);
  font-size: 16px;
}

.premium-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: var(--space-md) var(--space-sm);
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.premium-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.input-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.attachment-btn,
.voice-btn,
.send-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  font-size: 16px;
}

.attachment-btn,
.voice-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.attachment-btn:hover,
.voice-btn:hover {
  background: var(--primary-solid);
  color: var(--text-inverse);
  transform: translateY(-2px);
}

.send-btn {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
}

.send-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  justify-content: center;
  padding: var(--space-md);
}

.typing-indicator.show {
  display: flex;
}

.typing-indicator .dot {
  width: 8px;
  height: 8px;
  background: var(--primary-solid);
  border-radius: 50%;
  margin: 0 2px;
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Footer Info */
.footer-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.status {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.text-success {
  color: var(--success);
}

.word-count {
  font-weight: 500;
}

/* Premium Footer */
.premium-footer {
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  animation: slideInUp 0.6s ease-out 0.2s both;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.creator-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  color: var(--text-secondary);
}

.heart-icon {
  font-size: 16px;
  color: #ef4444;
  animation: heartbeat 1.5s ease-in-out infinite;
}

.creator-name {
  background: var(--primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

.version-info {
  display: flex;
  align-items: center;
}

.version-badge {
  padding: var(--space-xs) var(--space-sm);
  background: var(--success);
  color: var(--text-inverse);
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Animations */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes sparkle {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% { transform: translate3d(0,0,0); }
  40%, 43% { transform: translate3d(0, -10px, 0); }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .app-container {
    padding: var(--space-md);
  }
  
  .orb-1, .orb-2, .orb-3 {
    width: 200px;
    height: 200px;
  }
}

@media (max-width: 768px) {
  .app-container {
    padding: var(--space-sm);
    gap: var(--space-md);
  }

  .premium-header {
    padding: var(--space-md);
    border-radius: 16px;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .logo-section {
    flex-direction: column;
    text-align: center;
  }

  .logo-icon {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .main-title {
    font-size: 24px;
  }

  .header-actions {
    width: 100%;
    justify-content: center;
  }

  .chat-wrapper {
    border-radius: 20px;
  }

  .chat-container {
    padding: var(--space-lg);
  }

  .welcome-message {
    padding: var(--space-lg);
  }

  .welcome-icon {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }

  .welcome-message h2 {
    font-size: 24px;
  }

  .suggestion-chips {
    flex-direction: column;
    align-items: center;
  }

  .chip {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .user-message,
  .ai-message {
    max-width: 90%;
  }

  .input-container {
    padding: var(--space-lg);
  }

  .input-field-container {
    flex-wrap: wrap;
  }

  .input-actions {
    flex-wrap: wrap;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
  }

  .premium-footer {
    border-radius: 12px;
  }

  /* Hide floating shapes on mobile for better performance */
  .floating-shapes,
  .gradient-orbs {
    display: none;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: var(--space-xs);
  }

  .premium-header {
    padding: var(--space-sm);
  }

  .chat-container {
    padding: var(--space-md);
  }

  .input-container {
    padding: var(--space-md);
  }

  .input-field-container {
    padding: var(--space-xs);
  }

  .attachment-btn,
  .voice-btn,
  .send-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .premium-input {
    font-size: 14px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --bg-surface: rgba(255, 255, 255, 1);
    --bg-card: rgba(255, 255, 255, 1);
    --border-color: #000000;
  }

  body.dark-theme {
    --bg-surface: rgba(0, 0, 0, 1);
    --bg-card: rgba(17, 17, 17, 1);
    --border-color: #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .floating-shapes,
  .gradient-orbs {
    display: none;
  }
}

/* Focus styles for accessibility */
.theme-toggle:focus,
.chip:focus,
.attachment-btn:focus,
.voice-btn:focus,
.send-btn:focus {
  outline: 2px solid var(--primary-solid);
  outline-offset: 2px;
}

.premium-input:focus {
  box-shadow: none;   /* prevent double shadow */
  outline: none;
}

/* Custom scrollbar for webkit browsers */
.chat-container {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

/* Loading states */
.send-btn.loading {
  pointer-events: none;
}

.send-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Hover effects for interactive elements */
.premium-input:hover {
  background: var(--bg-card);
}

.chip:active {
  transform: translateY(-1px) scale(0.98);
}

.send-btn:active {
  transform: translateY(0) scale(0.95);
}

/* Glass morphism enhancement */
.glass-effect {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

body.dark-theme .glass-effect {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Message animation variations */
.message.user-message {
  animation-name: messageSlideInRight;
}

@keyframes messageSlideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Enhanced copy button styles */
.copy-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-solid);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  float: right;
  margin-top: -8px;
  margin-right: -8px;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
}

.copy-btn:hover {
  background: var(--primary-solid);
  color: var(--text-inverse);
  transform: translateY(-1px);
}

.copy-btn.copied {
  background: var(--success);
  color: var(--text-inverse);
}

/* Status indicator improvements */
.status-indicator.error .status-dot {
  background: var(--danger);
  animation: pulse-error 1s infinite;
}

.status-indicator.warning .status-dot {
  background: var(--warning);
  animation: pulse-warning 1s infinite;
}

@keyframes pulse-error {
  0%, 100% { opacity: 1; background: var(--danger); }
  50% { opacity: 0.6; background: #dc2626; }
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; background: var(--warning); }
  50% { opacity: 0.6; background: #d97706; }
}