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

:root {
  /* Light Theme - stil ChatGPT */
  --primary: #10a37f;
  --primary-hover: #0d8a6a;
  --bg: #ffffff;
  --bg-secondary: #f7f7f8;
  --bg-tertiary: #ececf1;
  --bg-hover: #e5e5e5;
  --text: #343541;
  --text-secondary: #6e6e80;
  --text-muted: #8e8ea0;
  --border: #d9d9e3;
  --success: #10a37f;
  --error: #ef4444;
  --user-bg: #f7f7f8;
  --assistant-bg: #ffffff;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Load Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 900px;
  margin: 0 auto;
}

/* Header - Minimalist */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  flex-shrink: 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 22px;
}

.logo-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Mode Toggle (Vocal/Text) */
.mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: 10px;
}

.mode-btn {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0.5;
}

.mode-btn:hover {
  opacity: 0.8;
}

.mode-btn.active {
  background: var(--bg);
  opacity: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Update Badge */
.update-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.update-badge.hidden {
  display: none;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

/* What's New Modal */
.whats-new-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.whats-new-modal.hidden {
  display: none;
}

.whats-new-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

.whats-new-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.whats-new-header h2 {
  font-size: 18px;
  color: var(--text);
  margin: 0;
}

.whats-new-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.whats-new-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.whats-new-body {
  padding: 20px;
}

.update-version {
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.update-title {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 12px;
}

.update-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.update-features li {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}

.update-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
}

/* Chat Container */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Welcome Screen - Clean */
.welcome-message {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.welcome-icon {
  font-size: 48px;
  margin-bottom: 24px;
  opacity: 0.9;
}

.welcome-message h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.welcome-message p {
  font-size: 15px;
  color: var(--text-muted);
}

/* Messages - Professional Style */
.message {
  display: flex;
  gap: 16px;
  max-width: 100%;
  animation: fadeIn 0.2s ease;
}

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

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.message.assistant .message-avatar {
  background: var(--primary);
  color: white;
  border-radius: 50%;
}

.message.user .message-avatar {
  display: none;
}

.message-content {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  max-width: 70%;
  font-size: 15px;
}

.message.user .message-content {
  background: var(--user-bg);
  color: var(--text);
  border-radius: 18px 18px 4px 18px;
  border: 1px solid var(--border);
}

.message.assistant .message-content {
  background: var(--assistant-bg);
  color: var(--text);
  padding-left: 0;
  max-width: 85%;
  line-height: 1.5;
}

/* Code blocks in messages */
.message-content pre {
  background: #1e1e1e;
  color: #d4d4d4;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0;
  overflow-x: auto;
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.message-content code {
  font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  background: var(--bg-tertiary);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Links in messages */
.message-content a,
.message-content a.chat-link {
  color: #2563eb;
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s, text-decoration 0.2s;
}

.message-content a:hover,
.message-content a.chat-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.message.user .message-content a {
  color: #2563eb;
}

.message.user .message-content a:hover {
  color: #1d4ed8;
}

/* Link Preview Cards */
.link-previews {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.link-preview-wrapper {
  max-width: 350px;
}

.link-preview-card {
  display: block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  transition: all 0.2s ease;
}

.link-preview-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.link-preview-image {
  width: 100%;
  max-height: 180px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.link-preview-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.link-preview-content {
  padding: 12px;
}

.link-preview-site {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.link-preview-favicon {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.link-preview-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-preview-desc {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message.user .link-preview-card {
  margin-left: auto;
}

/* Typing Indicator - Subtle */
.typing {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.typing span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* Reply Preview */
.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
  border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
  margin-bottom: 12px;
  animation: slideDown 0.2s ease;
}

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

.reply-preview.hidden {
  display: none;
}

.reply-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.reply-label {
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 2px;
}

.reply-text {
  color: var(--text-secondary);
  font-size: 13px;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Citat în mesaj (stil WhatsApp) */
.reply-quote {
  background: rgba(99, 102, 241, 0.1);
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  padding: 6px 10px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

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

.quote-icon {
  font-size: 12px;
  opacity: 0.8;
}

.quote-text {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Highlight când scrollezi la mesaj */
.message.highlight-message {
  animation: highlightPulse 2s ease;
}

@keyframes highlightPulse {
  0% { background: rgba(99, 102, 241, 0.3); }
  50% { background: rgba(99, 102, 241, 0.15); }
  100% { background: transparent; }
}

.cancel-reply {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 16px;
  border-radius: 4px;
  transition: all 0.15s ease;
  margin-left: 8px;
}

.cancel-reply:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Message swipe hint */
.message {
  cursor: pointer;
  transition: background 0.15s ease;
}

.message:active {
  background: var(--bg-hover);
}

.message.selected-for-reply {
  background: rgba(99, 102, 241, 0.1);
  border-left: 2px solid var(--primary);
}

/* Input Area - Clean */
.input-area {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 16px 24px 24px;
  flex-shrink: 0;
  position: relative;
}

.input-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 6px 6px 6px 16px;
  transition: border-color 0.15s ease;
}

.input-container:focus-within {
  border-color: var(--primary);
}

#messageInput {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 15px;
  padding: 10px 0;
  outline: none;
  font-family: inherit;
}

#messageInput::placeholder {
  color: var(--text-muted);
}

.btn-voice, .btn-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-voice {
  background: transparent;
  color: var(--text-secondary);
}

.btn-voice:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-voice.recording {
  background: var(--error);
  color: white;
}

.btn-send {
  background: var(--primary);
  color: white;
}

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

.btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Voice Wave - Minimal */
.voice-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.voice-wave span {
  width: 3px;
  height: 100%;
  background: white;
  border-radius: 2px;
  animation: wave 0.6s ease-in-out infinite;
}

.voice-wave span:nth-child(2) { animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

.hidden {
  display: none !important;
}

/* Status - Subtle */
.status {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  min-height: 18px;
}

.status.error {
  color: var(--error);
}

/* Speaker Button */
.btn-speaker {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  margin-left: 8px;
  border-radius: 4px;
  font-size: 13px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.btn-speaker:hover {
  opacity: 1;
}

.btn-speaker.playing {
  color: var(--primary);
  opacity: 1;
}

/* Message Actions (speaker + download) */
.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Download Buttons */
.download-buttons {
  display: flex;
  gap: 6px;
}

.btn-download {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-download:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.message.user .download-buttons {
  display: none;
}

/* Attach Button - Plus pentru poze */
.btn-attach {
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  color: var(--primary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-attach:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  transform: scale(1.05);
}

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

/* Meniu Attach - opțiuni tip fișier */
.attach-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: slideUp 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 220px;
}

.attach-menu.hidden {
  display: none;
}

.attach-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
  width: 100%;
  text-align: left;
}

.attach-option:hover {
  background: var(--bg-hover);
}

.attach-option:active {
  background: var(--bg-tertiary);
}

.attach-icon {
  font-size: 24px;
}

.attach-label {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

/* File Preview (imagine, PDF, TXT) */
.file-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  animation: slideDown 0.2s ease;
}

.file-preview.hidden {
  display: none;
}

.file-preview img {
  max-width: 120px;
  max-height: 80px;
  border-radius: 8px;
  object-fit: cover;
}

.preview-file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  padding: 8px 12px;
  border-radius: 8px;
}

.preview-file-info #fileIcon {
  font-size: 24px;
}

.preview-file-info #fileName {
  color: var(--text);
  font-size: 13px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cancel-file {
  background: var(--bg-hover);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.15s ease;
  margin-left: auto;
}

.cancel-file:hover {
  background: var(--error);
  color: white;
}

/* Image in message */
.message-image {
  max-width: 250px;
  max-height: 200px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.message-image:hover {
  transform: scale(1.02);
}

/* Image modal for full view */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
}

.image-modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
}

.image-modal.hidden {
  display: none;
}

/* Mobile Optimization */
@media (max-width: 600px) {
  .header {
    padding: 12px 16px;
  }
  
  .chat-container {
    padding: 20px 16px;
    gap: 20px;
  }
  
  .input-area {
    padding: 12px 16px 20px;
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .message.assistant .message-content {
    max-width: 95%;
  }
}

/* Scrollbar - Minimal */
.chat-container::-webkit-scrollbar {
  width: 6px;
}

.chat-container::-webkit-scrollbar-track {
  background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Guest overlay */
.guest-overlay {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
}

.guest-overlay a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.guest-overlay a:hover {
  text-decoration: underline;
}
