:root {
  --pink-50: #fce4ec;
  --pink-100: #f8bbd0;
  --pink-200: #f48fb1;
  --pink-300: #f06292;
  --pink-400: #ec407a;
  --pink-500: #e91e63;
  --pink-600: #d81b60;
  --pink-700: #c2185b;
  --pink-800: #ad1457;
  --pink-900: #880e4f;
  --pink-light: #fce4ec;
  --pink-gradient: linear-gradient(135deg, #f06292, #e91e63);
  --bg-primary: #fef6f9;
  --bg-sidebar: #ffffff;
  --bg-main: #fef6f9;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-user-msg: var(--pink-100);
  --bg-ai-msg: #ffffff;
  --text-primary: #2d1b2e;
  --text-secondary: #6b486b;
  --text-muted: #9e7a9e;
  --border-color: #f0d4e0;
  --shadow-sm: 0 1px 3px rgba(233,30,99,0.08);
  --shadow-md: 0 4px 12px rgba(233,30,99,0.12);
  --shadow-lg: 0 8px 24px rgba(233,30,99,0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-width: 300px;
  --header-height: 64px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border: 2px solid var(--pink-300);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--pink-700);
  z-index: 9999;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.toast .toast-icon {
  margin-right: 8px;
}

[data-theme="dark"] .toast {
  background: #2a1a2b;
  border-color: var(--pink-600);
  color: var(--pink-200);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
  display: flex;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 340px;
  width: 90%;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-duck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-duck-body {
  position: relative;
  width: 44px;
  height: 36px;
  background: #fffde7;
  border-radius: 50% 50% 45% 45%;
  border: 2px solid var(--pink-300);
}

.modal-duck-head {
  position: absolute;
  top: -16px;
  left: 9px;
  width: 26px;
  height: 22px;
  background: #fffde7;
  border-radius: 50%;
  border: 2px solid var(--pink-300);
}

.modal-duck-eye {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #333;
  border-radius: 50%;
  top: 7px;
}

.modal-duck-eye.left { left: 6px; }
.modal-duck-eye.right { right: 6px; }

.modal-duck-beak {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 4px;
  background: #ff8f00;
  border-radius: 0 0 50% 50%;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}

.modal-trash-icon {
  font-size: 28px;
  color: var(--pink-400);
}

.modal-question {
  font-size: 16px;
  font-weight: 600;
  color: var(--pink-700);
  margin: 0 0 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.modal-btn-cancel {
  background: var(--pink-50);
  color: var(--pink-600);
}

.modal-btn-cancel:hover {
  background: var(--pink-100);
}

.modal-btn-danger {
  background: var(--pink-gradient);
  color: white;
}

.modal-btn-danger:hover {
  opacity: 0.9;
}

[data-theme="dark"] .modal-card {
  background: #2a1a2b;
}

[data-theme="dark"] .modal-question {
  color: var(--pink-200);
}

[data-theme="dark"] .modal-btn-cancel {
  background: #3a1a3b;
  color: var(--pink-200);
}

[data-theme="dark"] .modal-btn-cancel:hover {
  background: #4a2a4b;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

[data-theme="dark"] {
  --bg-primary: #1a0f1a;
  --bg-sidebar: #1f1420;
  --bg-main: #1a0f1a;
  --bg-card: #2a1a2b;
  --bg-input: #2a1a2b;
  --bg-user-msg: #4a2040;
  --bg-ai-msg: #2a1a2b;
  --text-primary: #f5e6f0;
  --text-secondary: #d4b0cc;
  --text-muted: #a07898;
  --border-color: #3a2038;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

/* Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 50%, #f48fb1 100%);
  z-index: 9999;
  animation: loginFadeIn 0.5s ease;
}

.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.duck-container {
  display: flex;
  justify-content: center;
  padding: 80px 20px 4px;
  flex-shrink: 0;
}

.login-duck {
  animation: loginDuckFloat 3s ease-in-out infinite;
  margin-bottom: -8px;
}

@keyframes loginDuckFloat {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: scale(1.05); }
  to { opacity: 1; transform: scale(1); }
}

.duck {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: duckBounce 2s ease-in-out infinite;
}

@keyframes duckBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.duck-body {
  position: relative;
  width: 60px;
  height: 48px;
  background: #fffde7;
  border-radius: 50% 50% 45% 45%;
  border: 2.5px solid #f48fb1;
  box-shadow: 0 3px 12px rgba(233,30,99,0.15);
}

.duck-head {
  position: absolute;
  top: -22px;
  left: 12px;
  width: 36px;
  height: 30px;
  background: #fffde7;
  border-radius: 50%;
  border: 2.5px solid #f48fb1;
}

.duck-eye {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #333;
  border-radius: 50%;
  top: 10px;
}

.duck-tear {
  position: absolute;
  width: 4px;
  height: 6px;
  background: #64b5f6;
  border-radius: 50% 50% 50% 50% / 50% 50% 30% 30%;
  top: 18px;
  opacity: 0;
  transition: opacity 0.3s;
}

.duck-tear.left { left: 8px; }
.duck-tear.right { right: 8px; }

.duck.crying .duck-tear {
  opacity: 1;
  animation: tearDrop 1.2s ease-in infinite;
}

.duck.crying .duck-tear.right {
  animation-delay: 0.3s;
}

@keyframes tearDrop {
  0% { transform: translateY(0) scaleX(1); opacity: 0; }
  10% { opacity: 1; }
  60% { transform: translateY(12px) scaleX(0.6); opacity: 0.8; }
  100% { transform: translateY(18px) scaleX(0.3); opacity: 0; }
}

.duck-eye.left { left: 9px; }
.duck-eye.right { right: 9px; }

.duck-beak {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 6px;
  background: #ff8f00;
  border-radius: 0 0 50% 50%;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}

.duck-wing {
  position: absolute;
  bottom: 4px;
  right: -4px;
  width: 20px;
  height: 14px;
  background: linear-gradient(135deg, #fce4ec, #f8bbd0);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-10deg);
}

.duck-bubble {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 2px solid var(--pink-300);
  border-radius: 16px;
  padding: 10px 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 10;
  animation: duckTextFade 1s ease;
}

.duck-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid white;
}

.duck-bubble::before {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 14px solid var(--pink-300);
  z-index: -1;
}

.duck-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--pink-500);
  white-space: nowrap;
}

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

[data-theme="dark"] .duck-text {
  color: var(--pink-200);
}

[data-theme="dark"] .duck-bubble {
  background: #2a2a2a;
  border-color: var(--pink-600);
}

[data-theme="dark"] .duck-bubble::after {
  border-top-color: #2a2a2a;
}

[data-theme="dark"] .duck-bubble::before {
  border-top-color: var(--pink-600);
}
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(233,30,99,0.12);
  border: 2px solid var(--pink-100);
  white-space: nowrap;
  animation: speechFade 0.5s ease 0.5s both;
}

.duck-speech::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: white;
}

.duck-speech::after {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right-color: var(--pink-100);
  z-index: -1;
}

@keyframes speechFade {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

.login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 400px;
  margin: 20px;
  box-shadow: 0 20px 60px rgba(233,30,99,0.2);
  text-align: center;
  animation: loginSlideUp 0.5s ease 0.1s both;
}

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

.login-logo {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.login-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--pink-200);
}

.login-icon {
  font-size: 72px;
  color: var(--pink-400);
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--pink-500);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-form {
  text-align: left;
}

.form-group {
  position: relative;
  margin-bottom: 16px;
}

.form-group label {
  position: absolute;
  left: 14px;
  top: 14px;
  color: var(--text-muted);
  font-size: 16px;
}

.form-group input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--pink-50);
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
}

.form-group input:focus {
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px rgba(240,98,146,0.15);
  background: white;
}

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

.password-group {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: var(--pink-400);
  background: var(--pink-50);
}

.forgot-password {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  margin: -8px 0 16px;
  transition: var(--transition);
}

.forgot-password:hover {
  color: var(--pink-500);
  text-decoration: underline;
}

.login-error {
  background: #fce4ec;
  color: #c62828;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  border: 1px solid #f8bbd0;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--pink-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(233,30,99,0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-spinner {
  display: flex;
  gap: 4px;
}

.login-spinner span {
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.login-spinner span:nth-child(2) { animation-delay: 0.2s; }
.login-spinner span:nth-child(3) { animation-delay: 0.4s; }

[data-theme="dark"] .login-screen {
  background: linear-gradient(135deg, #1a0f1a 0%, #2a1525 50%, #3a1a30 100%);
}

[data-theme="dark"] .forgot-password {
  color: var(--text-muted);
}

[data-theme="dark"] .forgot-password:hover {
  color: var(--pink-300);
}

.sidebar-duck {
  padding: 4px 16px 4px;
  display: flex;
  justify-content: center;
}

.happy-duck {
  animation: happyDance 1s ease-in-out infinite;
  transform-origin: center;
}

@keyframes happyDance {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  25% { transform: translateY(-4px) rotate(5deg); }
  50% { transform: translateY(-2px) rotate(-3deg); }
  75% { transform: translateY(-5px) rotate(3deg); }
}

.happy-duck .duck-body {
  width: 44px;
  height: 36px;
}

.happy-duck .duck-head {
  top: -16px;
  left: 9px;
  width: 26px;
  height: 22px;
}

.happy-duck .duck-eye {
  width: 4px;
  height: 4px;
  top: 7px;
}

.happy-duck .duck-eye.left { left: 6px; }
.happy-duck .duck-eye.right { right: 6px; }

.happy-duck .duck-beak {
  width: 8px;
  height: 5px;
}

.happy-duck .duck-wing {
  width: 14px;
  height: 10px;
  bottom: 3px;
  right: -3px;
}

.happy-duck .duck-hearts {
  position: absolute;
  top: -14px;
  right: -20px;
  font-size: 14px;
  animation: heartsFloat 1.5s ease-in-out infinite;
}

@keyframes heartsFloat {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.8; }
  50% { transform: translateY(-6px) scale(1.2); opacity: 1; }
}

[data-theme="dark"] .duck-body,
[data-theme="dark"] .duck-head {
  background: #fffde7;
  border-color: #f48fb1;
}

[data-theme="dark"] .duck-wing {
  background: linear-gradient(135deg, #fce4ec, #f8bbd0);
}

[data-theme="dark"] .duck-beak {
  background: #ff8f00;
}

[data-theme="dark"] .login-card {
  background: var(--bg-sidebar);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

[data-theme="dark"] .form-group input {
  background: var(--bg-input);
  color: var(--text-primary);
}

[data-theme="dark"] .form-group input:focus {
  background: var(--bg-card);
}

/* App Layout */
#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sidebar-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--pink-500);
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-sidebar-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: var(--transition);
  display: none;
}

.close-sidebar-btn:hover {
  background: var(--pink-50);
  color: var(--pink-500);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-user-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pink-200);
}

.sidebar-user-fallback {
  font-size: 20px;
  color: var(--text-muted);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.sidebar-user-status {
  font-size: 11px;
  color: #4caf50;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.logout-btn:hover {
  color: #ef5350;
  background: rgba(239,83,80,0.1);
}

.btn-new-chat {
  width: 100%;
  padding: 10px;
  background: var(--pink-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-new-chat:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233,30,99,0.3);
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.session-list::-webkit-scrollbar {
  width: 4px;
}

.session-list::-webkit-scrollbar-thumb {
  background: var(--pink-200);
  border-radius: 2px;
}

.session-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
  border: 1px solid transparent;
}

.session-item:hover {
  background: var(--pink-50);
  border-color: var(--pink-100);
}

.session-item.active {
  background: var(--pink-100);
  border-color: var(--pink-300);
}

.session-item-content {
  flex: 1;
  min-width: 0;
}

.session-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.session-item-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: var(--transition);
  font-size: 12px;
}

.session-item:hover .session-item-delete {
  opacity: 1;
}

.session-item-delete:hover {
  color: #ef5350;
  background: rgba(239,83,80,0.1);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.support-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--pink-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.support-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.support-btn i {
  font-size: 16px;
}

.footer-text {
  font-size: 11px;
  color: var(--text-muted);
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
}

#chatHeader {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.menu-toggle:hover {
  background: var(--pink-50);
}

.header-info {
  flex: 1;
  min-width: 0;
}

.header-info h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-status {
  font-size: 12px;
  color: var(--text-muted);
}

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

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--pink-50);
  color: var(--pink-500);
}

#chatContainer {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

#chatContainer::-webkit-scrollbar {
  width: 6px;
}

#chatContainer::-webkit-scrollbar-thumb {
  background: var(--pink-200);
  border-radius: 3px;
}

