/* Elaf Prime — Client Portal */

.portal-body {
  background: var(--light);
  min-height: 100vh;
  padding-bottom: 0 !important;
}

.portal-header {
  background: var(--white);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 10;
}

.portal-lang {
  width: auto;
  font-weight: 600;
  border-color: var(--border-color);
}

html[dir="rtl"] .portal-lang {
  background-position: left 0.75rem center;
  padding-left: 2.25rem;
  padding-right: 0.75rem;
}

.portal-back {
  align-items: center;
  white-space: nowrap;
}

html[dir="rtl"] .flip-rtl {
  transform: scaleX(-1);
}

/* Demo banner */
.portal-demo {
  background: var(--secondary-light);
  color: #8a4a00;
  border: 1px dashed var(--secondary);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Login */
.portal-login-card {
  max-width: 440px;
  margin: 1rem auto 0;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem 1.5rem;
}

@media (min-width: 576px) {
  .portal-login-card { padding: 2.5rem 2.25rem; }
}

.portal-lock {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

/* password + eye button: keep them joined in right-to-left layout */
#togglePassword {
  border-color: var(--bs-border-color);
  color: var(--text-muted);
  background: var(--white);
}
html[dir="rtl"] #loginForm .input-group > .form-control {
  border-radius: 0 var(--bs-border-radius-lg) var(--bs-border-radius-lg) 0;
}
html[dir="rtl"] #loginForm .input-group > #togglePassword {
  border-radius: var(--bs-border-radius-lg) 0 0 var(--bs-border-radius-lg);
  margin-left: 0;
  margin-right: -1px;
}

.portal-creds-note {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-body);
}

.portal-creds-note > i {
  color: var(--primary);
  margin-top: 0.2rem;
}

.portal-creds-note a {
  color: var(--primary-dark);
  white-space: nowrap;
}

.portal-contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.portal-contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}

.portal-contact-links a:hover {
  border-color: var(--primary);
}

/* Dashboard */
.portal-welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.portal-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0 0 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.portal-section-title i {
  color: var(--primary);
}

.portal-stat {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  border-top: 4px solid var(--dark);
  height: 100%;
}

.portal-stat.is-paid { border-top-color: var(--primary); }
.portal-stat.is-remaining { border-top-color: var(--secondary); }

.portal-stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.portal-stat-value {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark);
  margin-top: 0.25rem;
  word-break: break-word;
}

html[dir="rtl"] .portal-stat-value { text-align: right; }

.portal-stat.is-paid .portal-stat-value { color: var(--primary-dark); }
.portal-stat.is-remaining .portal-stat-value { color: var(--secondary-dark); }

.portal-empty {
  background: var(--white);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

/* Shipment card */
.ship-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
}

.ship-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.ship-title {
  font-weight: 700;
  color: var(--dark);
}

.ship-order {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.ship-status {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.ship-status.st-delivered { background: var(--primary); color: #fff; }
.ship-status.st-other { background: #EEF1F4; color: var(--dark); }

/* Progress steps */
.ship-steps {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.ship-steps li {
  flex: 1;
  position: relative;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: 26px;
  line-height: 1.25;
}

.ship-steps li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid #D5DEE6;
  z-index: 1;
}

.ship-steps li::after {
  content: "";
  position: absolute;
  top: 7px;
  left: -50%;
  width: 100%;
  height: 4px;
  background: #D5DEE6;
}

.ship-steps li:first-child::after { display: none; }

html[dir="rtl"] .ship-steps li::after { left: auto; right: -50%; }

.ship-steps li.done { color: var(--dark); font-weight: 600; }
.ship-steps li.done::before { background: var(--primary); border-color: var(--primary); }
.ship-steps li.done::after { background: var(--primary); }
.ship-steps li.current::before { box-shadow: 0 0 0 4px var(--primary-light); }

.ship-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
  font-size: 0.88rem;
  margin: 0;
}

@media (min-width: 768px) {
  .ship-details { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.ship-details dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.ship-details dd {
  margin: 0;
  color: var(--dark);
  word-break: break-word;
}

html[dir="rtl"] .ship-details dd[dir="ltr"] { text-align: right; }

.ship-notes {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  background: var(--light);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

/* Invoices */
.inv-table {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.inv-table table { margin: 0; }

.inv-table th {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 700;
  background: var(--light-alt);
  white-space: nowrap;
}

.inv-table td { font-size: 0.9rem; vertical-align: middle; }

.inv-num { white-space: nowrap; font-variant-numeric: tabular-nums; }

.inv-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.inv-badge.paid { background: var(--primary-light); color: var(--primary-dark); }
.inv-badge.partial { background: var(--secondary-light); color: #9a5300; }
.inv-badge.unpaid { background: #FDECEC; color: #B42318; }

/* Invoices as cards on small screens */
@media (max-width: 767px) {
  .inv-table thead { display: none; }
  .inv-table tr { display: block; border-bottom: 1px solid var(--border-color); padding: 0.75rem 1rem; }
  .inv-table td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: 0.2rem 0; }
  .inv-table td::before { content: attr(data-label); color: var(--text-muted); font-size: 0.78rem; font-weight: 600; }
}
