/**
 * HEALIST COMPONENTS
 * ==================
 * Reusable UI components: buttons, forms, cards, stats, tables, etc.
 * Uses tokens from healist-tokens.css
 */

/* ============================================
   BUTTONS - Design 4 Prestige (Option B)
   ============================================ */

/* Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  min-height: 44px; /* PWA: Touch target */
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

/* Primary Button - Navy */
.btn-primary {
  background: var(--brand-primary);
  color: var(--brand-text-light);
  border-color: var(--brand-primary);
}

.btn-primary:hover {
  background: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--brand-text-muted);
  border-color: var(--brand-text-muted);
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

/* Login Page Primary Button - Full width, uppercase */
.btn-primary.btn-full,
.login-form .btn-primary {
  width: 100%;
  padding: 18px 32px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  border: none;
  border-radius: var(--radius);
}

/* Secondary Button - Outlined */
.btn-secondary {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--brand-primary);
}

/* Danger Button - Red Outlined */
.btn-danger {
  background: transparent;
  color: var(--color-error);
  border-color: var(--color-error);
}

.btn-danger:hover {
  background: var(--color-error-light);
}

/* Gold Button - For AI/Special Actions */
.btn-gold {
  background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-secondary-light) 100%);
  color: var(--brand-primary-dark);
  border: none;
  font-weight: 600;
}

.btn-gold:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(201, 169, 98, 0.3);
}

/* Accent Button - Gold solid */
.btn-accent {
  background: var(--brand-secondary);
  color: var(--brand-primary-dark);
  font-weight: var(--font-semibold);
}

.btn-accent:hover {
  background: var(--brand-secondary-light);
}

/* Info Button - Subtle for view actions */
.btn-info {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--border-subtle);
}

.btn-info:hover {
  background: rgba(30, 58, 95, 0.06);
  border-color: var(--brand-primary);
}

/* Ghost Button - Text-like */
.btn-ghost {
  background: transparent;
  color: var(--brand-text-muted);
  border: none;
  padding: var(--space-2) var(--space-4);
}

.btn-ghost:hover {
  color: var(--brand-primary);
  background: var(--brand-surface-elevated);
}

/* Small Button */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 12px;
  min-height: 36px;
}

/* Large Button */
.btn-lg {
  padding: var(--space-3) var(--space-7);
  font-size: 15px;
}

/* Full Width Button */
.btn-full {
  width: 100%;
}

/* Secondary Signup Button — Navy outlined D4S */
.btn-secondary-signup {
  display: block;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  background: transparent;
  color: var(--brand-primary);
  border: 2px solid var(--brand-primary);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wide);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary-signup:hover {
  background: var(--brand-primary);
  color: white;
}

/* Circle X Page Exit Button — static pages */
.page-exit-btn {
  position: absolute;
  top: 50%;
  right: var(--space-6);
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  text-decoration: none;
  transition: all var(--transition);
  line-height: 1;
}

.page-exit-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  color: white;
  text-decoration: none;
}

/* Button Row */
.btn-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

/* ============================================
   FORMS
   ============================================ */

/* Form Group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label:not(.form-label) {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--brand-text-muted);
}

.form-group input[type="text"]:not(.form-input),
.form-group input[type="email"]:not(.form-input),
.form-group input[type="password"]:not(.form-input),
.form-group input[type="tel"]:not(.form-input),
.form-group input[type="url"]:not(.form-input),
.form-group textarea:not(.form-textarea),
.form-group select:not(.form-select) {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-md);
  color: var(--brand-text);
  background-color: var(--brand-surface);
  transition: all var(--transition);
}

.form-group input:not(.form-input):focus,
.form-group textarea:not(.form-textarea):focus,
.form-group select:not(.form-select):focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-group input:not(.form-input)::placeholder,
.form-group textarea:not(.form-textarea)::placeholder {
  color: var(--brand-text-placeholder);
}

/* Form Label */
.form-label {
  display: block;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--brand-text);
}

