/* ===== Portal Web UX Styles ===== */
/* Page transitions, offline, account deletion, PDF actions, upload UI */

/* ===== Touch Targets: ≥ 44pt (mobile-friendly) ===== */
.portal-btn,
.portal-tab,
.portal-list-item,
.portal-icon-btn,
.pm-date-btn,
.pm-slot-btn,
.pm-radio-pill,
.pm-legal-lang-btn,
.pm-legal-back {
  min-height: 44px;
}

.portal-icon-btn {
  min-width: 44px;
  min-height: 44px;
}

.pm-slot-btn {
  min-height: 44px;
  min-width: 70px;
}

.pm-date-btn {
  min-width: 52px;
  min-height: 60px;
}

.portal-tab {
  min-height: 48px;
  min-width: 64px;
}

/* ===== 3.10 Page Slide Transitions ===== */
.portal-page-enter {
  animation: pm-page-enter 0.25s ease-out;
}

@keyframes pm-page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* For RTL: forward navigation slides from left, back from right */
html[dir="rtl"] .portal-page-enter.pm-slide-forward {
  animation: pm-slide-from-left 0.3s ease-out;
}

html[dir="rtl"] .portal-page-enter.pm-slide-back {
  animation: pm-slide-from-right 0.3s ease-out;
}

html[dir="ltr"] .portal-page-enter.pm-slide-forward {
  animation: pm-slide-from-right 0.3s ease-out;
}

html[dir="ltr"] .portal-page-enter.pm-slide-back {
  animation: pm-slide-from-left 0.3s ease-out;
}

@keyframes pm-slide-from-left {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes pm-slide-from-right {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== 3.4 Skeleton Loaders (extended) ===== */
.portal-skeleton-doctor {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--portal-surface);
  border-radius: 12px;
  margin-bottom: 10px;
}

.portal-skeleton-doctor::before {
  content: '';
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--portal-border) 25%, #e8e8e8 50%, var(--portal-border) 75%);
  background-size: 200% 100%;
  animation: portal-shimmer 1.5s infinite;
}

.portal-skeleton-doctor::after {
  content: '';
  flex: 1;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--portal-border) 25%, #e8e8e8 50%, var(--portal-border) 75%);
  background-size: 200% 100%;
  animation: portal-shimmer 1.5s infinite;
}

/* ===== 3.5 Offline Screen ===== */
.pm-offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--portal-bg, #f5f6fa);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.pm-offline-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.pm-offline-icon {
  margin-bottom: 20px;
  color: var(--portal-text-muted);
}

.pm-offline-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--portal-text);
  margin-bottom: 8px;
}

.pm-offline-subtitle {
  font-size: 0.875rem;
  color: var(--portal-text-secondary);
  margin-bottom: 24px;
  max-width: 280px;
}

.pm-offline-retry {
  min-width: 140px;
}

/* Small offline toast for non-blocking offline indicator */
.pm-offline-toast {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(calc(-100% - 16px));
  opacity: 0;
  background: var(--portal-danger, #ef4444);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 10001;
  transition: transform 0.3s ease;
  pointer-events: none;
}

.pm-offline-toast.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== 3.6 Account Deletion ===== */
.pm-delete-account-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--portal-border);
}

