/* ============================================================
   Royal Material theme — Admin & Driver portals
   Deep indigo + gold, Material elevation tiers, ripple feedback
   ============================================================ */

.portal-body { margin: 0; font-family: var(--font-body); background: #F3F1EA; color: var(--ink); }

/* ---------- Auth screens (admin & driver login) ---------- */
.portal-auth-body {
  margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 15% 20%, rgba(212,175,55,0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(212,175,55,0.12) 0%, transparent 45%),
    linear-gradient(160deg, var(--royal-indigo) 0%, var(--royal-indigo-dark) 100%);
  padding: 24px;
}
.portal-auth-card {
  background: #fff; border-radius: 24px; padding: 40px 32px; max-width: 380px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  text-align: center;
  border-top: 4px solid var(--gold-light);
  animation: auth-card-in .5s cubic-bezier(.34,1.56,.64,1);
}
@keyframes auth-card-in { 0% { opacity: 0; transform: translateY(24px); } 100% { opacity: 1; transform: translateY(0); } }
.portal-auth-crown { font-size: 44px; margin-bottom: 6px; }
.portal-auth-logo { width: 88px; height: 88px; object-fit: contain; margin-bottom: 6px; }
.portal-auth-title { font-family: var(--font-royal); font-weight: 700; font-size: 21px; color: var(--royal-indigo); }
.portal-auth-sub { font-size: 13px; color: var(--ink-soft); margin: 4px 0 24px; }
.portal-auth-card form { text-align: left; }
.portal-auth-hint { margin-top: 18px; font-size: 11.5px; color: var(--ink-soft); background: var(--gray-bg); padding: 8px 12px; border-radius: var(--radius-xs); }

.portal-gold-btn {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%) !important;
  color: #2A1E00 !important;
  box-shadow: 0 4px 14px rgba(184,134,11,0.35);
  position: relative; overflow: hidden;
}
.portal-gold-btn:active { transform: scale(0.98); }
.portal-gold-btn:disabled { opacity: .55; box-shadow: none; cursor: not-allowed; }

/* ---------- Avatars ---------- */
.portal-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #2A1E00; font-family: var(--font-display); font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.portal-avatar-topbar { display: none; }

/* ---------- Admin shell: sidebar + content ---------- */
.portal-shell { display: flex; min-height: 100vh; }
.portal-sidebar {
  width: 240px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--royal-indigo) 0%, var(--royal-indigo-dark) 100%);
  color: #fff; display: flex; flex-direction: column; padding: 22px 16px;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.portal-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 22px; border-bottom: 1px solid rgba(255,255,255,0.12); margin-bottom: 18px; }
.portal-crown { font-size: 26px; }
.portal-brand-logo { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.portal-brand-title { font-family: var(--font-royal); font-weight: 700; font-size: 15px; }
.portal-brand-sub { font-size: 10.5px; color: var(--gold-light); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.portal-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.portal-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-xs);
  color: rgba(255,255,255,0.75); font-size: 13.5px; font-weight: 600; transition: background .15s ease, color .15s ease;
}
.portal-nav-item span:first-child { font-size: 16px; }
.portal-nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.portal-nav-item.active { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #2A1E00; box-shadow: 0 4px 12px rgba(212,175,55,0.3); }
.portal-sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 16px; margin-top: 12px; }
.portal-admin-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: rgba(255,255,255,0.9); margin-bottom: 10px; font-weight: 600; }
.portal-logout-link { font-size: 12px; color: var(--gold-light); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.portal-sidebar-overlay { display: none; }

.portal-main { flex: 1; min-width: 0; }
.portal-topbar {
  background: #fff; padding: 16px 28px; border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.portal-topbar h1 { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin: 0; color: var(--royal-indigo); flex: 1; }
.portal-content { padding: 26px 28px 48px; max-width: 1100px; }
.portal-hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 34px; height: 34px; background: none; border: none; cursor: pointer; flex-shrink: 0;
}
.portal-hamburger span { display: block; width: 20px; height: 2px; background: var(--royal-indigo); border-radius: 2px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  border: 1px solid var(--line); transition: transform .15s ease, box-shadow .15s ease;
  display: flex; align-items: center; gap: 14px;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.stat-icon {
  width: 42px; height: 42px; border-radius: 12px; background: var(--purple-bg); color: var(--purple);
  display: flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.stat-label { font-size: 11px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-family: var(--font-display); font-size: 23px; font-weight: 700; margin-top: 3px; color: var(--royal-indigo); }
.stat-card.stat-gold { border-top: 3px solid var(--gold-light); }
.stat-card.stat-gold .stat-icon { background: var(--amber-bg); color: var(--gold); }
.stat-card.stat-gold .stat-value { color: var(--gold); }

/* ---------- Portal cards & tables ---------- */
.portal-grid-2 { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .portal-grid-2 { grid-template-columns: 1fr; } }
.portal-card {
  background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  border: 1px solid var(--line); margin-bottom: 20px;
}
.portal-card-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin-bottom: 16px; color: var(--royal-indigo); display: flex; align-items: center; justify-content: space-between; }
.portal-card-title .portal-count-chip { font-size: 11px; font-weight: 700; background: var(--gray-bg); color: var(--ink-soft); padding: 3px 10px; border-radius: 20px; }
.portal-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .portal-form-row { grid-template-columns: 1fr; } }

.portal-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.portal-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.portal-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em;
  color: var(--ink-soft); font-weight: 700; padding: 10px; border-bottom: 2px solid var(--line); white-space: nowrap;
}
.portal-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); }
.portal-table tr:last-child td { border-bottom: none; }
.portal-table tr:hover td { background: var(--gray-bg); }
.portal-muted { color: var(--ink-soft); font-size: 11.5px; }
.portal-empty-row td { text-align: center; padding: 36px 10px; color: var(--ink-soft); }

