:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
}

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

/* Layout */
.app-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
  gap: 8px;
}
.app-header .logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.app-header .logo:hover { color: var(--primary-dark); text-decoration: none; }
.app-header .logo img { height: 32px; }
.app-header nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.app-header nav a {
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.app-header nav a:hover { background: var(--gray-100); text-decoration: none; }
.app-header nav a.active { color: var(--primary); background: var(--primary-light); }

.container { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.container-wide { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* Login Page */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}
.login-card {
  background: white;
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-card h1 {
  font-size: 24px;
  margin-bottom: 4px;
  text-align: center;
}
.login-card .subtitle {
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 32px;
  font-size: 14px;
}
.login-card .logo-icon {
  text-align: center;
  font-size: 48px;
  margin-bottom: 16px;
}

/* Forms */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--gray-700);
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group textarea { resize: vertical; min-height: 100px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-300); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* Cards */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

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

/* Table */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
}
th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tr:hover { background: var(--gray-50); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active { background: var(--success-light); color: var(--success); }
.badge-inactive { background: var(--danger-light); color: var(--danger); }
.badge-admin { background: var(--warning-light); color: #92400e; }
.badge-published { background: var(--success-light); color: var(--success); }
.badge-draft { background: var(--gray-200); color: var(--gray-500); }
.badge-category {
  background: var(--primary-light);
  color: var(--primary-dark);
  text-transform: capitalize;
}

/* Toast / Alert */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow-md);
}
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Article Content */
.article-body { line-height: 1.8; }
.article-body h1, .article-body h2, .article-body h3 { margin: 24px 0 12px; }
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol { margin: 0 0 16px 24px; }
.article-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  margin: 16px 0;
  background: var(--gray-50);
}
.article-body img { max-width: 100%; border-radius: var(--radius); }

/* Category Cards (Dashboard) */
.category-section { margin-bottom: 32px; }
.category-section h2 {
  font-size: 18px;
  margin-bottom: 12px;
  text-transform: capitalize;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.article-list { display: grid; gap: 12px; }
.article-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: box-shadow 0.2s;
  cursor: pointer;
}
.article-card:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.article-card h3 { font-size: 15px; margin-bottom: 2px; color: var(--gray-900); }
.article-card .meta { font-size: 12px; color: var(--gray-500); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: white;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal h2 { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-name { font-size: 14px; color: var(--gray-700); }
.btn-logout {
  background: none;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
}
.btn-logout:hover { background: var(--gray-100); }

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

.loading-center {
  display: flex;
  justify-content: center;
  padding: 48px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--gray-500);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* Step Cards (Dashboard) */
.steps-container { display: grid; gap: 24px; }
.step-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}
.step-card:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.step-card-done { border-color: var(--success); background: #f0fdf4; }
.step-badge-done { background: var(--success); }
.step-number-badge {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}
.step-content { flex: 1; }
.step-content h2 { font-size: 17px; margin-bottom: 2px; color: var(--gray-900); }
.step-content p { color: var(--gray-500); margin: 0; font-size: 14px; }

/* FB Rules Banner */
.fb-rules-banner {
  background: var(--warning-light);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 28px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.fb-rules-banner .fb-rules-icon { font-size: 28px; flex-shrink: 0; }
.fb-rules-banner strong { font-size: 16px; display: block; margin-bottom: 6px; color: #92400e; }
.fb-rules-banner p { font-size: 14px; color: #78350f; margin: 0; line-height: 1.6; }

/* Tip Number */
.tip-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

/* Message Board */
.board-list { display: grid; gap: 8px; }
.board-post-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}
.board-post-card:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.board-post-main { flex: 1; min-width: 0; }
.board-post-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.board-post-preview { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-post-meta { font-size: 12px; color: var(--gray-500); }
.board-pin, .board-lock { font-size: 14px; }
.board-post-replies {
  flex-shrink: 0;
  text-align: center;
  min-width: 50px;
}
.board-reply-count { display: block; font-size: 20px; font-weight: 700; color: var(--primary); }
.board-reply-label { font-size: 11px; color: var(--gray-500); }

/* Thread View */
.thread-post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.thread-post-header h1 { font-size: 22px; margin: 0; }
.thread-post-body { font-size: 15px; line-height: 1.7; color: var(--gray-700); }
.thread-post-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-500);
  flex-wrap: wrap;
}
.thread-author { font-weight: 600; color: var(--gray-700); }
.thread-actions { margin-left: auto; display: flex; gap: 8px; }
.thread-replies-header { margin: 24px 0 12px; }
.thread-replies-header h2 { font-size: 16px; color: var(--gray-700); }
.thread-replies { display: grid; gap: 8px; margin-bottom: 20px; }
.thread-reply { padding: 16px 20px; }
.thread-reply-box { margin-top: 8px; }
.thread-locked-notice {
  text-align: center;
  padding: 20px;
  color: var(--gray-500);
  font-size: 14px;
  margin-top: 12px;
}

/* Facebook Groups */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 16px;
}
.group-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.group-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.group-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}
.group-card-body {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.group-card-body h3 { font-size: 16px; color: var(--gray-900); margin: 0; }

.groups-all-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.group-tile {
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 10px;
  transition: transform 0.2s;
}
.group-tile img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius);
}
.group-tile-active { cursor: pointer; }
.group-tile-active:hover { transform: translateY(-2px); text-decoration: none; }
.group-tile-soon { opacity: 0.6; }

