/* ================================================================
   Customer Portal CSS — Universal HVAC Solutions
   ================================================================ */
:root {
  --primary: #0A2D6E;
  --accent: #1565C0;
  --orange: #FF6F00;
  --success: #2e7d32;
  --danger: #c62828;
  --purple: #7b1fa2;
  --bg: #f4f6fb;
  --white: #ffffff;
  --border: #e2e8f0;
  --text: #1a2332;
  --text-light: #64748b;
  --gray: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0A2D6E 0%, #1565C0 65%, #1e88e5 100%);
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 22px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .3);
}

.login-logo { text-align: center; margin-bottom: 32px; }

.login-logo-icon {
  width: 70px; height: 70px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(10, 45, 110, .3);
}

.login-brand { font-size: 1.12rem; font-weight: 700; color: var(--primary); }

.login-portal-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent);
  background: #e8f1ff;
  padding: 3px 12px;
  border-radius: 20px;
  margin-top: 8px;
  letter-spacing: .3px;
}

.login-heading { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-sub { font-size: .82rem; color: var(--text-light); margin-bottom: 22px; }

.login-error {
  display: none;
  align-items: center;
  gap: 8px;
  background: #fff5f5;
  border: 1.5px solid #ffcdd2;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 9px;
  font-size: .82rem;
  margin-bottom: 18px;
}
.login-error.show { display: flex; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .8rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: #fafbfd;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, .1);
}

.input-wrap { position: relative; }
.input-wrap .form-control { padding-right: 44px; }
.input-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: .88rem; padding: 4px;
  transition: color .2s;
}
.input-eye:hover { color: var(--accent); }

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: .94rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
  box-shadow: 0 4px 16px rgba(10, 45, 110, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-login:hover { opacity: .9; }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

.login-footer { text-align: center; margin-top: 22px; font-size: .73rem; color: var(--gray); }

/* ============================================================
   PORTAL HEADER
   ============================================================ */
.portal-header {
  background: linear-gradient(90deg, var(--primary) 0%, #1565C0 100%);
  color: #fff;
  padding: 0 26px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .22);
}

.portal-logo-box {
  width: 38px; height: 38px;
  background: rgba(255, 255, 255, .18);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .88rem; flex-shrink: 0; overflow: hidden;
}
.portal-logo-box img { width: 100%; height: 100%; object-fit: contain; }
.portal-co-name { font-size: .93rem; font-weight: 700; line-height: 1.2; }
.portal-co-sub { font-size: .68rem; opacity: .75; }
.portal-spacer { flex: 1; }
.portal-user-grp { display: flex; align-items: center; gap: 10px; }
.portal-avatar {
  width: 36px; height: 36px;
  background: rgba(255, 255, 255, .22);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .82rem; flex-shrink: 0;
}
.portal-uname { font-size: .84rem; font-weight: 500; }
.btn-port-logout {
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .77rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s;
}
.btn-port-logout:hover { background: rgba(255, 255, 255, .28); }

/* ============================================================
   PORTAL BODY
   ============================================================ */
.portal-body {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 22px 52px;
}

.portal-welcome { margin-bottom: 22px; }
.portal-welcome h1 { font-size: 1.35rem; font-weight: 700; color: var(--primary); }
.portal-welcome p { font-size: .82rem; color: var(--text-light); margin-top: 4px; }

/* STATS */
.pstat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.pstat-card {
  background: var(--white);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
}
.pstat-val { font-size: 1.7rem; font-weight: 800; color: var(--primary); }
.pstat-lbl { font-size: .73rem; color: var(--text-light); margin-top: 4px; }

/* TABS */
.p-tab-nav {
  display: flex;
  gap: 4px;
  background: var(--white);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .07);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.p-tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: none;
  font-family: inherit;
  font-size: .83rem; font-weight: 500;
  color: var(--text-light);
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.p-tab-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(10, 45, 110, .18);
}
.p-tab-btn:hover:not(.active) { background: var(--bg); color: var(--text); }
.p-pane { display: none; }
.p-pane.active { display: block; }

