/* Medical Staff Portal — Public Form Styles */
/* Scope all resets strictly inside plugin wrappers — never leak to rest of page */
#msp-portal-wrap *, #msp-portal-wrap *::before, #msp-portal-wrap *::after,
#msp-dir-wrap *, #msp-dir-wrap *::before, #msp-dir-wrap *::after {
  box-sizing: border-box;
}

#msp-portal-wrap {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 12px 48px;
}

/* ── Keyframes ── */
@keyframes mspCardIn  { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes mspSlideUp { from { opacity:0; transform:translateY(24px) scale(.97); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes mspSpin    { to { transform: rotate(360deg); } }
@keyframes mspPop     { from { transform:scale(0); } to { transform:scale(1); } }
@keyframes mspFadeUp  { from { opacity:0; transform:translateY(10px) translateX(-50%); } to { opacity:1; transform:translateY(0) translateX(-50%); } }

/* ── Card ── */
.msp-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  padding: 32px 28px 24px;
  animation: mspCardIn .4s ease;
}

/* ── Logo ── */
.msp-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.msp-logo-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.msp-logo-title  { font-size: 17px; font-weight: 700; color: #1e293b; }
.msp-logo-sub    { font-size: 11px; color: #64748b; margin-top: 2px; }

/* ── Step indicator ── */
.msp-steps {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}
.msp-step-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
  transition: all .3s;
}
.msp-step-dot.pending { background: #e2e8f0; color: #94a3b8; }
.msp-step-dot.active  { color: #fff; box-shadow: 0 0 0 4px rgba(26,111,191,.15); }
.msp-step-dot.done    { background: #0ea47a !important; color: #fff; }
.msp-step-line { flex: 1; height: 2px; background: #e2e8f0; transition: background .3s; }
.msp-step-line.done { background: #0ea47a; }

/* ── NID step ── */
.msp-nid-wrap { text-align: center; }
.msp-nid-wrap h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; color: #1e293b; }
.msp-nid-wrap p  { font-size: 13px; color: #64748b; margin-bottom: 22px; }
.msp-nid-input {
  width: 100%;
  padding: 12px;
  text-align: center;
  font-size: 20px;
  letter-spacing: 5px;
  font-weight: 700;
  direction: ltr;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  margin-bottom: 6px;
}
.msp-nid-input:focus { border-color: #1a6fbf; box-shadow: 0 0 0 3px rgba(26,111,191,.12); }
.msp-nid-input.msp-error { border-color: #ef4444; }
.msp-error-msg { font-size: 12px; color: #ef4444; margin-bottom: 16px; display: none; }
.msp-error-msg.show { display: block; }

/* ── Returning user banner ── */
.msp-returning-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid;
  margin-bottom: 16px;
  font-size: 13px;
  animation: mspCardIn .4s ease;
}
.msp-returning-banner strong { display: block; font-weight: 700; }
.msp-returning-banner span   { font-size: 12px; color: #475569; }

/* ── Button ── */
.msp-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.msp-btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.msp-btn-primary:active { transform: translateY(0); }
.msp-btn-primary:disabled { opacity: .7; cursor: not-allowed; transform: none; }

/* ── Spinner ── */
.msp-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top: 2px solid #fff;
  border-radius: 50%;
  animation: mspSpin .7s linear infinite;
  display: none;
}
.msp-btn-primary.loading .msp-spinner { display: inline-block; }
.msp-btn-primary.loading .msp-btn-label { display: none; }

/* ── Photo box ── */
.msp-photo-wrap { margin-bottom: 18px; }
.msp-photo-box {
  border: 2px dashed #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #f8fafc;
  transition: all .2s;
  position: relative;
}
.msp-photo-box:hover { border-color: #1a6fbf; background: #e8f1fb; }
.msp-photo-box .msp-photo-icon  { font-size: 26px; }
.msp-photo-box .msp-photo-label { font-size: 10px; font-weight: 600; color: #94a3b8; margin-top: 2px; }
.msp-photo-box .msp-photo-size  { font-size: 9px; color: #b0b8c4; display: block; margin-top: 1px; }
.msp-photo-box img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }

/* Required field error state */
.msp-form-input.msp-field-error,
.msp-form-select.msp-field-error {
  border-color: #ef4444 !important;
  background: #fff5f5 !important;
  animation: msp-shake 0.3s ease;
}
@keyframes msp-shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-4px); }
  40%,80% { transform: translateX(4px); }
}

/* ── Info rows ── */
.msp-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  margin-bottom: 9px;
  min-height: 46px;
  background: #f8fafc;
}
.msp-row-icon  { font-size: 17px; flex-shrink: 0; }
.msp-row-value { flex: 1; font-weight: 500; }
.msp-row-value.empty { color: #94a3b8; font-style: italic; font-weight: 400; }
.msp-row-label { font-size: 11px; color: #94a3b8; flex-shrink: 0; }

/* ── Action buttons ── */
.msp-action-btns {
  display: flex;
  gap: 9px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.msp-action-btn {
  flex: 1;
  min-width: 105px;
  padding: 10px 6px;
  border-radius: 9px;
  border: 1.5px solid;
  background: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  transition: all .2s;
}
.msp-action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.msp-action-btn .msp-ab-icon { font-size: 20px; }

/* ── Modal overlay ── */
.msp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.msp-modal-overlay.open { opacity: 1; pointer-events: all; }
.msp-modal {
  background: #fff;
  border-radius: 18px;
  padding: 24px 24px 18px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  transform: translateY(28px) scale(.97);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  direction: rtl;
}
.msp-modal-overlay.open .msp-modal { transform: translateY(0) scale(1); }
.msp-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #e2e8f0;
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.msp-modal-title { font-size: 15px; font-weight: 700; }
.msp-modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: grid; place-items: center;
  transition: background .2s;
}
.msp-modal-close:hover { background: #e2e8f0; }

/* ── Upload zone ── */
.msp-upload-zone {
  border: 2px dashed #e2e8f0;
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: all .2s;
}
.msp-upload-zone:hover,
.msp-upload-zone.dragover { border-color: #1a6fbf; background: #e8f1fb; }
.msp-upload-zone .msp-uz-icon { font-size: 36px; margin-bottom: 8px; }
.msp-upload-zone p     { font-size: 13px; color: #475569; margin-bottom: 4px; }
.msp-upload-zone small { font-size: 11px; color: #94a3b8; }

/* ── File list ── */
.msp-file-list { margin-top: 12px; }
.msp-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-radius: 8px;
  margin-top: 6px;
  font-size: 13px;
}
.msp-file-name  { flex: 1; }
.msp-file-size  { font-size: 11px; color: #94a3b8; }
.msp-file-remove { background: none; border: none; cursor: pointer; color: #ef4444; font-size: 16px; }

/* ── Form fields in modal ── */
.msp-form-field { margin-bottom: 14px; }
.msp-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
}
.msp-form-label .req { color: #ef4444; }
.msp-form-input, .msp-form-select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  color: #1e293b;
  background: #f8fafc;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.msp-form-input:focus, .msp-form-select:focus { border-color: #1a6fbf; box-shadow: 0 0 0 3px rgba(26,111,191,.12); background: #fff; }
.msp-form-input.readonly { background: #f1f5f9; color: #94a3b8; cursor: not-allowed; letter-spacing: 2px; }
.msp-form-input[dir=ltr] { direction: ltr; }

/* ── Image preview ── */
.msp-img-preview { margin-top: 14px; text-align: center; }
.msp-img-preview img { max-width: 100%; max-height: 200px; border-radius: 10px; border: 1.5px solid #e2e8f0; }

/* ── Toast ── */
.msp-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: #1e293b;
  color: #fff;
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 999999;
  pointer-events: none;
  opacity: 0;
  transition: all .3s;
  white-space: nowrap;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}
.msp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 500px) {
  .msp-card { padding: 22px 16px 18px; }
  .msp-action-btns { gap: 7px; }
  .msp-action-btn  { font-size: 11px; min-width: 88px; }
}