/* Form Input/Textarea/Select */
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  min-height: 44px; /* PWA: Touch target */
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--brand-text);
  background-color: var(--brand-surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

/* Dropdown arrow for select elements */
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231E3A5F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--brand-text-placeholder);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Form Row (checkbox + link) */
.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-base);
}

.form-row label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--brand-text-muted);
  cursor: pointer;
  font-weight: var(--font-normal);
  text-transform: none;
  letter-spacing: 0;
}

.form-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

.form-row a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: var(--font-medium);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
  padding: var(--space-4);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.alert-error {
  background: var(--color-error-light);
  border: 1px solid var(--color-error-light);
  color: var(--color-error);
}

.alert-success {
  background: var(--color-success-light);
  border: 1px solid var(--color-success-light);
  color: var(--color-success);
}

.alert-warning {
  background: var(--color-warning-light);
  border: 1px solid var(--color-warning-light);
  color: var(--color-warning);
}

.alert-info {
  background: var(--color-info-light);
  border: 1px solid var(--color-info-light);
  color: var(--color-info);
}

/* ============================================
   MODALS → defined in healist-modals.css
   ============================================ */

/* ============================================
   SPINNER
   ============================================ */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   PAGE SECTION TITLES — Navy Gradient Header
   ============================================ */

.page-section-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin: 0;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
  letter-spacing: -0.01em;
}

/* ============================================
   CARDS — D4S Structural Standard
   ============================================ */

.card {
  background: var(--brand-surface);
  border-radius: 12px;
  border: 1px solid var(--brand-border);
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.06);
  overflow: hidden;
  margin-bottom: var(--space-5);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(30, 58, 95, 0.10);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 2px solid var(--brand-border);
  background: var(--brand-surface-elevated);
}

.card-header h3,
.card-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-primary-dark);
  margin: 0;
}

.card-body {
  padding: 20px 24px;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stat-card {
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  border: 1px solid var(--brand-border);
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--brand-text-muted);
  margin-bottom: var(--space-2);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--font-semibold);
  color: var(--brand-text);
  margin-bottom: var(--space-1);
}

.stat-change {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.stat-change.positive { color: var(--color-success); }
.stat-change.negative { color: var(--color-error); }

/* ============================================
   DATA TABLE / LIST
   ============================================ */

.data-table {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.data-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--brand-surface-elevated);
  border-radius: var(--radius);
}

.data-icon {
  width: 40px;
  height: 40px;
  background: var(--data-icon-bg);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.data-info {
  flex: 1;
  min-width: 0;
}

.data-title {
  font-weight: var(--font-semibold);
  color: var(--brand-text);
  margin-bottom: 2px;
}

.data-subtitle {
  font-size: var(--text-sm);
  color: var(--brand-text-muted);
}

.data-value {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  color: var(--brand-text);
}

.data-unit {
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  color: var(--brand-text-muted);
  margin-left: 2px;
}

/* ============================================
   QUICK ACTIONS
   ============================================ */

.quick-action {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.quick-action:hover {
  background: var(--brand-surface-elevated);
  border-color: var(--brand-border);
}

.quick-action-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--action-icon-gradient-start) 0%, var(--action-icon-gradient-end) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  flex-shrink: 0;
}

.quick-action-text {
  flex: 1;
}

.quick-action-title {
  font-weight: var(--font-semibold);
  color: var(--brand-text);
  margin-bottom: 2px;
}

.quick-action-desc {
  font-size: var(--text-sm);
  color: var(--brand-text-muted);
}

/* ============================================
   DIVIDERS
   ============================================ */

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  color: var(--brand-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--brand-border);
}

hr {
  border: none;
  border-top: 1px solid var(--brand-border);
  margin: var(--space-5) 0;
}

/* ============================================
   HIGHLIGHT STATS (Media Page)
   ============================================ */

.highlight-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--brand-border);
}

.stat-item {
  text-align: center;
}

.stat-item .stat-value {
  font-size: var(--text-4xl);
  color: var(--brand-primary);
  margin-bottom: var(--space-1);
}

