/* CoastClerk App Styles - Matches landing page design system */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

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

:root {
  --navy: #0B1D3A;
  --deep: #061224;
  --teal: #1A8A7D;
  --teal-light: #22B8A6;
  --sand: #F5EDE3;
  --coral: #E8654A;
  --slate: #4A5A6A;
  --soft: #FAFAF8;
  --glass: rgba(255,255,255,0.04);
  --border: rgba(255,255,255,0.08);
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.6);
  --text-muted: rgba(255,255,255,0.35);
  --surface: rgba(255,255,255,0.03);
  --surface-hover: rgba(255,255,255,0.06);
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  background: var(--deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: rgba(11,29,58,0.6);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--teal-light);
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(26,138,125,0.15);
  color: var(--teal-light);
}

.nav-item .icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--coral);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

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

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

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

.auth-card h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

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

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

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--teal);
}

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

textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}

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

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

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

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

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

.btn-full {
  width: 100%;
}

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

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-header h1 {
  font-family: 'Syne', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

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

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--teal-light);
}

.stat-card .stat-value.coral { color: var(--coral); }
.stat-card .stat-value.white { color: #fff; }

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

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

.conversation-item:hover {
  background: var(--surface-hover);
  border-color: rgba(26,138,125,0.2);
}

.conversation-item.has-draft {
  border-left: 3px solid var(--coral);
}

.conv-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(26,138,125,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--teal-light);
  font-size: 1rem;
  flex-shrink: 0;
}

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

.conv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

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

.conv-property {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--glass);
  padding: 2px 8px;
  border-radius: 4px;
}

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

.conv-meta {
  text-align: right;
  flex-shrink: 0;
}

.conv-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.conv-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.conv-badge.draft {
  background: rgba(232,101,74,0.15);
  color: var(--coral);
}

.conv-badge.ai {
  background: rgba(26,138,125,0.15);
  color: var(--teal-light);
}

/* ===== CHAT VIEW ===== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
}

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

.chat-back {
  font-size: 1.2rem;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  padding: 4px 8px;
}

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

.message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  position: relative;
}

.message-bubble.guest {
  align-self: flex-start;
  background: rgba(255,255,255,0.08);
  border-bottom-left-radius: 4px;
}

.message-bubble.host {
  align-self: flex-end;
  background: rgba(26,138,125,0.2);
  border-bottom-right-radius: 4px;
}

.message-bubble.ai-draft {
  align-self: flex-end;
  background: rgba(232,101,74,0.12);
  border: 1px dashed rgba(232,101,74,0.3);
  border-bottom-right-radius: 4px;
}

.message-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-meta .ai-tag {
  background: rgba(26,138,125,0.15);
  color: var(--teal-light);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.message-meta .draft-tag {
  background: rgba(232,101,74,0.15);
  color: var(--coral);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.draft-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

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

.chat-input-area .form-input {
  flex: 1;
}

/* ===== 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: 12px;
  padding: 24px;
  transition: all 0.2s;
  cursor: pointer;
}

.property-card:hover {
  border-color: rgba(26,138,125,0.3);
  transform: translateY(-1px);
}

.property-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

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

.property-card .prop-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.property-card .prop-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.property-card .prop-platform {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 12px;
}

.prop-platform.airbnb { background: rgba(255,88,93,0.15); color: #FF585D; }
.prop-platform.vrbo { background: rgba(0,86,210,0.15); color: #5BA9FF; }
.prop-platform.direct { background: rgba(255,255,255,0.08); color: var(--text-secondary); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal {
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

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

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

.empty-state h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

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

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 0.9rem;
  z-index: 2000;
  animation: slideUp 0.3s ease;
  max-width: 400px;
}

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

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

/* ===== LOADING ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--teal-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .property-grid {
    grid-template-columns: 1fr;
  }
  .message-bubble {
    max-width: 90%;
  }
}

/* ===== LINK STYLES ===== */
a {
  color: var(--teal-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== TAG / BADGE ===== */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tag-teal { background: rgba(26,138,125,0.15); color: var(--teal-light); }
.tag-coral { background: rgba(232,101,74,0.15); color: var(--coral); }
.tag-slate { background: rgba(255,255,255,0.08); color: var(--text-secondary); }