/* CARD */
.p-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .07);
  overflow: hidden;
}
.p-card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.p-card-title { font-size: .93rem; font-weight: 700; color: var(--text); }
.p-card-body { padding: 22px; }

/* FILE GRID */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.file-item {
  background: #fafbfd;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 22px 16px 16px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transition: all .2s;
}
.file-item:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(21, 101, 192, .1);
  transform: translateY(-2px);
}
.file-icon {
  width: 58px; height: 58px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
  margin-bottom: 14px; flex-shrink: 0;
}
.fi-pdf  { background: linear-gradient(135deg, #c62828, #ef5350); }
.fi-doc  { background: linear-gradient(135deg, #1565C0, #42a5f5); }
.fi-xls  { background: linear-gradient(135deg, #2e7d32, #66bb6a); }
.fi-img  { background: linear-gradient(135deg, #6a1b9a, #ab47bc); }
.fi-other{ background: linear-gradient(135deg, #37474f, #78909c); }
.file-name { font-size: .86rem; font-weight: 600; color: var(--text); margin-bottom: 4px; word-break: break-word; }
.file-desc { font-size: .74rem; color: var(--text-light); font-style: italic; margin-bottom: 4px; }
.file-meta { font-size: .71rem; color: var(--gray); margin-bottom: 14px; }
.btn-dl {
  width: 100%; padding: 9px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 9px; font-family: inherit; font-size: .81rem; font-weight: 600;
  cursor: pointer; transition: background .2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-dl:hover { background: var(--primary); }
.btn-dl:disabled { background: var(--gray); cursor: not-allowed; }

/* TABLE */
.p-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.p-table th {
  background: #f8fafc; padding: 11px 16px; text-align: left;
  font-size: .73rem; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--border);
}
.p-table td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.p-table tr:last-child td { border-bottom: none; }
.p-table tr:hover td { background: #f8fafc; }
.tbl-scroll { overflow-x: auto; }

/* BADGES */
.pbdg { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: .71rem; font-weight: 600; }
.pbdg-paid     { background: #e8f5e9; color: #2e7d32; }
.pbdg-unpaid   { background: #fff3e0; color: #e65100; }
.pbdg-overdue  { background: #ffebee; color: #c62828; }
.pbdg-draft    { background: #f5f5f5; color: #616161; }
.pbdg-sent     { background: #e3f2fd; color: #1565C0; }
.pbdg-accepted { background: #e8f5e9; color: #2e7d32; }
.pbdg-pending  { background: #fff3e0; color: #e65100; }
.pbdg-cancelled{ background: #f5f5f5; color: #9e9e9e; }

/* PROFILE */
.profile-hero {
  display: flex; align-items: center; gap: 20px;
  padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border);
}
.profile-av {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.6rem; font-weight: 700; flex-shrink: 0;
}
.profile-name { font-size: 1.18rem; font-weight: 700; color: var(--text); }
.profile-co { font-size: .82rem; color: var(--text-light); margin-top: 3px; }
.profile-ag { margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.ag-active { background: #e8f5e9; color: #2e7d32; font-size: .71rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pf-lbl { font-size: .72rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.pf-val { font-size: .88rem; font-weight: 500; color: var(--text); padding: 9px 14px; background: var(--bg); border-radius: 8px; min-height: 38px; word-break: break-word; }

.profile-tip { margin-top: 20px; padding: 14px 18px; background: #f0f4ff; border-radius: 10px; font-size: .77rem; color: var(--text-light); display: flex; align-items: center; gap: 10px; }

/* EMPTY */
.p-empty { text-align: center; padding: 52px 20px; color: var(--text-light); }
.p-empty i { font-size: 2.8rem; opacity: .2; display: block; margin-bottom: 14px; }
.p-empty p { font-size: .85rem; line-height: 1.8; }

/* RESPONSIVE */
@media (max-width: 640px) {
  .login-card { padding: 32px 22px; }
  .portal-header { padding: 0 14px; }
  .portal-body { padding: 16px 12px 40px; }
  .p-tab-btn { font-size: .74rem; padding: 8px 8px; }
  .profile-grid { grid-template-columns: 1fr; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .portal-uname { display: none; }
  .p-card-body { padding: 14px; }
}