/* Onboarding */
.ob-progress {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  margin-bottom: 8px;
  overflow: hidden;
}
.ob-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4f8ff7);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.ob-page-indicator {
  text-align: center;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 20px;
  font-weight: 500;
}
.ob-card { padding: 32px; }
.ob-card h1 { font-size: 26px; margin-bottom: 8px; color: var(--gray-900); }
.ob-card h2 { font-size: 20px; margin: 28px 0 12px; color: var(--gray-900); }
.ob-card h3 { font-size: 16px; margin: 16px 0 8px; color: var(--gray-700); }
.ob-card p { font-size: 15px; line-height: 1.7; color: var(--gray-700); margin-bottom: 12px; }
.ob-card ul, .ob-card ol { margin: 8px 0 16px 24px; font-size: 15px; line-height: 1.8; color: var(--gray-700); }
.ob-card li { margin-bottom: 4px; }

.ob-welcome {
  text-align: center;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 24px;
}
.ob-welcome-icon { font-size: 56px; margin-bottom: 8px; }
.ob-welcome h2 { font-size: 24px; margin: 0 0 12px; }
.ob-welcome p { max-width: 560px; margin: 0 auto 12px; }

.ob-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}
.ob-section:last-of-type { border-bottom: none; }

.ob-step {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
}

.ob-warning {
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 14px;
  color: #991b1b;
}

.ob-donts { list-style: none; margin-left: 0 !important; padding: 0; }
.ob-donts li {
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius);
  background: var(--danger-light);
  color: #991b1b;
  font-size: 14px;
}
.ob-donts li::before { content: "\\2718  "; font-weight: 700; }

.ob-example {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
  font-size: 14px;
  font-style: italic;
  line-height: 1.7;
}
.ob-example p { margin: 0; color: inherit; font-size: inherit; }
.ob-example-label { font-style: normal; font-weight: 700; margin-bottom: 6px; font-size: 13px; }
.ob-example-good { background: var(--success-light); color: #14532d; border-left: 4px solid var(--success); }
.ob-example-bad { background: var(--danger-light); color: #7f1d1d; border-left: 4px solid var(--danger); }

.ob-tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.ob-tip-item {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--primary-dark);
  line-height: 1.5;
}

.ob-week {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
}
.ob-week h3 { margin-top: 0; }

.ob-rules { display: grid; gap: 8px; margin-top: 12px; }
.ob-rule {
  background: var(--warning-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  color: #78350f;
  line-height: 1.5;
}

.ob-agreement {
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
}
.ob-agreement h3 { margin-top: 0; color: var(--gray-900); }
.ob-agreement ul { margin-bottom: 0; }

.ob-agree {
  margin: 24px 0 16px;
  padding: 16px 20px;
  background: var(--primary-light);
  border-radius: var(--radius);
  border: 1px solid #93c5fd;
}
.ob-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 15px;
  color: var(--gray-900);
  line-height: 1.5;
}
.ob-checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.ob-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .ob-card { padding: 20px 16px; }
  .ob-tips-grid { grid-template-columns: 1fr; }
  .ob-actions { flex-direction: column; }
  .ob-actions .btn { width: 100%; }
}

/* Post Helper */
.post-helper-metro-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--primary-light); border: 1px solid var(--primary);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 24px;
}
.post-section-title {
  font-size: 16px; color: var(--gray-700); margin: 24px 0 12px; font-weight: 600;
}
.post-pets-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px;
}
.post-pet-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 16px; position: relative; box-shadow: var(--shadow);
}
.post-pet-card-posted {
  opacity: 0.6; border-color: var(--gray-100);
}
.post-pet-posted-badge {
  position: absolute; top: 8px; right: 8px; font-size: 12px; color: var(--success);
  background: var(--success-light); padding: 2px 8px; border-radius: 12px; font-weight: 600;
}
.post-pet-card-top {
  display: flex; gap: 12px; margin-bottom: 12px;
}
.post-pet-photo {
  width: 80px; height: 80px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.post-pet-photo-placeholder {
  width: 80px; height: 80px; border-radius: 8px; background: var(--gray-100);
  display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0;
}
.post-pet-info h3 {
  margin: 0 0 4px; font-size: 16px; color: var(--gray-900);
}
.post-pet-info p {
  margin: 0; font-size: 13px; color: var(--gray-500); line-height: 1.4;
}
.post-pet-card-details {
  font-size: 13px; color: var(--gray-700); margin-bottom: 12px;
}
.post-pet-card-details p { margin: 2px 0; }
.post-pet-card-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}

@media (max-width: 600px) {
  .post-pets-grid { grid-template-columns: 1fr; }
  .post-helper-metro-bar { flex-direction: column; gap: 8px; }
}

/* Responsive */
@media (max-width: 768px) {
  .app-header { padding: 8px 12px; }
  .app-header .logo { font-size: 15px; }
  .app-header nav { gap: 4px; }
  .app-header nav a { font-size: 12px; padding: 5px 8px; }
  .user-name { font-size: 12px; }
  .btn-logout { font-size: 12px; padding: 4px 10px; }
  .container, .container-wide { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .modal { margin: 16px; }
  th, td { padding: 8px 12px; }
}
