/* ==========================================================================
   PepTalk FL - Standalone Clinical Portal Master Stylesheet
   Isolated WordPress Plugin Styling (Bypasses Theme Header, Footer, and CSS)
   Color Palette: Midnight Navy (#00183a), Royal Blue (#0062cc), Ice White (#f8fafc)
   ========================================================================== */

:root {
  --color-navy-darkest: #000b1a;
  --color-navy-primary: #00183a;
  --color-navy-secondary: #002554;
  --color-blue-royal: #0062cc;
  --color-blue-electric: #0d80f2;
  --color-blue-glow: #38bdf8;
  --color-blue-ice: #f0f6ff;
  --color-blue-subtle: #e8f2fe;

  --color-white: #ffffff;
  --color-bg-light: #f8fafc;
  --color-bg-alt: #f1f5f9;
  --color-border-light: #e2e8f0;
  --color-border-card: rgba(0, 24, 58, 0.08);

  --color-text-main: #0f172a;
  --color-text-muted: #475569;
  --color-text-subtle: #64748b;
  --color-text-white: #ffffff;

  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;

  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow-sm: 0 1px 3px rgba(0, 24, 58, 0.05);
  --shadow-md: 0 4px 14px rgba(0, 24, 58, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 24, 58, 0.1);
  --shadow-xl: 0 20px 45px rgba(0, 24, 58, 0.14);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset for Clean Isolation */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.peptalk-portal-body {
  font-family: var(--font-body);
  background-color: #f1f5f9;
  color: var(--color-text-main);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.portal-container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* Top Bar */
.portal-top-bar {
  background: var(--color-navy-darkest);
  color: #bfdbfe;
  font-size: 0.8rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.top-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.status-indicator {
  width: 8px;
  height: 8px;
  background: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-success);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.role-pill {
  background: var(--color-blue-royal);
  color: #fff;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.exit-link {
  color: #93c5fd;
  text-decoration: none;
  font-size: 0.78rem;
}
.exit-link:hover {
  color: #ffffff;
}

/* Header */
.portal-header {
  background: #ffffff;
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 76px;
}

.portal-brand .brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.portal-logo-img {
  height: 46px;
  width: auto;
  object-fit: contain;
}

.brand-headings {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-navy-primary);
  line-height: 1.1;
}

.brand-title span {
  color: var(--color-blue-royal);
}

.brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-subtle);
}

.portal-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
  background: var(--color-blue-ice);
  color: var(--color-blue-royal);
}

.portal-user-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border-light);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.user-avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-blue-royal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

.user-meta-text {
  display: flex;
  flex-direction: column;
}

.user-display-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-navy-primary);
  line-height: 1.2;
}

.user-role-label {
  font-size: 0.72rem;
  color: var(--color-text-subtle);
}

.btn-portal-logout {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f1f5f9;
  color: var(--color-text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: var(--transition);
}

.btn-portal-logout:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* Main Content Area */
.portal-main-wrapper {
  flex-grow: 1;
  padding: 32px 0 60px;
}

/* Card Utility */
.portal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-card);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 28px;
}

/* Status Banner Callouts */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.banner-approved {
  border-left: 6px solid var(--color-success);
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.banner-pending {
  border-left: 6px solid var(--color-warning);
  background: linear-gradient(135deg, #ffffff 0%, #fffdf8 100%);
}

.banner-doctor {
  border-left: 6px solid var(--color-blue-royal);
  background: linear-gradient(135deg, #ffffff 0%, #f4f8fd 100%);
}

.banner-admin {
  border-left: 6px solid var(--color-navy-primary);
  background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

.status-icon {
  font-size: 2.4rem;
  color: var(--color-success);
  flex-shrink: 0;
}

.status-text {
  flex-grow: 1;
}

.status-text h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-navy-primary);
  margin-bottom: 6px;
}

.status-text p {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.status-meta-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.meta-pill {
  background: #ffffff;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-navy-primary);
  box-shadow: var(--shadow-sm);
}

.meta-pill span {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-subtle);
}

/* Tabs */
.portal-nav-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 2px solid var(--color-border-light);
  margin-bottom: 28px;
}

.portal-tab-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 12px 20px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text-subtle);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-tab-btn:hover {
  color: var(--color-blue-royal);
}

.portal-tab-btn.active {
  color: var(--color-blue-royal);
  border-bottom-color: var(--color-blue-royal);
}

.portal-tab-content {
  display: none;
}
.portal-tab-content.active {
  display: block;
}

/* Section Header */
.portal-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.portal-section-header h2 {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--color-navy-primary);
  margin-bottom: 4px;
}

