/* IBD Dashboard — Monitor Portal */
/* ═══════════════════════════════════════════
   MONITOR PORTAL — full visual system
   ═══════════════════════════════════════════ */
#monitorPortal { background: var(--bg-page); min-height: 100vh; display: flex; flex-direction: column; }

/* Header — matches sidebar cyan-blue gradient */
.mp-portal-header {
  background: linear-gradient(180deg, #0891b2 0%, #0369a1 100%);
  padding: 18px 20px 20px;
  display: flex; justify-content: space-between; align-items: flex-start;
  /* scrolls with the page — sticky caused rows to peek out above it on mobile */
  box-shadow: 0 2px 8px rgba(3,105,161,.35);
}
.mp-classname {
  font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -.01em;
  display: flex; align-items: center;
}
.mp-dateline {
  font-size: 12px; color: rgba(255,255,255,.72); margin-top: 4px; line-height: 1.4;
}
.mp-signout {
  display: flex; align-items: center; gap: 5px;
  color: rgba(255,255,255,.85); font-size: 12px; font-weight: 500;
  cursor: pointer; padding: 7px 13px; border-radius: 8px;
  background: rgba(255,255,255,.15); transition: background .15s; white-space: nowrap;
}
.mp-signout:hover { background: rgba(255,255,255,.28); color: #fff; }

/* Tab bar */
.mp-tabbar {
  background: #fff; border-bottom: 1px solid #e5e7eb;
  display: flex; padding: 0 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.mp-tab {
  padding: 11px 20px; border: none; background: none; cursor: pointer;
  font-size: 13px; color: var(--text-secondary); border-bottom: 2px solid transparent;
  display: flex; align-items: center; gap: 6px; transition: color .15s;
}
.mp-tab i { font-size: 14px; }
.mp-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.mp-tab:hover:not(.active) { color: var(--text-primary); }

/* Pane content */
.mp-pane { padding: 14px 14px 0; max-width: 640px; margin: 0 auto; width: 100%; box-sizing: border-box; }

/* Mode / info card */
.mp-mode-card {
  background: #fff; border-radius: 12px; border: 0.5px solid #e5e7eb;
  padding: 14px 16px; font-size: 13.5px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05); margin-bottom: 12px;
}

/* Attendance table card */
.mp-table-card {
  background: #fff; border-radius: 12px; border: 0.5px solid #e5e7eb;
  overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.mp-table-card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mp-table-card thead tr { background: #f8fafc; border-bottom: 1px solid #e5e7eb; }
.mp-table-card th {
  padding: 9px 12px; font-size: 10.5px; font-weight: 600;
  color: var(--text-muted); text-align: left; text-transform: uppercase; letter-spacing: .05em;
}
.mp-table-card td { padding: 9px 12px; border-bottom: 0.5px solid #f0f2f5; color: var(--text-primary); vertical-align: middle; }
.mp-table-card tbody tr:last-child td { border-bottom: none; }
.mp-table-card tbody tr { transition: background .1s; }

/* Status chip grid — replaces <select> */
.mp-status-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.mp-chip {
  padding: 5px 4px; font-size: 10.5px; font-weight: 600;
  border-radius: 6px; border: 1.5px solid #e5e7eb;
  background: #f9fafb; color: #9ca3af;
  cursor: pointer; transition: all .1s; text-align: center; line-height: 1.2;
}
.mp-chip:hover { border-color: #d1d5db; color: var(--text-primary); }
.mp-chip.mp-chip-active[data-val="Present"]      { background: #dcfce7; border-color: #16a34a; color: #15803d; }
.mp-chip.mp-chip-active[data-val="Late"]         { background: #fef9c3; border-color: #ca8a04; color: #92400e; }
.mp-chip.mp-chip-active[data-val="Authorized"]   { background: #dbeafe; border-color: #2563eb; color: #1d4ed8; }
.mp-chip.mp-chip-active[data-val="Unauthorized"] { background: #fee2e2; border-color: #dc2626; color: #b91c1c; }
.mp-chip.mp-chip-active[data-val="Exchange"]     { background: #ccfbf1; border-color: #0d9488; color: #0f766e; }
.mp-chip.mp-chip-active[data-val="Dropped Out"]  { background: #ffedd5; border-color: #ea580c; color: #c2410c; }

/* Submitted status badge (read-only rows) */
.mp-status-badge {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.mp-status-badge.present      { background: #dcfce7; color: #15803d; }
.mp-status-badge.late         { background: #fef9c3; color: #92400e; }
.mp-status-badge.authorized   { background: #dbeafe; color: #1d4ed8; }
.mp-status-badge.unauthorized { background: #fee2e2; color: #b91c1c; }
.mp-status-badge.exchange     { background: #ccfbf1; color: #0f766e; }
.mp-status-badge.dropped-out  { background: #ffedd5; color: #c2410c; }

/* Submit row */
.mp-submit-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-bottom: 36px; flex-wrap: wrap; }
.mp-submit-btn {
  padding: 13px 28px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.mp-submit-btn:hover  { background: var(--accent-hover); }
.mp-submit-btn:disabled { opacity: .5; cursor: not-allowed; }
.mp-submitted-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 18px; border-radius: 10px;
  background: #dcfce7; color: #15803d;
  font-size: 14px; font-weight: 600;
}

/* Past submissions list */
.mp-past-item {
  background: #fff; border: 0.5px solid #e5e7eb; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: box-shadow .15s;
}
.mp-past-item:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.mp-past-item strong { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.mp-past-item span   { font-size: 11.5px; color: var(--text-muted); }

/* Past detail overlay header — matches portal header */
.mp-past-header {
  background: linear-gradient(135deg, #0891b2 0%, #0369a1 100%);
  color: #fff; padding: 14px 16px; border-radius: 10px;
  margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;
}

/* Confirm popup buttons */
.mp-type-btn:hover        { border-color: #185fa5 !important; background: #e6f1fb !important; }
.mp-type-btn-cancel:hover { border-color: #e24b4a !important; background: #fef2f2 !important; }
.mp-course-chip:hover     { border-color: #185fa5; background: #e6f1fb; }

/* Responsive — wider screens get a centred card feel */
@media (min-width: 640px) {
  .mp-portal-header { padding: 20px 32px 22px; }
  .mp-pane { padding: 20px 24px 0; }
  .mp-tabbar { padding: 0 20px; }
}
@media (min-width: 1024px) {
  #monitorPortal { align-items: center; }
  .mp-portal-header { width: 100%; }
  .mp-tabbar { width: 100%; }
  .mp-pane { max-width: 680px; padding: 24px 0 0; }
}

/* ── Mobile — compact, touch-friendly (<= 520px) ──────────────────────────── */
@media (max-width: 520px) {
  /* Header */
  .mp-portal-header { padding: 12px 14px 14px; }
  .mp-classname { font-size: 15px; }
  .mp-dateline { font-size: 11.5px; }

  /* Tab bar */
  .mp-tabbar { padding: 0 4px; }
  .mp-tab { padding: 10px 12px; font-size: 12px; gap: 5px; }
  .mp-tab i { font-size: 13px; }

  /* Pane */
  .mp-pane { padding: 10px 10px 0; }

  /* Table */
  .mp-table-card table { font-size: 12px; }
  .mp-table-card th { padding: 8px 8px; font-size: 9.5px; }
  .mp-table-card td { padding: 7px 8px; }

  /* Status chips — bigger tap targets on mobile */
  .mp-status-chips { grid-template-columns: 1fr 1fr; gap: 5px; }
  .mp-chip {
    padding: 9px 4px;
    font-size: 10px;
    min-height: 38px;
    display: flex; align-items: center; justify-content: center;
  }

  /* Submit row — stack vertically, full-width buttons */
  .mp-submit-row { flex-direction: column; gap: 8px; align-items: stretch; }
  .mp-submit-btn { width: 100%; padding: 15px; font-size: 15px; border-radius: 12px; }

  /* Past items */
  .mp-past-item { padding: 12px 14px; }
  .mp-past-item strong { font-size: 12.5px; }

  /* Mode card */
  .mp-mode-card { font-size: 13px; padding: 12px 14px; }
}

/* ── iOS safe area — home indicator padding ─────────────────────────────── */
.mp-submit-row {
  padding-bottom: max(36px, env(safe-area-inset-bottom, 36px));
}

/* ── touch-action: manipulation — removes 300ms tap delay on all controls ─── */
.mp-chip, .mp-submit-btn, .mp-tab, .mp-signout,
.mp-past-item, #mp-confirm-box button,
button[onclick*="mpConfirmType"], button[onclick*="mpProceedFromConfirm"],
button[onclick*="mpFinalProceed"], button[onclick*="mpConfirmCancelled"] {
  touch-action: manipulation;
}

/* ── Spinner animation for loading state ────────────────────────────────── */
@keyframes mp-spin { to { transform: rotate(360deg); } }
.mp-spin-icon { display: inline-block; animation: mp-spin 0.9s linear infinite; }

/* ── Past-detail overlay — flex layout for sticky header ────────────────── */
#mp-past-detail { -webkit-overflow-scrolling: touch; }

/* ── Edit button mobile fix ─────────────────────────────────────────────── */
@media (max-width: 520px) {
  #mp-edit-btn { width: 100% !important; text-align: center !important; margin-right: 0 !important; }
}

/* ── Fill-lock waiting overlay ───────────────────────────────────────────── */
/* Pulsing dot shown in the "another monitor is filling" overlay card */
@keyframes mp-waiting-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.6); }
}
.mp-waiting-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #534AB7;
  animation: mp-waiting-pulse 1.4s ease-in-out infinite;
  display: inline-block;
  flex-shrink: 0;
}


