/* NeighborOps — HOA Violation Tracker */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f1117;
  --bg-elevated: #181b24;
  --bg-card: #1e2230;
  --bg-input: #252937;
  --text: #e8eaed;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #f59e0b;
  --accent-dim: rgba(245, 158, 11, 0.12);
  --accent-hover: #d97706;
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59, 130, 246, 0.12);
  --purple: #8b5cf6;
  --purple-dim: rgba(139, 92, 246, 0.12);
  --border: rgba(255, 255, 255, 0.07);
  --border-light: rgba(255, 255, 255, 0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

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

h1, h2, h3 { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

.sidebar {
  width: 260px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 1.6rem;
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

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

.sidebar-nav { flex: 1; padding: 0.5rem 0.75rem; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-user {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-logout:hover { color: var(--red); background: var(--red-dim); }

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

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

.page-header h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.page-header-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  font-family: 'General Sans', sans-serif;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: 'General Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #0f1117;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); }

.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-success { background: var(--green-dim); color: var(--green); }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* ===== STAT CARDS ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.stat-card-value {
  font-family: 'Instrument Serif', serif;
  font-size: 2rem;
  line-height: 1;
}

.stat-card-value.amber { color: var(--accent); }
.stat-card-value.green { color: var(--green); }
.stat-card-value.red { color: var(--red); }
.stat-card-value.blue { color: var(--blue); }

/* ===== TABLES ===== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.table-header h3 {
  font-size: 1.1rem;
}

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

th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-family: 'General Sans', sans-serif;
}

td {
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(255,255,255,0.02); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-open { background: var(--blue-dim); color: var(--blue); }
.badge-first_warning { background: var(--accent-dim); color: var(--accent); }
.badge-second_warning { background: rgba(249, 115, 22, 0.12); color: #f97316; }
.badge-fine_notice { background: var(--red-dim); color: var(--red); }
.badge-resolved { background: var(--green-dim); color: var(--green); }
.badge-appealed { background: var(--purple-dim); color: var(--purple); }
.badge-pending { background: var(--accent-dim); color: var(--accent); }
.badge-approved { background: var(--green-dim); color: var(--green); }
.badge-denied { background: var(--red-dim); color: var(--red); }

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'General Sans', sans-serif;
  font-size: 0.875rem;
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.form-select { appearance: none; cursor: pointer; }
.form-textarea { min-height: 100px; resize: vertical; }

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

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  max-width: 640px;
}

.form-card h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-chip {
  padding: 0.4rem 0.85rem;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filter-chip:hover { border-color: var(--border-light); color: var(--text); }
.filter-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* ===== VIOLATION DETAIL ===== */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-card h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.detail-row .label { color: var(--text-muted); }

.detail-photo {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  border: 1px solid var(--border);
}

.timeline-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

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

.timeline-item .timeline-type {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.timeline-item .timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-item .timeline-content {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  white-space: pre-wrap;
  line-height: 1.5;
  max-height: 200px;
  overflow-y: auto;
}

/* ===== APPEAL CARDS ===== */
.appeal-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.appeal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.appeal-message {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.appeal-response {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== AUTH PAGES ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #0f1117 0%, #1a1d2e 50%, #0f1117 100%);
}

.auth-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-card .logo {
  font-family: 'Instrument Serif', serif;
  font-size: 2rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-card .logo span { color: var(--accent); }

.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.auth-card h2 {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
}

.auth-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 1.5rem 0;
}

.auth-switch {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-error {
  background: var(--red-dim);
  color: var(--red);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* ===== RESIDENT PORTAL ===== */
.resident-page {
  min-height: 100vh;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.resident-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.resident-header .logo {
  font-family: 'Instrument Serif', serif;
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.resident-header .logo span { color: var(--accent); }

.resident-address {
  font-size: 1rem;
  color: var(--text-secondary);
}

.resident-violation {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.resident-violation h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.resident-violation .detail-row { padding: 0.35rem 0; }

.resident-notice {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.875rem;
}

.resident-notice h4 {
  font-size: 0.85rem;
  font-family: 'General Sans', sans-serif;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: capitalize;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  stroke: var(--text-muted);
  fill: none;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

/* ===== LOADING ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

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

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  max-width: 360px;
}

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: 1.25rem;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
  }
  .mobile-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    z-index: 50;
    justify-content: space-around;
    padding: 0.5rem 0;
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
  }
  .mobile-nav-item.active { color: var(--accent); }
  .mobile-nav-item svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
}

.mobile-nav { display: none; }

/* ===== FILE INPUT ===== */
.file-upload {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
}

.file-upload:hover { border-color: var(--accent); }
.file-upload.has-file { border-color: var(--green); background: var(--green-dim); }
.file-upload input { display: none; }

.file-upload-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ===== UTILITY ===== */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.clickable { cursor: pointer; }
.clickable:hover { color: var(--accent); }
