/* StayPilot App — matches landing page design tokens */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --bg-deep:      #0a0a0f;
  --bg-surface:   #12121a;
  --bg-card:      #1a1a26;
  --bg-card-hover:#222233;
  --fg:           #e8e8f0;
  --fg-muted:     #8888a0;
  --fg-dim:       #55556a;
  --accent:       #6ee7b7;
  --accent-glow:  rgba(110, 231, 183, 0.15);
  --accent-dim:   #3ba578;
  --negative:     #f87171;
  --warning:      #fbbf24;
  --radius:       12px;
  --sidebar-w:    260px;
}

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

html, body { height: 100%; }

body {
  background: var(--bg-deep);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  line-height: 1.2;
}

/* ---- LAYOUT ---- */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- AUTH SCREEN ---- */
.auth-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(110,231,183,0.08) 0%, transparent 60%);
}

.auth-box {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.auth-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 32px;
  letter-spacing: -0.02em;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 36px 32px;
}

.auth-card h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.auth-card .sub {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-toggle {
  margin-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.auth-toggle a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.auth-toggle a:hover { text-decoration: underline; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 20px;
}

.nav-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  padding: 4px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--fg-muted);
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--accent-glow);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 500;
}

.nav-item .icon { font-size: 1rem; width: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-card);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--bg-deep);
  flex-shrink: 0;
}

.user-email {
  font-size: 0.78rem;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s;
}

.btn-logout:hover { color: var(--negative); }

/* ---- MAIN CONTENT ---- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  padding: 20px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.top-bar h1 {
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-deep);
}

.btn-primary:hover {
  background: #85edc4;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid rgba(255,255,255,0.08);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--fg);
}

.btn-ghost {
  background: none;
  color: var(--fg-muted);
  padding: 7px 12px;
}

.btn-ghost:hover { color: var(--fg); background: var(--bg-card); }

.btn-danger {
  background: rgba(248,113,113,0.12);
  color: var(--negative);
  border: 1px solid rgba(248,113,113,0.2);
}

.btn-danger:hover { background: rgba(248,113,113,0.2); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ---- FORMS ---- */
.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

input[type=text], input[type=email], input[type=password],
textarea, select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 80px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238888a0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

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

.error-msg {
  color: var(--negative);
  font-size: 0.82rem;
  margin-top: 6px;
  display: none;
}

.error-msg.visible { display: block; }

/* ---- STATS BAR ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  background: var(--fg-dim);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  padding: 24px 22px;
}

.stat-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ---- CARDS ---- */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ---- PROPERTY CARDS ---- */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.property-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.property-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(110,231,183,0.2);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.property-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--fg);
}

.property-card .prop-addr {
  font-size: 0.82rem;
  color: var(--fg-dim);
  margin-bottom: 16px;
}

.prop-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.prop-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--bg-surface);
  color: var(--fg-muted);
}

.prop-badge.green {
  background: var(--accent-glow);
  color: var(--accent);
}

.add-property-card {
  background: none;
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--fg-dim);
  font-size: 0.9rem;
  transition: all 0.2s;
  min-height: 120px;
}

.add-property-card:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
}

.add-property-card .plus { font-size: 1.8rem; line-height: 1; }

/* ---- CONVERSATION LIST ---- */
.conv-list { display: flex; flex-direction: column; gap: 2px; }

.conv-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.conv-item:hover {
  background: var(--bg-card);
  border-color: rgba(255,255,255,0.05);
}

.conv-item.active {
  background: var(--accent-glow);
  border-color: rgba(110,231,183,0.15);
}

.conv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  border: 1px solid rgba(110,231,183,0.2);
}

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

.conv-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-preview {
  font-size: 0.78rem;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.conv-time {
  font-size: 0.72rem;
  color: var(--fg-dim);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.open { background: var(--accent); }
.status-dot.resolved { background: var(--fg-dim); }
.status-dot.pending { background: var(--warning); }

/* ---- CHAT VIEW ---- */
.chat-layout {
  display: flex;
  height: 100%;
  gap: 0;
}

.chat-list-pane {
  width: 320px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-list-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-list-header h2 { font-size: 1rem; }

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

.chat-main-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-guest-info { display: flex; flex-direction: column; }
.chat-guest-name { font-size: 0.95rem; font-weight: 600; }
.chat-prop-name { font-size: 0.78rem; color: var(--fg-muted); }

.chat-actions { display: flex; gap: 8px; align-items: center; }

.status-badge {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 500;
}

.status-badge.open { background: var(--accent-glow); color: var(--accent); }
.status-badge.resolved { background: rgba(255,255,255,0.06); color: var(--fg-dim); }
.status-badge.pending { background: rgba(251,191,36,0.12); color: var(--warning); }

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-bubble {
  max-width: 72%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-bubble.guest { align-self: flex-start; }
.message-bubble.agent { align-self: flex-end; }
.message-bubble.host { align-self: flex-end; }

.bubble-body {
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.guest .bubble-body {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}

.agent .bubble-body {
  background: rgba(110, 231, 183, 0.12);
  border: 1px solid rgba(110, 231, 183, 0.2);
  color: var(--fg);
  border-bottom-right-radius: 4px;
}

.host .bubble-body {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--fg);
  border-bottom-right-radius: 4px;
}

.bubble-meta {
  font-size: 0.7rem;
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.agent .bubble-meta { align-self: flex-end; }
.guest .bubble-meta { align-self: flex-start; }

.ai-tag {
  font-size: 0.65rem;
  padding: 1px 7px;
  border-radius: 100px;
  background: var(--accent-glow);
  color: var(--accent);
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-wrap {
  flex: 1;
  position: relative;
}

.chat-input-wrap textarea {
  min-height: 44px;
  max-height: 140px;
  padding-right: 12px;
  resize: none;
}

.chat-input-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.ai-hint {
  font-size: 0.75rem;
  color: var(--fg-dim);
}

/* ---- PROPERTY FORM ---- */
.form-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}

.form-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-dim);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* ---- FAQ LIST ---- */
.faq-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.faq-item:last-child { border-bottom: none; }

.faq-content { flex: 1; }
.faq-q { font-size: 0.88rem; font-weight: 500; margin-bottom: 4px; }
.faq-a { font-size: 0.82rem; color: var(--fg-muted); }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-muted);
}

.empty-state .icon { font-size: 2.4rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1rem; margin-bottom: 8px; color: var(--fg); }
.empty-state p { font-size: 0.85rem; margin-bottom: 20px; }

/* ---- LOADING ---- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(110, 231, 183, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: var(--fg-muted);
  font-size: 0.88rem;
}

/* ---- MODAL ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 1.1rem; }

.btn-close {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.btn-close:hover { color: var(--fg); }

/* ---- TOAST ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 0.85rem;
  color: var(--fg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slide-in 0.2s ease;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--negative); }

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

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .chat-list-pane { width: 260px; }
}

@media (max-width: 600px) {
  .chat-list-pane { display: none; }
  .content-area { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
}