.stat-item .stat-label {
  margin-bottom: 0;
}

/* ============================================
   RESPONSIVE COMPONENTS
   ============================================ */

@media (max-width: 768px) {
  .highlight-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .highlight-stats {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   PRESS RELEASES (Media Page)
   ============================================ */

.press-section {
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  padding: var(--space-10);
  margin-bottom: var(--space-8);
  border: 1px solid var(--brand-border);
}

.press-section h2 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  color: var(--brand-primary-dark);
  margin-bottom: var(--space-6);
}

.press-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.press-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-6);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--brand-border);
}

.press-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.press-item:first-child {
  padding-top: 0;
}

.press-date {
  flex-shrink: 0;
  width: 80px;
  font-size: var(--text-sm);
  color: var(--brand-secondary);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.press-content {
  flex: 1;
}

.press-title {
  font-weight: var(--font-semibold);
  color: var(--brand-primary-dark);
  margin-bottom: var(--space-1);
  line-height: 1.4;
}

.press-excerpt {
  font-size: var(--text-sm);
  color: var(--brand-text-muted);
  line-height: 1.6;
}

.press-link {
  flex-shrink: 0;
  color: var(--brand-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

.press-link:hover {
  color: var(--brand-secondary);
}

/* ============================================
   MEDIA ROOM
   ============================================ */

.media-room-body {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
  min-height: 100vh;
  padding: var(--space-10) var(--space-5);
}

.media-room-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  padding: var(--space-12);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.media-room-header {
  text-align: center;
  margin-bottom: var(--space-12);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--brand-border);
}

.media-room-header .logo-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-6);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.media-room-header .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-room-header h1 {
  font-family: var(--font-heading);
  color: var(--brand-primary-dark);
  font-size: var(--text-4xl);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-2);
}

.media-room-header .tagline {
  color: var(--brand-text-muted);
  font-size: var(--text-base);
  font-weight: var(--font-light);
}

/* Featured Download */
.featured-download {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-light) 100%);
  color: var(--brand-text-light);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-10);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.featured-download .featured-icon {
  font-size: 48px;
}

.featured-download .featured-content {
  flex: 1;
}

.featured-download h3 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-2);
  color: white;
}

.featured-download p {
  opacity: 0.9;
  font-size: var(--text-sm);
}

/* Download Grid */
.download-section {
  margin-bottom: var(--space-10);
}

.download-section h2 {
  font-family: var(--font-heading);
  color: var(--brand-primary-dark);
  font-size: var(--text-2xl);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--brand-secondary);
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-5);
}

.download-card {
  background: var(--brand-surface-elevated);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  text-align: center;
  transition: all 0.2s;
  border: 1px solid var(--brand-border);
}

.download-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  border-color: var(--brand-secondary);
}

.download-card .icon-preview {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.download-card .icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.download-card .name {
  font-weight: var(--font-semibold);
  color: var(--brand-primary-dark);
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
}

.download-card .size {
  color: var(--brand-text-muted);
  font-size: var(--text-xs);
  margin-bottom: var(--space-4);
}

/* Brand Colors Grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-4);
}

.color-card {
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--brand-border);
}

.color-swatch {
  height: 80px;
}

.color-info {
  padding: var(--space-3);
}

.color-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--brand-primary-dark);
}

.color-hex {
  font-size: var(--text-xs);
  color: var(--brand-text-muted);
  font-family: var(--font-mono);
}

/* Partner Grid */
.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
}

.partner-card {
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--brand-border);
  padding: var(--space-5) var(--space-4);
  text-align: center;
  transition: box-shadow var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  gap: var(--space-2);
}

.partner-card:hover {
  border-color: var(--brand-secondary);
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.1);
}

.partner-card img {
  max-height: 40px;
  max-width: 120px;
  object-fit: contain;
}

.partner-name {
  font-family: var(--font-body);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--brand-primary-dark);
}

.partner-role {
  font-size: var(--text-xs);
  color: var(--brand-text-muted);
  line-height: 1.3;
}