.portal-section-header p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* Products Grid */
.portal-products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.portal-product-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--color-border-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.portal-product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.portal-product-card.locked {
  background: #fafafa;
  border-style: dashed;
}

.product-media-wrap {
  height: 200px;
  background: var(--color-navy-primary);
  position: relative;
  overflow: hidden;
}

.product-media-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge-success {
  background: var(--color-success);
  color: #fff;
}

.badge-locked {
  background: #475569;
  color: #fff;
}

.badge-warning {
  background: #f59e0b;
  color: #fff;
}

.badge-info {
  background: #0284c7;
  color: #fff;
}

.product-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-navy-primary);
  margin-bottom: 4px;
}

.product-card-potency {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-blue-royal);
  margin-bottom: 12px;
}

.product-card-desc {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
  flex-grow: 1;
}

.clinical-box {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.82rem;
  margin-bottom: 18px;
  line-height: 1.45;
}

.box-verified {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.box-locked {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.product-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
}

.price-val {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-navy-primary);
}

.price-unit {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}

.price-locked {
  font-size: 0.85rem;
  color: var(--color-text-subtle);
  font-style: italic;
}

/* Button System */
.btn-portal-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #0054be 0%, var(--color-navy-primary) 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(0, 37, 84, 0.2);
}

.btn-portal-primary:hover {
  background: linear-gradient(135deg, #0066d6 0%, #001f4c 100%);
  transform: translateY(-1.5px);
  box-shadow: 0 8px 20px rgba(0, 98, 204, 0.35);
  color: #ffffff;
}

.btn-portal-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  color: var(--color-navy-primary);
  border: 1.5px solid var(--color-border-light);
  cursor: pointer;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
}

.btn-portal-secondary:hover {
  border-color: var(--color-blue-royal);
  color: var(--color-blue-royal);
  background: var(--color-blue-ice);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.84rem;
}

.btn-action {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-approve {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.btn-approve:hover {
  background: #bbf7d0;
}

.btn-revoke {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.btn-revoke:hover {
  background: #fecaca;
}

/* Stats Row */
.portal-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.portal-stat-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-card);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-navy-primary);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 0.8rem;
  color: var(--color-text-subtle);
  font-weight: 600;
}

/* Tables */
.portal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.portal-table th {
  background: #f8fafc;
  color: var(--color-navy-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 2px solid var(--color-border-light);
}

.portal-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
}

.portal-table tr:hover td {
  background: #f8fafc;
}

/* Modals */
.portal-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 15, 36, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.portal-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.portal-modal-window {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  position: relative;
  padding: 36px;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtle);
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

/* Form Controls */
.portal-form-group {
  margin-bottom: 18px;
}

.portal-form-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-navy-primary);
  margin-bottom: 6px;
}

.portal-form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--color-text-main);
  background: #f8fafc;
  transition: var(--transition);
}

.portal-form-control:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--color-blue-royal);
  box-shadow: 0 0 0 3px rgba(0, 98, 204, 0.15);
}

.input-with-icon {
  position: relative;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
}

.input-with-icon input {
  padding-left: 42px;
}

/* Notices */
.notice-box {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.notice-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.notice-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Auth Page Layout */
.portal-auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: calc(100vh - 200px);
}

.portal-auth-box {
  background: #ffffff;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-card);
  box-shadow: var(--shadow-xl);
  padding: 44px;
  width: 100%;
  max-width: 480px;
}

.auth-header {
  margin-bottom: 28px;
}

.auth-logo {
  height: 58px;
  width: auto;
  margin-bottom: 16px;
}

.auth-header h2 {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--color-navy-primary);
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

/* Footer */
.portal-footer {
  background: var(--color-navy-darkest);
  color: #94a3b8;
  padding: 40px 0 24px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.portal-disclaimer-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  font-size: 0.76rem;
  line-height: 1.6;
  color: #64748b;
  margin-bottom: 24px;
}

.portal-disclaimer-card strong {
  color: #94a3b8;
}

.portal-footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  flex-wrap: wrap;
  gap: 12px;
}

.portal-footer-bottom .footer-links {
  display: flex;
  gap: 12px;
  color: #64748b;
}

/* Toast System */
.peptalk-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.peptalk-toast {
  background: var(--color-navy-primary);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--color-blue-royal);
}

/* Responsive */
@media (max-width: 1024px) {
  .portal-products-grid {
    grid-template-columns: 1fr;
  }
  .portal-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .portal-top-bar {
    display: none;
  }
  .header-inner {
    height: auto;
    padding: 16px 0;
    flex-direction: column;
    gap: 16px;
  }
  .status-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .portal-stats-row {
    grid-template-columns: 1fr;
  }
  .portal-auth-box {
    padding: 28px 20px;
  }
}