.login-logo .login-icon {
  font-size: 40px;
  color: var(--pink-400);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-content {
  text-align: center;
  max-width: 480px;
}

.welcome-icon {
  font-size: 64px;
  color: var(--pink-300);
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

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

.welcome-content h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--pink-500);
  margin-bottom: 12px;
}

.welcome-content p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 32px;
}

.welcome-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.feature-card:hover {
  border-color: var(--pink-300);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.feature-card i {
  font-size: 24px;
  color: var(--pink-400);
}

.feature-card span {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.messages-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

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

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

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  overflow: hidden;
}

.message-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.message.user .message-avatar {
  background: var(--pink-gradient);
  color: white;
}

.message.ai .message-avatar {
  background: linear-gradient(135deg, #a855f7, #e91e63);
  color: white;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  line-height: 1.6;
  font-size: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message.user .message-bubble {
  background: var(--pink-gradient);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.ai .message-bubble {
  background: var(--bg-ai-msg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.message-bubble p {
  margin-bottom: 8px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble pre {
  background: rgba(0,0,0,0.05);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 13px;
}

[data-theme="dark"] .message-bubble pre {
  background: rgba(0,0,0,0.3);
}

.message-bubble code {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 13px;
}

.message-bubble ul, .message-bubble ol {
  padding-left: 20px;
  margin: 8px 0;
}

.message-image {
  max-width: 300px;
  max-height: 300px;
  border-radius: var(--radius-sm);
  margin: 8px 0;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
}

.message-image:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.message-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.loading-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.typing-indicator {
  display: flex;
  gap: 4px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--pink-300);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--pink-300);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-8px); opacity: 1; }
}

#inputArea {
  padding: 12px 24px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--pink-50);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  position: relative;
  border: 1px solid var(--pink-200);
  min-height: 40px;
}

.files-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.file-preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--pink-200);
  border-radius: 6px;
  padding: 4px 8px;
  max-width: 180px;
}

