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

:root {
  --bg: #0b0f14;
  --surface: #141a23;
  --surface-light: #1c2430;
  --surface-hover: #232d3b;
  --amber: #e6a23c;
  --amber-glow: rgba(230, 162, 60, 0.15);
  --amber-dim: #c4893a;
  --amber-light: rgba(230, 162, 60, 0.1);
  --text: #e8eaed;
  --text-muted: #8b95a5;
  --text-dim: #5a6577;
  --danger: #e74c3c;
  --success: #2ecc71;
  --border: rgba(255,255,255,0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Layout ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  display: block;
}
.sidebar-logo span { color: var(--amber); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--surface-light); color: var(--text); }
.nav-item.active { background: var(--amber-light); color: var(--amber); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-user {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px 40px;
  max-width: 1100px;
}

/* ─── Auth Pages ──────────────────────────────────────────── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 8px;
}
.auth-logo span { color: var(--amber); }

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 36px;
}

/* ─── Forms ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: 'Space Grotesk', sans-serif;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--amber); }
.form-input::placeholder { color: var(--text-dim); }

textarea.form-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--amber);
  color: var(--bg);
}
.btn-primary:hover { background: var(--amber-dim); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-light);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.3);
}
.btn-danger:hover { background: rgba(231, 76, 60, 0.1); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-light); }

.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-full { width: 100%; }

.btn-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ─── Page Header ─────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* ─── Stats Grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--amber);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ─── Property Cards ──────────────────────────────────────── */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.property-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all 0.15s;
}
.property-card:hover { border-color: var(--amber); transform: translateY(-2px); }

.property-card-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.property-card-address {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.property-card-stats {
  display: flex;
  gap: 20px;
}

.property-card-stat {
  font-size: 0.82rem;
  color: var(--text-dim);
}
.property-card-stat strong {
  color: var(--text-muted);
  font-weight: 600;
}

/* ─── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.92rem;
  margin-bottom: 24px;
}

/* ─── Conversation List ───────────────────────────────────── */
.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.conversation-item:hover { border-color: var(--amber); }

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--amber-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
  flex-shrink: 0;
}

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

.conversation-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.conversation-preview {
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ─── Chat Interface ──────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.chat-back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
}
.chat-back:hover { color: var(--text); background: var(--surface-light); }

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

.message {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message-guest {
  background: var(--surface-light);
  border: 1px solid var(--border);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message-ai {
  background: var(--amber-light);
  border: 1px solid rgba(230, 162, 60, 0.15);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message-host {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  font-family: 'Space Grotesk', sans-serif;
}
.message-guest .message-label { color: var(--text-dim); }
.message-ai .message-label { color: var(--amber); }
.message-host .message-label { color: var(--text-muted); }

.message-time {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.chat-input-area {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  resize: none;
  min-height: 48px;
  max-height: 120px;
}
.chat-input:focus { border-color: var(--amber); }
.chat-input::placeholder { color: var(--text-dim); }

.chat-send {
  padding: 12px 24px;
  background: var(--amber);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.chat-send:hover { background: var(--amber-dim); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Property Detail Header ──────────────────────────────── */
.property-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.property-header-info h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.property-header-info .address {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

/* ─── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  font-family: 'Space Grotesk', sans-serif;
}
.tab:hover { color: var(--text-muted); }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ─── Test Message Box ────────────────────────────────────── */
.test-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 16px;
}

.test-box h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.test-box p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.test-response {
  background: var(--surface-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  font-size: 0.92rem;
  line-height: 1.7;
  white-space: pre-wrap;
  border-left: 3px solid var(--amber);
}

/* ─── Alert/Toast ─────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

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

/* ─── Spinner ─────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface-light);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-dots::after {
  content: '';
  animation: dots 1.5s infinite;
}
@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ─── New Conversation Modal ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
}

.modal h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ─── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}
.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--amber); }

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .property-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* ─── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-hover); }