.status-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.status-pill.status-gray { background: var(--gray-bg); color: var(--ink-soft); }
.status-pill.status-amber { background: var(--amber-bg); color: var(--amber); }
.status-pill.status-purple { background: var(--purple-bg); color: var(--purple); }
.status-pill.status-teal { background: var(--teal-bg); color: var(--teal); }
.status-pill.status-green { background: var(--green-bg); color: var(--green); }
.status-pill.status-red { background: #FCE9E6; color: #A23B2A; }

.portal-product-thumb {
  width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
  border: 1px solid var(--line);
}
.portal-product-cell { display: flex; align-items: center; gap: 10px; }
.portal-table-link {
  font-size: 12px; font-weight: 700; color: var(--purple); margin-right: 10px;
  background: none; border: none; cursor: pointer; padding: 0; font-family: inherit;
  display: inline-block;
}
.portal-table-link-danger { color: #A23B2A; }
.portal-actions-cell { white-space: nowrap; }
.portal-hide-btn { padding: 6px 12px; font-size: 11px; white-space: nowrap; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 17px; height: 17px; flex-shrink: 0; }

/* ---------- Admin product search + pagination ---------- */
.admin-search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.admin-search-row input[type="text"] {
  flex: 1; min-width: 140px; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font-size: 13px;
}
.admin-search-row .btn-secondary { padding: 10px 16px; font-size: 12.5px; white-space: nowrap; }

.portal-pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.portal-page-btn {
  padding: 8px 16px; border-radius: var(--radius-xs); background: var(--gray-bg);
  color: var(--ink); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.portal-page-btn.disabled { opacity: 0.4; pointer-events: none; }
.portal-page-info { font-size: 12px; color: var(--ink-soft); text-align: center; }

/* ---------- Admin responsiveness — mobile ---------- */
@media (max-width: 560px) {
  .portal-product-cell { align-items: flex-start; }
  .portal-pagination { flex-direction: column; }
  .admin-search-row { flex-direction: column; align-items: stretch; }
  .admin-search-row .btn-secondary { width: 100%; }
}

/* ---------- Responsive sidebar drawer (admin, small screens) ---------- */
@media (max-width: 900px) {
  .portal-hamburger { display: flex; }
  .portal-avatar-topbar { display: inline-flex; }
  .portal-sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1); z-index: 50; width: 264px;
  }
  .portal-sidebar.open { transform: translateX(0); }
  .portal-sidebar-overlay {
    display: block; position: fixed; inset: 0; background: rgba(20,15,45,0.5);
    opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 45;
  }
  .portal-sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .portal-content { padding: 20px 16px 40px; }
  .portal-topbar { padding: 14px 16px; }
}

/* ---------- Driver portal ---------- */
.driver-body { background: #F3F1EA; }
.driver-shell { max-width: 480px; margin: 0 auto; min-height: 100vh; background: #fff; box-shadow: 0 0 40px rgba(0,0,0,0.1); }
.driver-topbar {
  background: linear-gradient(160deg, var(--royal-indigo) 0%, var(--royal-indigo-dark) 100%);
  color: #fff; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.driver-brand { font-family: var(--font-royal); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.driver-brand-logo { width: 24px; height: 24px; object-fit: contain; }
.driver-topbar .portal-logout-link { color: var(--gold-light); }
.driver-content { padding: 18px 18px 32px; }
.driver-hello {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--purple-bg) 0%, #FDF8EA 100%);
  border: 1px solid #E9D19A; border-radius: var(--radius); padding: 16px 18px;
}
.driver-hello-name { font-family: var(--font-royal); font-weight: 700; font-size: 17px; }
.driver-hello-shop { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.driver-hello-avatar {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--purple);
  display: flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: var(--shadow); flex-shrink: 0;
}

.driver-active-card { border-top: 3px solid var(--gold-light); }
.driver-order-code { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--royal-indigo); }
.driver-order-customer, .driver-order-address { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; line-height: 1.5; }
.driver-status-banner {
  margin: 14px 0; padding: 13px 14px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600;
  background: var(--gray-bg); color: var(--ink-soft); transition: background .3s ease, color .3s ease;
  display: flex; align-items: center; gap: 8px;
}
.driver-status-banner.status-dispatched { background: var(--purple-bg); color: var(--purple); }
.driver-status-banner.status-arrived { background: var(--amber-bg); color: var(--amber); }
.driver-status-pop { animation: arrival-pop .4s cubic-bezier(.34,1.56,.64,1); }
.driver-gps-indicator {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--purple); font-weight: 600; margin-bottom: 12px;
  background: var(--purple-bg); padding: 9px 12px; border-radius: var(--radius-xs);
}
.driver-gps-indicator .pulse-dot { position: static; animation: pulse-dot-anim 1.4s infinite; background: var(--purple); width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.driver-distance-row {
  font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 14px;
  font-family: var(--font-display); text-align: center; padding: 8px; background: var(--gray-bg); border-radius: var(--radius-xs);
}
.driver-order-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line);
}
.driver-order-row:last-child { border-bottom: none; }
.driver-accept-btn { padding: 10px 20px; font-size: 12.5px; white-space: nowrap; }

