/* =============================================================
   UFE Client Portal — Shared Stylesheet
   Brand: Navy #0f4c81 | Font: Inter
   ============================================================= */

/* ── Reset + Base ──────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1a2332;
  background-color: #f5f7fa;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #0f4c81;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Portal Nav ────────────────────────────────────────────── */
.portal-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #0f4c81;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.portal-nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  min-width: 0;
}

.portal-nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  background-color: #ffffff;
  border-radius: 6px;
  padding: 4px 8px;
  line-height: 0;
}

.portal-nav-logo img {
  height: 32px;
  width: auto;
  display: block;
  filter: none;
  background: transparent;
}

.portal-nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.portal-nav-links::-webkit-scrollbar {
  display: none;
}

.portal-nav-links a {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.80);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.portal-nav-links a:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-decoration: none;
}

.portal-nav-links a.active {
  background-color: #fff;
  color: #0f4c81;
  font-weight: 600;
}

.portal-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: 16px;
}

.portal-nav-client {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.70);
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Portal Content ────────────────────────────────────────── */
.portal-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

/* ── Page Titles ───────────────────────────────────────────── */
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f2d4f;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: #6b7a8d;
  margin-bottom: 24px;
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e3e8ef;
  background: #fafbfc;
}

.card-header h2,
.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #0f2d4f;
}

.card-body {
  padding: 18px;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  flex: 1;
  min-width: 160px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
  user-select: none;
}

.stat-card:hover {
  box-shadow: 0 4px 16px rgba(15, 76, 129, 0.12);
  border-color: #0f4c81;
  transform: translateY(-1px);
}

.stat-card.active,
.stat-card[data-active="true"] {
  border-color: #0f4c81;
  background: #eef4fb;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8896a7;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #0f4c81;
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 11px;
  color: #9aa5b4;
}

/* ── Attention Box ─────────────────────────────────────────── */
.attention-box {
  background: #fff3e0;
  border: 1px solid #ffb74d;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.attention-box-header {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #e65100;
  margin-bottom: 10px;
}

.attention-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.attention-item {
  background: #fff;
  border: 1px solid #ffcc80;
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 160px;
  flex: 1;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.attention-item:hover {
  box-shadow: 0 2px 8px rgba(230, 81, 0, 0.12);
}

.attention-item-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #bf360c;
  margin-bottom: 4px;
}

.attention-item-value {
  font-size: 20px;
  font-weight: 700;
  color: #e65100;
}

/* ── Portal Table ──────────────────────────────────────────── */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.portal-table thead th {
  background: #0f4c81;
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  white-space: nowrap;
}

.portal-table thead th:first-child {
  border-radius: 0;
}

.portal-table thead th:last-child {
  border-radius: 0;
}

.portal-table tbody tr {
  border-bottom: 1px solid #e9ecf0;
  transition: background 0.1s;
}

.portal-table tbody tr:last-child {
  border-bottom: none;
}

.portal-table tbody tr:hover {
  background: #f0f5fb;
}

.portal-table tbody td {
  padding: 10px 14px;
  color: #2d3a4a;
  vertical-align: middle;
}