/* Media Room Contact */
.media-room-contact {
  text-align: center;
  padding-top: var(--space-8);
  border-top: 1px solid var(--brand-border);
  margin-top: var(--space-10);
}

.media-room-contact p {
  color: var(--brand-text-muted);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

.media-room-contact a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: var(--font-medium);
}

.media-room-contact a:hover {
  color: var(--brand-secondary);
}

/* Media Room Footer */
.media-room-footer {
  text-align: center;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--brand-border);
}

.media-room-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-3);
}

.media-room-footer .footer-links a {
  color: var(--brand-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
}

.media-room-footer .footer-links a:hover {
  color: var(--brand-primary);
}

.media-room-footer .footer-copyright {
  color: var(--brand-text-muted);
  font-size: var(--text-xs);
}

/* ============================================
   PRESS/MEDIA RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .press-item {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .press-date {
    width: auto;
  }
  
  .press-link {
    margin-top: var(--space-2);
  }
  
  .media-room-container {
    padding: var(--space-8) var(--space-6);
  }
  
  .featured-download {
    flex-direction: column;
    text-align: center;
  }
  
  .download-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .download-grid {
    grid-template-columns: 1fr;
  }

  .partner-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   OBJECTIVE/ITEM CARDS — D4S Sub-Card Standard
   ============================================ */

.objective-item,
.prescription-item,
.provider-item {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-left: 4px solid var(--brand-primary);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 0 16px 12px 16px;
  box-shadow: 0 1px 4px rgba(30, 58, 95, 0.06);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.objective-item:hover,
.prescription-item:hover,
.provider-item:hover {
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.10);
  border-left-color: var(--brand-primary-light);
}

.objective-item:first-child,
.prescription-item:first-child,
.provider-item:first-child {
  margin-top: 16px;
}

.objective-item:last-child,
.prescription-item:last-child,
.provider-item:last-child {
  margin-bottom: 16px;
}

/* Direct child content in cards without .card-body wrapper */
.card > p {
  padding: var(--space-4) var(--space-5);
  margin: 0;
  font-family: var(--font-body);
  color: var(--brand-text-muted);
  font-size: var(--text-sm);
}

/* Card title without card-header wrapper (e.g., Physicians/Providers, Trainers) */
.card > .card-title {
  padding: 16px 24px 0;
  margin: 0;
}

/* Button row inside card without card-header wrapper */
.card > .btn-row,
.card > .exf-buttonRow {
  padding: 0 24px;
}

.objective-item h4,
.prescription-item h4,
.provider-item h4 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-primary-dark);
  margin: 0 0 6px 0;
}

.objective-item p,
.prescription-item p,
.provider-item p {
  font-size: 13px;
  color: var(--brand-text-muted);
  margin: 4px 0;
  line-height: 1.5;
}

.objective-content,
.prescription-content,
.provider-content {
  margin-bottom: 12px;
}

.objective-actions,
.prescription-actions,
.provider-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================
   PREFERENCE ITEMS — D4S Sub-Card Standard
   ============================================ */

.preference-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  margin: 12px 16px;
  background: var(--brand-surface);
  border-radius: 8px;
  border: 1px solid var(--brand-border);
  border-left: 4px solid var(--brand-primary);
  box-shadow: 0 1px 4px rgba(30, 58, 95, 0.06);
  transition: box-shadow 0.2s ease;
}

.preference-item:hover {
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.10);
}

.preference-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.preference-content span:first-child {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--brand-primary-dark);
}

.preference-meta {
  font-size: 12px;
  color: var(--brand-text-muted);
  margin-top: 4px;
}

.preference-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

/* ============================================
   RECIPE META
   Migrated from styles.css → Design 4 tokens
   ============================================ */

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  font-size: 12px;
  color: var(--brand-text-muted);
  margin-top: 6px;
}

/* ============================================
   PAYMENT/ACCOUNT PLACEHOLDERS
   Migrated from styles.css → Design 4 tokens
   ============================================ */