.file-preview-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
}

.file-preview-icon {
  font-size: 20px;
  color: var(--pink-400);
}

.file-preview-name {
  font-size: 11px;
  color: var(--pink-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
  font-weight: 500;
}

.remove-image-btn {
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: -6px;
  right: -6px;
  transition: var(--transition);
}

.remove-image-btn:hover {
  background: #ef5350;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 8px 8px 12px;
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px rgba(240,98,146,0.15);
}

.input-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  flex-shrink: 0;
}

.input-action-btn:hover {
  color: var(--pink-400);
  background: var(--pink-50);
}

#messageInput {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-primary);
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  font-family: inherit;
}

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

.send-btn {
  background: var(--pink-gradient);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(233,30,99,0.3);
}

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

.input-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .login-container {
    gap: 8px;
    padding: 16px;
  }

  .login-duck {
    transform: scale(0.8);
    margin-bottom: -12px;
  }

  .login-card {
    padding: 28px 20px 24px;
    margin: 0;
    border-radius: var(--radius-lg);
  }

  .login-title {
    font-size: 22px;
  }

  .form-group input {
    padding: 12px 12px 12px 40px;
    font-size: 14px;
  }

  .login-btn {
    padding: 12px;
    font-size: 14px;
  }
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: block;
  }

  .close-sidebar-btn {
    display: flex;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-user {
    padding: 10px 16px;
  }
}

.session-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px;
}

  .message {
    max-width: 95%;
  }

  #chatContainer {
    padding: 16px;
  }

  #inputArea {
    padding: 8px 12px 12px;
  }

  .welcome-content h1 {
    font-size: 22px;
  }

  .welcome-features {
    grid-template-columns: 1fr 1fr;
  }
}