.portal-table tbody td a {
  color: #0f4c81;
  font-weight: 500;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-green {
  background: #e6f4ea;
  color: #1b7e34;
}

.badge-blue {
  background: #e3f0fb;
  color: #0f4c81;
}

.badge-orange {
  background: #fff3e0;
  color: #c75800;
}

.badge-red {
  background: #fdecea;
  color: #c0392b;
}

.badge-gray {
  background: #f0f2f5;
  color: #6b7a8d;
}

.badge-purple {
  background: #f0eafb;
  color: #6a3db3;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
  line-height: 1;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.90;
}

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

.btn-primary {
  background: #0f4c81;
  color: #fff;
}

.btn-primary:hover {
  background: #0d4070;
  opacity: 1;
}

.btn-danger {
  background: #c0392b;
  color: #fff;
}

.btn-danger:hover {
  background: #a53125;
  opacity: 1;
}

.btn-outline {
  background: transparent;
  color: #0f4c81;
  border: 1.5px solid #0f4c81;
}

.btn-outline:hover {
  background: #eef4fb;
  opacity: 1;
}

.btn-success {
  background: #1b7e34;
  color: #fff;
}

.btn-success:hover {
  background: #166929;
  opacity: 1;
}

/* Nav buttons — used inside .portal-nav-right */
.btn-nav {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  opacity: 1;
  text-decoration: none;
}

.btn-nav-danger {
  background: rgba(192, 57, 43, 0.80);
  color: #fff;
  border: 1px solid rgba(192, 57, 43, 0.60);
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-nav-danger:hover {
  background: rgba(165, 49, 37, 0.90);
  opacity: 1;
  text-decoration: none;
}

/* Small button variant */
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

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

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #1a2332;
  background: #fff;
  border: 1.5px solid #d1d9e0;
  border-radius: 7px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #0f4c81;
  box-shadow: 0 0 0 3px rgba(15, 76, 129, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #a0aab4;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a8d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

.form-hint {
  font-size: 11px;
  color: #8896a7;
  margin-top: 4px;
}

.form-error {
  font-size: 11px;
  color: #c0392b;
  margin-top: 4px;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #8896a7;
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 13px;
  max-width: 340px;
  margin: 0 auto 16px;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 40px 24px;
  color: #8896a7;
  font-size: 13px;
}

.loading::before {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  border: 3px solid #e3e8ef;
  border-top-color: #0f4c81;
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.7s linear infinite;
}

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

/* ── Section Spacing ───────────────────────────────────────── */
.section-gap {
  margin-bottom: 28px;
}

/* ── Utility ───────────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: #8896a7; }
.text-navy { color: #0f4c81; }
.font-mono {
  font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
  font-size: 12px;
}

.flex-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid #e3e8ef;
  margin: 16px 0;
}

/* ── Alert / Notice ────────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-info {
  background: #e3f0fb;
  border-color: #90c2f0;
  color: #0c3d69;
}

.alert-warning {
  background: #fff3e0;
  border-color: #ffb74d;
  color: #7a3800;
}

.alert-error {
  background: #fdecea;
  border-color: #f1a69a;
  color: #7b1c14;
}

.alert-success {
  background: #e6f4ea;
  border-color: #81c995;
  color: #0e4a1f;
}

/* Mobile menu toggle — hidden on desktop */
.portal-nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid #e3e8ef;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 18px;
  color: #0f4c81;
  line-height: 1;
}

/* Mobile-only nav entries hidden on desktop */
.portal-nav-links a.mobile-only {
  display: none;
}

/* ── Facility tabs (multi-facility clients) ─────────────────── */
.facility-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  background: #f4f6f9;
  border-radius: 10px;
}

.facility-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.facility-tab:hover {
  background: #e3e8ef;
  color: #0f2d4f;
}

.facility-tab.active {
  background: #0f4c81;
  color: #fff;
}

.facility-tab.active .facility-tab-count {
  background: rgba(255, 255, 255, 0.22);
}

.facility-tab-count {
  background: #d1d9e0;
  color: #4a5568;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.facility-tab.active .facility-tab-count {
  color: #fff;
}

/* ── Mobile Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .portal-nav-toggle {
    display: inline-block;
  }

  .portal-nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    border-top: 1px solid #e3e8ef;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
    padding: 8px 0;
    z-index: 50;
  }

  .portal-nav-links.open {
    display: flex;
  }

  .portal-nav-links a {
    padding: 12px 20px;
    border-radius: 0;
  }

  .portal-nav-links a.mobile-only {
    display: block;
  }

  .portal-nav {
    position: relative;
  }

  .portal-nav-client {
    display: none;
  }

  .portal-nav-right {
    margin-left: auto;
  }

  .portal-nav-right .btn-nav {
    display: none;
  }

  .portal-nav-right .btn-nav-danger {
    /* Keep logout visible on mobile — issue/service requests live in nav menu */
  }

  .portal-content {
    padding: 16px 14px 40px;
  }

  .stat-cards {
    flex-direction: column;
    gap: 10px;
  }

  .stat-card {
    min-width: unset;
  }

  .stat-value {
    font-size: 22px;
  }

  .attention-items {
    flex-direction: column;
  }

  .attention-item {
    min-width: unset;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .portal-table {
    font-size: 12px;
  }

  .portal-table thead th,
  .portal-table tbody td {
    padding: 8px 10px;
  }

  .page-title {
    font-size: 18px;
  }

  .btn-nav,
  .btn-nav-danger {
    font-size: 11px;
    padding: 5px 9px;
  }
}

@media (max-width: 480px) {
  .portal-table thead {
    display: none;
  }

  .portal-table tbody tr {
    display: block;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 8px 0;
  }

  .portal-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 12px;
  }

  .portal-table tbody td:last-child {
    border-bottom: none;
  }

  .portal-table tbody td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7a8d;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    margin-right: 8px;
  }
}