.account-placeholder,
.payment-placeholder {
  padding: var(--space-6);
  text-align: center;
  color: var(--brand-text-muted);
}

.account-placeholder ul,
.payment-placeholder ul {
  text-align: left;
  max-width: 300px;
  margin: var(--space-4) auto;
}

.account-placeholder li,
.payment-placeholder li {
  margin-bottom: var(--space-2);
}

/* ============================================
   AI CHAT
   Migrated from styles.css → Design 4 tokens
   ============================================ */

.ai-chat-container {
  padding: var(--space-4);
}

.ai-chat-input,
.ai-chat-response {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-body);
  line-height: 1.5;
}

.ai-chat-response {
  background-color: var(--brand-surface-elevated);
  color: var(--brand-text);
}

.ai-chat-attribution {
  font-size: var(--text-xs);
  color: var(--brand-text-muted);
  margin-top: var(--space-1);
  text-align: left;
  font-style: italic;
}

/* ============================================
   FILE UPLOAD
   Migrated from styles.css → Design 4 tokens
   ============================================ */

.file-upload-area {
  border: 2px dashed var(--brand-border);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  text-align: center;
  transition: border-color var(--transition);
  cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: var(--brand-primary);
  background-color: var(--brand-surface-elevated);
}

.file-upload-input {
  display: none;
}

.file-upload-text {
  color: var(--brand-text-muted);
  margin-bottom: var(--space-2);
}

.file-list {
  list-style: none;
  margin-top: var(--space-4);
}

.file-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2);
  background: var(--brand-surface-elevated);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
}

/* ============================================
   MEDICAL FILE ACTIONS
   Migrated from styles.css → Design 4 tokens
   ============================================ */

.medical-file-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-shrink: 0;
  min-width: 80px;
}

@media (min-width: 768px) {
  .medical-file-actions {
    flex-direction: row;
    min-width: auto;
  }
}

/* ============================================
   TAB BAR — Contained Gray Strip (Nav Restructure)
   ============================================ */
.tab-bar {
  display: flex;
  background: var(--brand-surface-elevated);
  padding: var(--space-1) var(--space-4);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-item {
  padding: var(--space-3) var(--space-5);
  font-size: 13.5px;
  font-family: var(--font-body);
  color: var(--brand-text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all var(--transition-fast);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

.tab-item:hover {
  color: var(--brand-primary);
  background: rgba(255, 255, 255, 0.6);
}

.tab-item.active,
.tab-item--active {
  color: var(--brand-primary);
  font-weight: var(--font-semibold);
  background: white;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.04);
}

@media (max-width: 640px) {
  .tab-item { padding: 10px 14px; font-size: 12px; }
}

/* ============================================
   PILL TOOLBAR — Quick Action Tools (Nav Restructure)
   ============================================ */
.pill-toolbar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.pill-toolbar::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: none;
  background: var(--brand-primary);
  color: white;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  font-weight: var(--font-medium);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.pill-btn:hover {
  background: var(--brand-primary-light);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.pill-btn-icon {
  font-size: var(--text-base);
}

/* ─── 6-Section Page Layout (Flexbox Scroll Architecture) ─── */

/* Page root — flex column filling main-content */
.page-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;       /* critical: allow flex shrink below content */
  overflow: hidden;
}

/* Sections 2-4: Fixed header + nav (NEVER scrolls vertically) */
.page-sticky-nav {
  flex-shrink: 0;
  background: var(--brand-surface-elevated);
  padding-top: var(--space-6);
}

.page-nav-bar {
  flex-shrink: 0;
  background: var(--brand-surface-elevated);
}

/* Section 5: Scrollable content area */
.page-scroll-content {
  flex: 1;
  min-height: 0;         /* critical: allow flex shrink */
  overflow-y: auto;      /* THIS is the only vertical scroll */
  padding-top: var(--space-6);
  padding-bottom: var(--space-8);
  /* Hidden scrollbar — all browsers */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.page-scroll-content::-webkit-scrollbar {
  display: none;
}