/* IM/WM User Guide Styling - Clean Version */

/* Theme variables */
:root {
  --userguide-primary: #122372;
  --userguide-primary-hover: #123372;
  --userguide-text-light: #ffffff;
  --userguide-text-dark: #333333;
  --userguide-border-radius: 12px;
}

/* Base Shepherd tour styling */
.custom-shepherd {
  border-radius: var(--userguide-border-radius);
  max-width: calc(100vw - 24px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #ffffff;
  z-index: 26000 !important;
  /* Mobile viewport constraint - prevent dialog from extending beyond screen */
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

/* Flex layout on content container (not step wrapper) */
.custom-shepherd .shepherd-content {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
}

/* Force hidden steps to disappear - rely on [hidden] attribute only */
.shepherd-element[hidden],
.custom-shepherd[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Header styling */
.custom-shepherd .shepherd-header,
.shepherd-has-title .shepherd-content .shepherd-header {
  background: var(--userguide-primary);
  color: var(--userguide-text-light);
  padding: 16px 20px;
  border-radius: 10px 10px 0 0;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: center;
  flex-shrink: 0;
}

/* Title styling */
.shepherd-title {
  color: var(--userguide-text-light);
  display: flex;
  flex: 1 0 auto;
  font-size: 1.5rem;
  margin: 0;
  padding: 0;
  text-align: center;
  justify-content: center;
}

/* Progress Bar Container */
.shepherd-progress-container {
  background: #ffffff;
  border-radius: 8px;
  margin: 15px 5px 5px 5px;
  position: relative;
  flex-shrink: 0;
}

/* Step Counter Text */
.shepherd-step-counter {
  color: #888888;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
}

/* Progress Bar Track */
.shepherd-progress-track {
  background: #e0e0e0;
  border-radius: 4px;
  height: 6px;
  margin: 0 16px;
  overflow: hidden;
  position: relative;
}

/* Progress Bar Fill */
.shepherd-progress-fill {
  background: var(--userguide-primary);
  border-radius: 4px;
  height: 100%;
  width: 0%;
}

/* Content area */
.custom-shepherd .shepherd-text {
  padding: 15px;
  line-height: 1.5;
  color: var(--userguide-text-dark);
  font-size: 1rem;
  /* Make content scrollable on mobile with iOS support */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  flex: 1 1 auto;
  min-height: 0;
}

/* Button styling */
.custom-shepherd .shepherd-button {
  min-height: 44px;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0 4px;
  border: none;
}

.custom-shepherd .shepherd-button-primary {
  background: var(--userguide-primary);
  color: var(--userguide-text-light);
}

.custom-shepherd .shepherd-button-primary:hover {
  background: var(--userguide-primary-hover);
}

.custom-shepherd .shepherd-button-secondary {
  background: transparent;
  color: var(--userguide-primary);
  border: 1px solid var(--userguide-primary);
}

.custom-shepherd .shepherd-button-secondary:hover {
  background: var(--userguide-primary);
  color: var(--userguide-text-light);
}

/* Footer/button container */
.custom-shepherd .shepherd-footer {
  padding: 10px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #ffffff;
  flex-shrink: 0;
  /* iOS safe area support */
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* Cancel/close icon styling */
.custom-shepherd .shepherd-cancel-icon,
.shepherd-has-title .shepherd-content .shepherd-cancel-icon {
  color: var(--userguide-text-light);
  padding: 8px;
  border-radius: 50%;
}

.custom-shepherd .shepherd-cancel-icon:hover,
.shepherd-has-title .shepherd-content .shepherd-cancel-icon:hover {
  color: var(--userguide-text-dark);
}

/* Remove Shepherd arrows completely */
.shepherd-arrow,
.custom-shepherd .shepherd-arrow {
  display: none !important;
}

/* Modal overlay */
.shepherd-modal-overlay-container {
  z-index: 25000 !important;
  background-color: rgba(0, 0, 0, 0.4);
}

/* SAP UI5 Dialog Theming */

/* Emphasized Buttons */
.sapMBtn[data-sap-ui*="Emphasized"] .sapMBtnInner,
.sapMBtnEmphasized .sapMBtnInner,
span.sapMBtnInner.sapMBtnEmphasized {
  background-color: var(--userguide-primary) !important;
  border-color: var(--userguide-primary) !important;
  color: var(--userguide-text-light) !important;
  border-radius: var(--userguide-border-radius) !important;
}

.sapMBtn[data-sap-ui*="Emphasized"]:hover .sapMBtnInner,
.sapMBtnEmphasized:hover .sapMBtnInner,
span.sapMBtnInner.sapMBtnEmphasized:hover {
  background-color: var(--userguide-primary-hover) !important;
  border-color: var(--userguide-primary-hover) !important;
}

/* Default/Secondary Buttons */
.sapMBtn[data-sap-ui*="Default"] .sapMBtnInner,
.sapMBtnDefault .sapMBtnInner,
span.sapMBtnInner.sapMBtnDefault {
  background-color: #eff4f9 !important;
  color: var(--userguide-primary) !important;
  border-radius: var(--userguide-border-radius) !important;
}

/* SAP Dialog Headers */
.sapMDialogTitle,
.sapMDialog .sapMBar,
.sapMDialog .sapMDialogTitle {
  background-color: var(--userguide-primary) !important;
  color: var(--userguide-text-light) !important;
  border-radius: 10px 10px 0 0 !important;
  font-weight: 600 !important;
  border: none !important;
  text-align: center !important;
}

/* Dialog Container */
.sapMDialog {
  border-radius: 10px !important;
  overflow: hidden !important;
  border: none !important;
}

/* Dialog Header Container */
.sapMDialog .sapMBarPH,
.sapMDialog .sapMBarContainer {
  background-color: var(--userguide-primary) !important;
  border: none !important;
  border-radius: 10px 10px 0 0 !important;
}

/* Dialog Footer */
.sapMDialog .sapMIBar.sapMFooter-CTX {
  background-color: var(--userguide-text-light) !important;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
  .shepherd-progress-container {
    margin: 8px 16px 12px 16px;
    padding: 6px 0;
  }

  .shepherd-step-counter {
    font-size: 0.8rem;
    margin-bottom: 6px;
  }

  .shepherd-progress-track {
    margin: 0 12px;
    height: 5px;
  }

  .custom-shepherd {
    /* Use dvh for reliable mobile viewport height */
    max-height: calc(100dvh - 24px);
    margin: 12px;
    max-width: calc(100vw - 24px);
  }

  .custom-shepherd .shepherd-header {
    padding: 12px 16px;
    font-size: 1rem;
  }

  .custom-shepherd .shepherd-text {
    padding: 16px;
    font-size: 0.9rem;
    /* Scrolling handled by flex layout - no hardcoded max-height */
  }

  .custom-shepherd .shepherd-footer {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    flex-direction: row;
  }

  .custom-shepherd .shepherd-button {
    width: 100%;
    margin: 4px 0;
    min-height: 48px;
  }
}

/* Tablet responsiveness */
@media (min-width: 481px) and (max-width: 768px) {
  .custom-shepherd {
    max-width: 400px;
  }
}

/* Desktop responsiveness */
@media (min-width: 769px) {
  .custom-shepherd {
    max-width: 450px;
  }

  .custom-shepherd .shepherd-footer {
    flex-direction: row;
  }

  .custom-shepherd .shepherd-button {
    width: auto;
    margin: 0 4px;
  }
}

/* Focus styling for accessibility */
.custom-shepherd .shepherd-button:focus {
  outline: 2px solid var(--userguide-primary);
  outline-offset: 2px;
}
