/* LeaseLoop Shared Styles */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

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

:root {
  --ink: #0a0f1a;
  --chalk: #f8f7f4;
  --amber: #e8a624;
  --amber-light: #fdf3d8;
  --amber-dark: #c78b1a;
  --slate: #4a5568;
  --mist: #edeae4;
  --accent: #1a3a2a;
  --red: #dc2626;
  --green: #16a34a;
  --green-light: #dcfce7;
  --red-light: #fef2f2;
  --border: #e2e0da;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--chalk);
  color: var(--ink);
  line-height: 1.6;
}

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

.sidebar {
  width: 260px;
  background: var(--ink);
  color: var(--chalk);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo span { color: var(--amber); }

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: rgba(248,247,244,0.6);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06);
  color: var(--chalk);
}

.sidebar-nav a.active {
  background: rgba(232,166,36,0.12);
  color: var(--amber);
}

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

.sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user-info {
  font-size: 13px;
  color: rgba(248,247,244,0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-name {
  font-weight: 600;
  color: var(--chalk);
  font-size: 14px;
}

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 32px 40px;
  min-height: 100vh;
}

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

.page-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-header p {
  color: var(--slate);
  font-size: 15px;
  margin-top: 4px;
}

/* ─── Cards ─── */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

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

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
}

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

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

.stat-card .label {
  font-size: 13px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-card .value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 32px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--ink);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
}

.btn-primary {
  background: var(--amber);
  color: var(--ink);
}

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

.btn-secondary {
  background: var(--mist);
  color: var(--ink);
}

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

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

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover { background: #b91c1c; }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

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

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

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.form-group .hint {
  font-size: 12px;
  color: var(--slate);
  margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  background: white;
  color: var(--ink);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232,166,36,0.12);
}

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

/* ─── Table ─── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

tr:hover td { background: rgba(237,234,228,0.3); }

/* ─── Badge ─── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: var(--green-light);
  color: var(--green);
}

.badge-closed {
  background: var(--mist);
  color: var(--slate);
}

.badge-amber {
  background: var(--amber-light);
  color: var(--amber-dark);
}

/* ─── Chat ─── */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0;
  max-height: 500px;
  overflow-y: auto;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.chat-bubble.tenant {
  background: var(--mist);
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.ai {
  background: var(--amber-light);
  color: var(--ink);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble.landlord {
  background: var(--accent);
  color: var(--chalk);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble .role {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.chat-bubble .time {
  font-size: 11px;
  opacity: 0.5;
  margin-top: 6px;
}

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

.chat-input input,
.chat-input textarea {
  flex: 1;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,15,26,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  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: 60px 20px;
  color: var(--slate);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--ink);
  color: var(--chalk);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

/* ─── Utility ─── */
.text-slate { color: var(--slate); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .mobile-nav { display: block; }
}

/* ─── Loading ─── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-full {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
