/* ==========================================================================
   AnesFlow Help & Manual Pages Layout Stylesheet
   ========================================================================== */

/* Central de Ajuda - Design Hub */
.help-hero {
  background: linear-gradient(135deg, var(--color-primary-50), rgba(59, 130, 246, 0.05));
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  margin-bottom: var(--space-8);
  border: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .help-hero {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.6), rgba(30, 41, 59, 0.2));
  border-color: var(--color-border);
}

.help-hero__icon {
  font-size: var(--text-4xl);
  background: var(--color-surface);
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.help-hero__content h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 var(--space-1);
  letter-spacing: -0.02em;
}

.help-hero__content p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--text-base);
  line-height: 1.5;
}

/* Grid Layout */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}

@media (max-width: 768px) {
  .help-grid {
    grid-template-columns: 1fr;
  }
  .help-hero {
    flex-direction: column;
    text-align: center;
    padding: var(--space-6) var(--space-4);
    gap: var(--space-4);
  }
}

/* Premium Help Card */
.help-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
  text-decoration: none !important;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.help-card * {
  text-decoration: none !important;
}

.help-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent-color);
  transition: width var(--transition-fast);
}

.help-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -8px var(--accent-shadow), var(--shadow-md);
  border-color: var(--accent-color);
  text-decoration: none !important;
}

.help-card:hover * {
  text-decoration: none !important;
}

.help-card:hover::before {
  width: 6px;
}

/* Card Header */
.help-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.help-card__icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  color: var(--badge-text);
  transition: transform var(--transition-fast);
}

.help-card:hover .help-card__icon-wrapper {
  transform: scale(1.08);
}

.help-card__title-area {
  flex: 1;
}

.help-card__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 2px;
  text-transform: none;
}

.help-card__subtitle {
  font-size: var(--text-xs);
  color: var(--badge-text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

/* Card Body */
.help-card__description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--space-4);
}

/* Caso de Uso - Styled Box */
.help-card__usecase {
  background: var(--usecase-bg);
  border-left: 3px solid var(--accent-color);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: var(--space-4);
}

.help-card__usecase-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.help-card__usecase-text {
  font-size: var(--text-sm);
  color: var(--color-text);
  margin: 0;
  line-height: 1.5;
}

/* Mapeamento */
.help-card__mapping {
  margin-bottom: var(--space-5);
}

.help-card__mapping-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-2);
}

.help-card__mapping-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.help-card__path-badge {
  background: var(--color-body);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
}

.help-card__path-badge--active {
  background: var(--badge-bg);
  color: var(--badge-text);
  border-color: var(--badge-border);
}

.help-card__path-arrow {
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: bold;
  user-select: none;
}

/* Card Footer */
.help-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--space-4);
  margin-top: auto;
}

.help-card__action-text {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition-fast);
}

.help-card:hover .help-card__action-text {
  gap: 8px;
}

.help-card__arrow {
  font-size: 16px;
  line-height: 1;
}

/* Dynamic Themes per Profile */
/* Violet (Gestor) */
.help-card--violet, .help-profile-view--violet {
  --accent-color: #8b5cf6;
  --accent-shadow: rgba(139, 92, 246, 0.15);
  --badge-bg: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(139, 92, 246, 0.15));
  --badge-border: rgba(139, 92, 246, 0.2);
  --badge-text: #6d28d9;
  --usecase-bg: rgba(139, 92, 246, 0.03);
}
:root[data-theme="dark"] .help-card--violet, :root[data-theme="dark"] .help-profile-view--violet {
  --accent-color: #a78bfa;
  --accent-shadow: rgba(167, 139, 250, 0.25);
  --badge-bg: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(167, 139, 250, 0.25));
  --badge-border: rgba(167, 139, 250, 0.35);
  --badge-text: #c084fc;
  --usecase-bg: rgba(167, 139, 250, 0.06);
}

/* Blue (Anestesiologista) */
.help-card--blue, .help-profile-view--blue {
  --accent-color: #3b82f6;
  --accent-shadow: rgba(59, 130, 246, 0.15);
  --badge-bg: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.15));
  --badge-border: rgba(59, 130, 246, 0.2);
  --badge-text: #1d4ed8;
  --usecase-bg: rgba(59, 130, 246, 0.03);
}
:root[data-theme="dark"] .help-card--blue, :root[data-theme="dark"] .help-profile-view--blue {
  --accent-color: #60a5fa;
  --accent-shadow: rgba(96, 165, 250, 0.25);
  --badge-bg: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.25));
  --badge-border: rgba(96, 165, 250, 0.35);
  --badge-text: #93c5fd;
  --usecase-bg: rgba(96, 165, 250, 0.06);
}

/* Emerald (Farmacêutico) */
.help-card--emerald, .help-profile-view--emerald {
  --accent-color: #10b981;
  --accent-shadow: rgba(16, 185, 129, 0.15);
  --badge-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(16, 185, 129, 0.15));
  --badge-border: rgba(16, 185, 129, 0.2);
  --badge-text: #047857;
  --usecase-bg: rgba(16, 185, 129, 0.03);
}
:root[data-theme="dark"] .help-card--emerald, :root[data-theme="dark"] .help-profile-view--emerald {
  --accent-color: #34d399;
  --accent-shadow: rgba(52, 211, 153, 0.25);
  --badge-bg: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(52, 211, 153, 0.25));
  --badge-border: rgba(52, 211, 153, 0.35);
  --badge-text: #34d399;
  --usecase-bg: rgba(52, 211, 153, 0.06);
}