.driver-navigate-btn {
  display: block; text-align: center; margin-bottom: 14px;
  color: var(--purple); background: var(--purple-bg); border-color: #E9D19A;
}
.driver-otp-form { margin-top: 4px; }
.driver-otp-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.driver-otp-input {
  width: 100%; text-align: center; font-family: var(--font-display); font-size: 22px; font-weight: 700;
  letter-spacing: 0.3em; padding: 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.driver-otp-input:focus { outline: none; border-color: var(--purple); }

/* ---------- Driver earnings ---------- */
.earnings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.earnings-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 10px; text-align: center; box-shadow: var(--shadow);
}
.earnings-card-gold { border-top: 3px solid var(--gold-light); }
.earnings-label { font-size: 10.5px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; }
.earnings-value { font-family: var(--font-display); font-weight: 700; font-size: 17px; color: var(--royal-indigo); margin: 4px 0 2px; }
.earnings-card-gold .earnings-value { color: var(--gold); }
.earnings-sub { font-size: 10.5px; color: var(--ink-soft); }

/* ---------- Home slider management ---------- */
.slide-manage-list { display: flex; flex-direction: column; gap: 12px; }
.slide-manage-row {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px;
}
.slide-manage-thumb {
  width: 96px; height: 56px; border-radius: var(--radius-xs); object-fit: cover;
  flex-shrink: 0; background: var(--gray-bg);
}
.slide-manage-info { flex: 1; min-width: 0; }
.slide-manage-alt { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.slide-manage-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }
.slide-manage-actions form { margin: 0; }
.slide-manage-actions .portal-table-link:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 560px) {
  .slide-manage-row { flex-wrap: wrap; }
  .slide-manage-actions { flex-direction: row; flex-wrap: wrap; width: 100%; justify-content: flex-start; }
}

/* ---------- Ripple feedback (Material touch) ---------- */
.ripple-surface { position: relative; overflow: hidden; }
.ripple-ink {
  position: absolute; border-radius: 50%; background: rgba(255,255,255,0.5);
  transform: scale(0); animation: ripple-anim .5s ease-out; pointer-events: none;
}
@keyframes ripple-anim { to { transform: scale(2.2); opacity: 0; } }
