/* Agent Martin Dashboard — Dark Mode Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --accent: #1e5faa;
  --accent-light: #3a8fd4;
  --accent-hover: #174a88;
  --bg: #0f1117;
  --card-bg: #1a1d27;
  --text: #e8e8f0;
  --text-light: #8888aa;
  --border: #2a2d37;
  --sidebar-width: 260px;
  --nav-height: 60px;
  --chat-martin-bg: rgba(30,95,170,0.15);
  --chat-user-bg: #1e5faa;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --hover-bg: rgba(255,255,255,0.05);
  --input-bg: #1a1d27;
  --input-border: #2a2d37;
  --input-focus-border: #1e5faa;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ==================== LOGIN PAGE ==================== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  border: 1px solid var(--border);
}

.login-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  border: 3px solid var(--accent);
  box-shadow: 0 0 20px rgba(30,95,170,0.3);
}

.login-card h1 {
  font-size: 24px;
  margin-bottom: 4px;
  color: var(--text);
}

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

.login-card .form-group {
  margin-bottom: 16px;
  text-align: left;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
}

.login-card input::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}

.login-card input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px rgba(30,95,170,0.2);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 24px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  margin-top: 8px;
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 0 16px rgba(30,95,170,0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-success {
  display: none;
  padding: 16px;
  background: rgba(30,95,170,0.15);
  border-radius: var(--radius-sm);
  color: var(--accent-light);
  font-size: 14px;
  margin-top: 16px;
  border: 1px solid rgba(30,95,170,0.3);
}

/* ==================== DASHBOARD LAYOUT ==================== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top Nav */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding: 0 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent-light);
  text-decoration: none;
}

.topnav-brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topnav-email {
  font-size: 13px;
  color: var(--text-light);
}

.btn-logout {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--hover-bg);
  border-color: var(--text-light);
  color: var(--text);
}

/* Main body */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-menu {
  list-style: none;
  padding: 12px 8px;
}

.sidebar-menu li {
  margin-bottom: 2px;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.sidebar-menu a.active {
  background: rgba(30,95,170,0.2);
  color: var(--accent-light);
  font-weight: 600;
  border-left-color: var(--accent);
}

.sidebar-menu .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* Content area */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==================== CHAT ==================== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 70%;
  animation: msgIn 0.25s ease;
}

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

.chat-msg.martin {
  align-self: flex-start;
}

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

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 4px;
  border: 2px solid var(--accent);
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-msg.martin .chat-bubble {
  background: var(--chat-martin-bg);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
  background: var(--chat-user-bg);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

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

.chat-msg.user .chat-time {
  text-align: right;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  max-width: 70%;
  animation: msgIn 0.25s ease;
}

.typing-indicator .chat-avatar {
  width: 40px;
  height: 40px;
}

.typing-bubble {
  background: var(--chat-martin-bg);
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  font-size: 14px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-bubble span {
  font-size: 14px;
  margin-right: 4px;
}

.typing-dots {
  display: inline-flex;
  gap: 3px;
}

.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-light);
  display: inline-block;
  animation: dotPulse 1.4s infinite;
}

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

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

/* ==================== ONBOARDING ==================== */
.onboarding-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
  animation: msgIn 0.3s ease;
}

.onboarding-choices button {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  line-height: 1.4;
}

.onboarding-choices button:hover {
  border-color: var(--accent);
  background: rgba(30,95,170,0.1);
  box-shadow: 0 0 12px rgba(30,95,170,0.15);
}

.onboarding-choices button:active {
  transform: scale(0.98);
}

/* Chat input */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}

.chat-input-bar input {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid var(--input-border);
  border-radius: 24px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  background: var(--bg);
  color: var(--text);
}

.chat-input-bar input::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}

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

.chat-input-bar input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.btn-send:hover {
  background: var(--accent-light);
  box-shadow: 0 0 12px rgba(30,95,170,0.3);
}

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

/* ==================== PAGES ==================== */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.page.active {
  display: flex;
  flex-direction: column;
}

.page-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-light);
  font-size: 16px;
}

.settings-info {
  background: var(--card-bg);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.settings-info h2 {
  font-size: 20px;
  margin-bottom: 16px;
  color: var(--text);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-weight: 600;
  min-width: 140px;
  color: var(--text-light);
}

.settings-value {
  color: var(--text);
  font-family: 'Space Grotesk', monospace;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.status-badge.active {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: statusPulse 2s ease infinite;
}

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

/* ==================== MOBILE ==================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 100;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .sidebar-menu {
    display: flex;
    padding: 4px 8px;
    gap: 0;
    width: 100%;
    justify-content: space-around;
  }

  .sidebar-menu li {
    margin-bottom: 0;
  }

  .sidebar-menu a {
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    font-size: 10px;
    text-align: center;
    border-left: none;
    border-bottom: 3px solid transparent;
  }

  .sidebar-menu a.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .sidebar-menu .icon {
    font-size: 20px;
  }

  .sidebar-menu .label {
    white-space: nowrap;
  }

  .app-body {
    flex-direction: column-reverse;
  }

  .content {
    padding-bottom: 70px;
  }

  .topnav-email {
    display: none;
  }

  .chat-msg {
    max-width: 85%;
  }

  .login-card {
    padding: 32px 24px;
  }

  .onboarding-choices {
    grid-template-columns: 1fr;
  }
}

/* Mobile menu toggle (hidden on desktop) */
.mobile-toggle {
  display: none;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

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

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