/* ─── GLOBAL ─────────────────────────────────── */
:root {
  --sidebar-width: 240px;
  --brand-color: #6B1F0F;
  --brand-light: #A0330E;
  --accent: #A0330E;
  --accent-hover: #7A2509;
  --sidebar-bg: #3D1205;
  --sidebar-text: #F0D5C0;
  --sidebar-active: #A0330E;
  --bg: #FBF5EF;
  --card-bg: #ffffff;
  --text: #1e293b;
  --muted: #7a6a5a;
  --border: #EAD9CC;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --urgent: #dc2626;
  --high: #d97706;
  --normal: #A0330E;
  --low: #7a6a5a;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); }

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

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  padding: 0;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── SIDEBAR ────────────────────────────────── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 8px;
  color: #E8B86D;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-icon { font-size: 1.5rem; color: #E8B86D; }

.sidebar-hoa-name {
  padding: 4px 20px 20px;
  font-size: 0.72rem;
  color: #F0D5C0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 8px;
}

.sidebar-nav { list-style: none; padding: 8px 0; margin: 0; flex: 1; }

.sidebar-nav .nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-item a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav .nav-item.active a { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-nav .nav-item a i { font-size: 1rem; width: 20px; }

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

.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
  width: 34px; height: 34px;
  background: var(--brand-light);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0;
}
.user-name { color: #fff; font-size: 0.85rem; font-weight: 600; }
.user-role { color: var(--sidebar-text); font-size: 0.72rem; text-transform: capitalize; }
.logout-link { color: var(--sidebar-text); font-size: 0.82rem; text-decoration: none; display: flex; align-items: center; gap: 6px; }
.logout-link:hover { color: #fff; }

/* ─── TOP BAR ────────────────────────────────── */
.top-bar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text); }

/* ─── CONTENT BODY ───────────────────────────── */
.content-body { padding: 28px; flex: 1; }

/* ─── CARDS ──────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ─── STAT CARDS ─────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #2563a8; }
.stat-icon.orange { background: #fff7ed; color: #d97706; }
.stat-icon.red    { background: #fef2f2; color: #dc2626; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }

.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 2px; font-weight: 500; }

/* ─── BADGES / PRIORITY ──────────────────────── */
.badge-priority-urgent { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-priority-high   { background: #fff7ed; color: #d97706; border: 1px solid #fed7aa; }
.badge-priority-normal { background: #eff6ff; color: #2563a8; border: 1px solid #bfdbfe; }
.badge-priority-low    { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

.badge-status-new         { background: #f8fafc; color: #475569; border: 1px solid #cbd5e1; }
.badge-status-in-progress { background: #fff7ed; color: #d97706; border: 1px solid #fed7aa; }
.badge-status-done        { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

/* ─── ANNOUNCEMENT CARDS ─────────────────────── */
.announcement-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: box-shadow 0.15s;
}

.announcement-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.07); }
.announcement-card.pinned { border-left: 4px solid var(--brand-light); }

.announcement-title { font-weight: 700; font-size: 1rem; margin-bottom: 6px; color: var(--text); }
.announcement-body  { color: #475569; font-size: 0.88rem; line-height: 1.6; margin-bottom: 10px; }
.announcement-meta  { font-size: 0.78rem; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }

/* ─── MAINTENANCE TABLE ──────────────────────── */
.maintenance-table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
.maintenance-table th {
  background: #FBF0E8;
  border-bottom: 2px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.maintenance-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.maintenance-table tr:last-child td { border-bottom: none; }
.maintenance-table tr:hover td { background: #FDF5EE; }
.maintenance-table a { color: var(--text); text-decoration: none; font-weight: 600; }
.maintenance-table a:hover { color: var(--accent); }

/* ─── FORMS ──────────────────────────────────── */
.form-label { font-weight: 600; font-size: 0.875rem; color: var(--text); margin-bottom: 4px; }
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  padding: 8px 12px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(160, 51, 14, 0.12);
  outline: none;
}

/* ─── BUTTONS ────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 18px;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-outline-secondary { border-radius: 8px; font-weight: 500; }

/* ─── COMMENT THREAD ─────────────────────────── */
.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-light);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
}
.comment-author { font-weight: 600; font-size: 0.85rem; }
.comment-time   { font-size: 0.75rem; color: var(--muted); margin-left: 8px; }
.comment-body   { font-size: 0.87rem; color: #475569; margin-top: 3px; line-height: 1.5; }

/* ─── DETAIL PAGE ────────────────────────────── */
.detail-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.detail-value { font-size: 0.95rem; font-weight: 500; color: var(--text); }

/* ─── LOGIN PAGE ─────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #3D1205 0%, #A0330E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .logo-icon {
  font-size: 2.8rem;
  color: var(--brand-color);
  display: block;
  margin-bottom: 8px;
}

.login-logo .logo-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brand-color);
  letter-spacing: 0.02em;
}

.login-logo .logo-hoa {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.login-card .form-control {
  padding: 10px 14px;
  font-size: 0.95rem;
}

.login-btn {
  width: 100%;
  padding: 11px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 10px;
  margin-top: 4px;
}

.demo-creds {
  background: #FDF0E8;
  border: 1px solid #E8C4A8;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.8rem;
  color: #6B1F0F;
  margin-top: 20px;
}
.demo-creds strong { display: block; margin-bottom: 4px; color: var(--brand-color); }

/* ─── SECTION HEADING ────────────────────────── */
.section-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
  display: block;
}

/* ─── EMPTY STATE ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; display: block; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; margin: 0; }

/* ─── FILTER ROW ─────────────────────────────── */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filter-row .form-select { min-width: 160px; font-size: 0.85rem; padding: 7px 10px; }
.filter-row .btn { font-size: 0.85rem; padding: 7px 14px; }

/* ─── BOARD MEMBERS ──────────────────────────── */
.board-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
  flex-shrink: 0;
}
.board-name  { font-weight: 700; font-size: 1rem; color: var(--text); }
.board-role  { font-size: 0.8rem; color: var(--accent); font-weight: 600; text-transform: capitalize; margin-bottom: 3px; }
.board-email { font-size: 0.78rem; color: var(--muted); }

/* ─── STICKY TOP BAR (desktop) ───────────────── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ─── SIDEBAR BRAND LINK ─────────────────────── */
.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.sidebar-brand-link:hover { opacity: 0.85; }

/* ─── MOBILE HEADER ──────────────────────────── */
.mobile-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--sidebar-bg);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.mobile-brand {
  color: #E8B86D;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hamburger {
  background: none;
  border: none;
  color: #F0D5C0;
  font-size: 1.6rem;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

/* ─── MOBILE OFFCANVAS SIDEBAR ───────────────── */
.mobile-offcanvas {
  background: var(--sidebar-bg);
  width: 260px !important;
}
.mobile-offcanvas .sidebar-hoa-name { color: #F0D5C0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.mobile-offcanvas .sidebar-nav { flex: unset; }

/* ─── MOBILE LAYOUT FIXES ────────────────────── */
@media (max-width: 767px) {
  .main-content {
    margin-left: 0;
    padding-top: 56px; /* offset for fixed mobile header */
  }

  .top-bar {
    top: 56px; /* stick below mobile header */
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-bar-actions { width: 100%; }
  .top-bar-actions .btn { width: 100%; justify-content: center; }

  .content-body { padding: 14px; }

  /* Tables scroll horizontally on mobile */
  .card .maintenance-table-wrapper,
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 1.6rem; }

  .filter-row { flex-direction: column; }
  .filter-row .form-select { min-width: unset; width: 100%; }

  /* Stack dashboard columns */
  .row.g-4 > .col-lg-5,
  .row.g-4 > .col-lg-7 { width: 100%; }

  .announcement-card { padding: 14px; }
}

/* ─── UTILITIES ──────────────────────────────── */
.text-muted { color: var(--muted) !important; }
.fw-600 { font-weight: 600; }
