@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=Outfit:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --card: #1f1f23;
  --input-bg: #121214;
  --msg-own: #5b21b6;
  --msg-other: #27272a;
  --online: #22c55e;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --secondary: #6366f1;
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #27272a;
  --hover: rgba(139, 92, 246, 0.1);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: 200ms ease;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: 'Syne', sans-serif;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', monospace;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

input, textarea {
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* App Container */
#app {
  height: 100%;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Views */
.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--transition), transform var(--transition);
}

.view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Primary Button */
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background var(--transition), transform 100ms ease;
}

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

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Secondary Button */
.btn-secondary {
  background: var(--card);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition);
}

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

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}

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

.btn-icon svg {
  width: 20px;
  height: 20px;
}

/* Input */
.input {
  background: var(--input-bg);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  border: 1px solid var(--border);
  transition: border-color var(--transition);
  width: 100%;
}

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

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

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Online Dot */
.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  display: inline-block;
  flex-shrink: 0;
}

/* Toasts */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: white;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 300ms ease, transform 300ms ease;
  max-width: 360px;
  box-shadow: var(--shadow);
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  background: var(--success);
  color: #052e16;
}

.toast-error {
  background: var(--danger);
}

.toast-info {
  background: var(--secondary);
}

/* Dialog Overlay */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.dialog-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow);
  transform: scale(0.95);
  transition: transform var(--transition);
}

.dialog-overlay.active .dialog {
  transform: scale(1);
}

.dialog h3 {
  font-size: 1.2rem;
  margin-bottom: 20px;
}

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

.dialog .form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.dialog .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* Animations */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceIn {
  0% { transform: scale(0) translateX(-50%); opacity: 0; }
  50% { transform: scale(1.1) translateX(-50%); }
  100% { transform: scale(1) translateX(-50%); opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

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

/* Responsive */
@media (max-width: 768px) {
  #toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: 100%;
  }
}