.pm-delete-account-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1.5px solid var(--portal-danger, #ef4444);
  border-radius: 12px;
  color: var(--portal-danger, #ef4444);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.pm-delete-account-btn:hover,
.pm-delete-account-btn:active {
  background: rgba(239, 68, 68, 0.06);
}

/* Delete Account Modal */
.pm-delete-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.pm-delete-modal {
  background: var(--portal-surface, #fff);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
}

.pm-delete-modal-icon {
  text-align: center;
  margin-bottom: 16px;
}

.pm-delete-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--portal-danger, #ef4444);
  text-align: center;
  margin-bottom: 8px;
}

.pm-delete-modal-desc {
  font-size: 0.8125rem;
  color: var(--portal-text-secondary);
  text-align: center;
  margin-bottom: 20px;
  line-height: 1.6;
}

.pm-delete-confirm-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--portal-danger, #ef4444);
  border-radius: 10px;
  font-size: 0.9375rem;
  color: var(--portal-text);
  text-align: center;
  font-family: inherit;
  margin-bottom: 16px;
  box-sizing: border-box;
}

.pm-delete-confirm-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.pm-delete-modal-actions {
  display: flex;
  gap: 10px;
}

.pm-delete-modal-actions .portal-btn {
  flex: 1;
}

.portal-btn-danger {
  background: var(--portal-danger, #ef4444);
  color: #fff;
  border: none;
}

.portal-btn-danger:disabled {
  opacity: 0.5;
}

/* ====================================================
   PDF Actions
   ==================================================== */

/* Inline PDF action buttons in detail views */
.pm-pdf-detail-actions {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  justify-content: center;
}

.pm-pdf-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 10px;
  min-height: 40px;
}

.pm-pdf-action-btn svg,
.pm-pdf-action-btn i {
  width: 16px;
  height: 16px;
}

.pm-pdf-btn-sm {
  font-size: 12px;
  padding: 6px 12px;
  min-height: 34px;
}

/* PDF Preview page sticky actions bar */
.pm-pdf-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--portal-safe-bottom, 0px));
  background: var(--portal-bg-primary, #fff);
  border-top: 1px solid var(--portal-border-color, #e5e7eb);
  z-index: 50;
}

.pm-pdf-actions .pm-pdf-action-btn {
  flex: 1;
  justify-content: center;
}

/* ====================================================
   Document Upload UI
   ==================================================== */

/* Upload Zone */
.pm-upload-zone {
  border: 2px dashed var(--portal-border-color, #e5e7eb);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.pm-upload-zone:hover,
.pm-upload-zone.dragover {
  border-color: var(--portal-primary, #4f46e5);
  background: rgba(var(--portal-primary-rgb, 79,70,229), 0.04);
}
.pm-upload-zone-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 8px;
  color: var(--portal-text-secondary, #6b7280);
}
.pm-upload-zone-text {
  font-size: 14px;
  color: var(--portal-text-secondary, #6b7280);
}
.pm-upload-zone-hint {
  font-size: 12px;
  color: var(--portal-text-tertiary, #9ca3af);
  margin-top: 4px;
}

/* Upload Progress */
.pm-upload-progress {
  margin-top: 12px;
  display: none;
}
.pm-upload-progress.active { display: block; }
.pm-upload-progress-bar {
  height: 4px;
  background: var(--portal-bg-secondary, #f3f4f6);
  border-radius: 2px;
  overflow: hidden;
}
.pm-upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--portal-primary, #4f46e5);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.pm-upload-progress-text {
  font-size: 12px;
  color: var(--portal-text-secondary, #6b7280);
  margin-top: 4px;
  text-align: center;
}

/* Upload Preview (thumbnail) */
.pm-upload-preview {
  position: relative;
  display: inline-block;
  margin-top: 12px;
}
.pm-upload-preview img {
  width: 100%;
  max-width: 300px;
  border-radius: 10px;
  border: 1px solid var(--portal-border-color, #e5e7eb);
}
.pm-upload-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
html[dir="rtl"] .pm-upload-preview-remove {
  right: auto;
  left: -8px;
}

/* Document List Item */
.pm-doc-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--portal-bg-primary, #fff);
  border: 1px solid var(--portal-border-color, #e5e7eb);
  border-radius: 10px;
  margin-bottom: 8px;
}
.pm-doc-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--portal-bg-secondary, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pm-doc-item-icon svg { width: 20px; height: 20px; color: var(--portal-primary, #4f46e5); }
.pm-doc-item-info { flex: 1; min-width: 0; }
.pm-doc-item-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--portal-text-primary, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-doc-item-meta {
  font-size: 12px;
  color: var(--portal-text-secondary, #6b7280);
  margin-top: 2px;
}
.pm-doc-item-actions {
  display: flex;
  gap: 4px;
}
