/* ── Tenant Portal Styles ─────────────────────────────────────────────────── */
:root {
  --primary: #2c7be5;
  --primary-dark: #1a68d1;
  --sidebar-width: 220px;
  --topbar-height: 56px;
}

body { background: #f5f6fa; font-family: 'Segoe UI', sans-serif; }

/* ── Auth Screens ──────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2c7be5 0%, #1652b0 100%);
}
.auth-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.auth-card .logo { font-size: 2rem; color: var(--primary); margin-bottom: 12px; }
.auth-link { color: var(--primary); cursor: pointer; text-decoration: underline; }
.auth-link:hover { color: var(--primary-dark); }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.portal-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: #1a2035;
  color: #a8b1c5;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 18px 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand i { color: var(--primary); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-nav .nav-item { list-style: none; }
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  color: #a8b1c5;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  font-size: .9rem;
}
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.sidebar-nav .nav-link.active { color: #fff; border-left-color: var(--primary); background: rgba(44,123,229,.15); }
.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: .95rem; }
.sidebar-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
}

/* ── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e8ecf0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-title { font-weight: 600; font-size: 1.05rem; color: #2d3748; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}
.user-dropdown {
  position: absolute;
  top: 44px; right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
  min-width: 180px;
  z-index: 200;
}
.user-dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  color: #4a5568;
  transition: background .1s;
}
.user-dropdown-item:hover { background: #f7fafc; }
.user-dropdown-item.danger { color: #e53e3e; }

.page-content { padding: 24px; flex: 1; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.portal-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  margin-bottom: 20px;
}
.portal-card .card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f5;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border-radius: 10px 10px 0 0;
}
.portal-card .card-header i { color: var(--primary); margin-right: 8px; }
.portal-card .card-body { padding: 20px; }

/* ── Balance Banner ────────────────────────────────────────────────────────── */
.balance-banner {
  background: linear-gradient(135deg, #2c7be5, #1652b0);
  border-radius: 10px;
  color: #fff;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.balance-banner .bal-label { font-size: .85rem; opacity: .85; }
.balance-banner .bal-amount { font-size: 2rem; font-weight: 700; }
.balance-banner .bal-credit { color: #68d391; }

/* ── Statement Table ───────────────────────────────────────────────────────── */
.statement-table th { font-size: .82rem; text-transform: uppercase; color: #718096; font-weight: 600; border-top: none; }
.statement-table td { font-size: .88rem; vertical-align: middle; }
.charge-amt { color: #e53e3e; font-weight: 600; }
.credit-amt { color: #38a169; font-weight: 600; }
.balance-positive { color: #e53e3e; }
.balance-negative { color: #38a169; }

/* ── Work Orders ───────────────────────────────────────────────────────────── */
.wo-badge { font-size: .72rem; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.wo-badge-open { background: #fff5f5; color: #c53030; }
.wo-badge-progress { background: #ebf8ff; color: #2b6cb0; }
.wo-badge-closed { background: #f0fff4; color: #276749; }
.wo-card { border: 1px solid #e8ecf0; border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.wo-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.wo-date { font-size: .78rem; color: #718096; }
.wo-desc { font-size: .9rem; margin: 6px 0; }
.wo-comment { font-size: .82rem; color: #4a5568; background: #f7fafc; padding: 8px 12px; border-radius: 6px; margin-top: 8px; }

/* ── Payment ───────────────────────────────────────────────────────────────── */
.payment-method-btn {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all .15s;
}
.payment-method-btn:hover { border-color: var(--primary); }
.payment-method-btn.selected { border-color: var(--primary); background: #ebf5fb; }
.payment-method-btn i { font-size: 1.4rem; color: var(--primary); width: 24px; text-align: center; }
.fee-note { font-size: .78rem; color: #718096; }

/* ── Documents ─────────────────────────────────────────────────────────────── */
.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f0f2f5;
}
.doc-item:last-child { border-bottom: none; }
.doc-name { font-size: .88rem; }
.doc-type { font-size: .75rem; color: #718096; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.portal-alert {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: .88rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.portal-alert-error { background: #fff5f5; color: #c53030; border: 1px solid #feb2b2; }
.portal-alert-success { background: #f0fff4; color: #276749; border: 1px solid #9ae6b4; }
.portal-alert-info { background: #ebf8ff; color: #2b6cb0; border: 1px solid #90cdf4; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-label { font-size: .83rem; font-weight: 600; color: #4a5568; margin-bottom: 4px; }
.portal-btn {
  border-radius: 6px;
  font-weight: 600;
  font-size: .88rem;
  padding: 8px 20px;
}
.portal-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.portal-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.portal-btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.portal-btn-outline:hover { background: var(--primary); color: #fff; }

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.portal-spinner { display: flex; align-items: center; justify-content: center; padding: 40px; color: #718096; gap: 12px; }

/* ── Insurance iframe ──────────────────────────────────────────────────────── */
.insurance-iframe { width: 100%; height: 600px; border: none; border-radius: 8px; }

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .balance-banner .bal-amount { font-size: 1.5rem; }
}