/* Rose (Cirurgião) */
.help-card--rose, .help-profile-view--rose {
  --accent-color: #f43f5e;
  --accent-shadow: rgba(244, 63, 94, 0.15);
  --badge-bg: linear-gradient(135deg, rgba(244, 63, 94, 0.08), rgba(244, 63, 94, 0.15));
  --badge-border: rgba(244, 63, 94, 0.2);
  --badge-text: #be123c;
  --usecase-bg: rgba(244, 63, 94, 0.03);
}
:root[data-theme="dark"] .help-card--rose, :root[data-theme="dark"] .help-profile-view--rose {
  --accent-color: #fb7185;
  --accent-shadow: rgba(251, 113, 133, 0.25);
  --badge-bg: linear-gradient(135deg, rgba(251, 113, 133, 0.15), rgba(251, 113, 133, 0.25));
  --badge-border: rgba(251, 113, 133, 0.35);
  --badge-text: #fda4af;
  --usecase-bg: rgba(251, 113, 133, 0.06);
}

/* Amber (Auditor) */
.help-card--amber, .help-profile-view--amber {
  --accent-color: #f59e0b;
  --accent-shadow: rgba(245, 158, 11, 0.15);
  --badge-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(245, 158, 11, 0.15));
  --badge-border: rgba(245, 158, 11, 0.2);
  --badge-text: #b45309;
  --usecase-bg: rgba(245, 158, 11, 0.03);
}
:root[data-theme="dark"] .help-card--amber, :root[data-theme="dark"] .help-profile-view--amber {
  --accent-color: #fbbf24;
  --accent-shadow: rgba(251, 191, 36, 0.25);
  --badge-bg: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(251, 191, 36, 0.25));
  --badge-border: rgba(251, 191, 36, 0.35);
  --badge-text: #fde047;
  --usecase-bg: rgba(251, 191, 36, 0.06);
}

/* ==========================================================================
   Help Profile / Show Page Styles
   ========================================================================== */

/* Navigation / Breadcrumbs */
.help-nav-header {
  margin-bottom: var(--space-6);
}

.help-breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.help-breadcrumbs a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.help-breadcrumbs a:hover {
  text-decoration: underline;
}

.help-breadcrumbs__separator {
  color: var(--color-text-secondary);
  user-select: none;
}

/* Profile Banner */
.help-profile-banner {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--accent-color);
}

@media (max-width: 768px) {
  .help-profile-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
  .help-profile-banner .btn {
    width: 100%;
    text-align: center;
  }
}

.help-profile-banner__meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.help-profile-banner__icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--badge-text);
  flex-shrink: 0;
}

.help-profile-banner__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 2px;
}

.help-profile-banner__description {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

/* Permissions Section */
.help-permissions-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-sm);
}

.help-permissions-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.help-permissions-icon {
  font-size: 24px;
}

.help-permissions-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.help-permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.help-permission-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--color-body);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.help-permission-item:hover {
  border-color: var(--accent-color);
  transform: translateX(2px);
}

.help-permission-check {
  background: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  flex-shrink: 0;
}

.help-permission-text {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.5;
  margin: 0;
}

/* Workflows */
.help-workflows-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.help-workflow-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.help-workflow-header {
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: var(--space-3);
}

.help-workflow-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

/* Mermaid Diagram Container */
.help-mermaid-container {
  background: var(--color-body);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.help-mermaid-title-bar {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
}

.mermaid {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Timeline Steps */
.help-timeline {
  position: relative;
  padding-left: var(--space-8);
  margin-top: var(--space-4);
}

.help-timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: var(--space-4);
  bottom: var(--space-4);
  width: 2px;
  background: var(--color-border);
}

.help-timeline-item {
  position: relative;
  margin-bottom: var(--space-4);
}

.help-timeline-item:last-child {
  margin-bottom: 0;
}

.help-timeline-number {
  position: absolute;
  left: -33px;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--accent-color, var(--color-primary-500));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: bold;
  border: 2px solid var(--color-surface);
  box-shadow: var(--shadow-sm);
  z-index: 1;
}

.help-timeline-content {
  background: var(--color-body);
  border: 1px solid var(--color-border-light);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-fast);
}

.help-timeline-item:hover .help-timeline-content {
  border-color: var(--color-border);
}

.help-timeline-text {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.6;
}

/* Footer Actions */
.help-footer-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-8);
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--space-6);
}

@media (max-width: 576px) {
  .help-footer-actions {
    flex-direction: column;
  }
  .help-footer-actions .btn {
    width: 100%;
    text-align: center;
  }
}



/* Overrides for Mermaid diagrams styling in dynamic light/dark modes */
.mermaid svg {
  background-color: transparent !important;
  color: var(--color-text) !important;
  max-width: 100%;
}

.mermaid svg .node rect,
.mermaid svg .node circle,
.mermaid svg .node polygon {
  fill: var(--color-surface) !important;
  stroke: var(--accent-color, var(--color-primary-500)) !important;
  stroke-width: 2px !important;
}

.mermaid svg .node .label,
.mermaid svg .node .nodeLabel,
.mermaid svg .node .nodeText,
.mermaid svg .nodeText,
.mermaid svg .label,
.mermaid svg text {
  color: var(--color-text) !important;
  fill: var(--color-text) !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
}

.mermaid svg .edgePath .path {
  stroke: var(--color-text-secondary) !important;
  stroke-width: 2px !important;
}

.mermaid svg .edgeLabel rect {
  fill: var(--color-body) !important;
}

.mermaid svg .edgeLabel span {
  color: var(--color-text-secondary) !important;
  font-family: var(--font-sans) !important;
}

.mermaid svg .marker {
  fill: var(--color-text-secondary) !important;
  stroke: var(--color-text-secondary) !important;
}
