/**
 * Component Styles
 * =============================================================================
 * CSS equivalents of the OpenCoreEMR React component library
 * Mirrors: @opencoreemr/opencoreemr-react components
 */

/* ============================================================================
 * PAGE WRAPPER (PageWrapper)
 * ============================================================================ */

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Page padding patterns from React components */
.page-padding {
  padding-left: var(--container-padding-desktop);
  padding-right: var(--container-padding-desktop);
}

@media (max-width: 768px) {
  .page-padding {
    padding-left: var(--container-padding-mobile);
    padding-right: var(--container-padding-mobile);
  }
}


/* ============================================================================
 * FORM ELEMENTS
 * ============================================================================ */

.form-group {
  margin-bottom: var(--spacing-6);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-neutral-700);
}

.form-label--required::after {
  content: " *";
  color: var(--color-error);
}

.form-error {
  margin-top: var(--spacing-1);
  font-size: var(--font-size-sm);
  color: var(--color-error);
}

.form-help {
  margin-top: var(--spacing-1);
  font-size: var(--font-size-sm);
  color: var(--color-neutral-500);
}


/* ============================================================================
 * SEPARATOR (OpSeparator)
 * ============================================================================ */

.separator {
  width: 100%;
  height: 1px;
  background-color: var(--color-neutral-200);
}

.separator--dark {
  background-color: var(--color-primary-800);
  opacity: 0.5;
}


/* ============================================================================
 * LINKS (OpLink)
 * ============================================================================ */

.op-link {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.op-link:hover {
  color: var(--color-primary-600);
  text-decoration: underline;
}

.op-link--subtle {
  color: var(--color-neutral-600);
}

.op-link--subtle:hover {
  color: var(--color-primary);
}


/* ============================================================================
 * BADGES
 * ============================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-1) var(--spacing-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  border-radius: var(--border-radius-full);
}

.badge--primary {
  background-color: var(--color-primary-100);
  color: var(--color-primary-700);
}

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

.badge--warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.badge--error {
  background-color: var(--color-error-light);
  color: var(--color-error);
}


/* ============================================================================
 * ICONS (OpIcon placeholder)
 * ============================================================================ */

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--lg {
  width: 32px;
  height: 32px;
}

.icon--xl {
  width: 48px;
  height: 48px;
}

.icon--64 {
  width: 64px;
  height: 64px;
}


/* ============================================================================
 * ASPECT RATIO (OpAspectRatio)
 * ============================================================================ */

.aspect-ratio {
  position: relative;
  width: 100%;
}

.aspect-ratio::before {
  content: "";
  display: block;
  padding-top: calc(100% / (var(--aspect-ratio, 16 / 9)));
}

.aspect-ratio > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aspect-ratio--16-9 {
  --aspect-ratio: 16 / 9;
}

.aspect-ratio--4-3 {
  --aspect-ratio: 4 / 3;
}

.aspect-ratio--1-1 {
  --aspect-ratio: 1 / 1;
}

.aspect-ratio--1440-900 {
  --aspect-ratio: 1440 / 900;
}


/* ============================================================================
 * IMAGES (OpImage)
 * ============================================================================ */

.op-image {
  display: block;
  max-width: 100%;
  height: auto;
}

.op-image--rounded {
  border-radius: var(--border-radius-2xl);
}

.op-image--circle {
  border-radius: var(--border-radius-full);
}


/* ============================================================================
 * ANIMATIONS (OpAnimationPortal)
 * ============================================================================ */

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
  animation: slideUp 0.3s ease-out;
}

.animate-boing {
  animation: boing 400ms cubic-bezier(0, 1.68, 1, 0.97) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Boing animation - matches React OpAnimationPortal DefaultAppearAnimations.Boing */
@keyframes boing {
  0% {
    opacity: 0;
    transform: scale(0.25) translateY(50%) rotate(-15deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.25) translateY(25%) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0%) rotate(0deg);
  }
}


/* ============================================================================
 * LOADING STATES
 * ============================================================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-neutral-100) 25%,
    var(--color-neutral-200) 50%,
    var(--color-neutral-100) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--border-radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-neutral-200);
  border-top-color: var(--color-primary);
  border-radius: var(--border-radius-full);
  animation: spin 0.8s linear infinite;
}

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


/* ============================================================================
 * WEBSITE NAVIGATION (op-website-navigation)
 * ============================================================================ */

/**
 * Enhancements for op-website-navigation component
 * 
 * The component has minimal CSS (:host{display:contents}) and relies on
 * internal component logic for scroll effects. This CSS adds additional
 * styling to match the visual polish of ibis navigation.
 */

/* Navigation spacer - replace inline style with CSS class */
.op-website-navigation-spacer {
  height: 80px;
}

/* Ensure navigation is properly positioned and styled */
op-website-navigation {
  display: block;
  width: 100%;
}

/* Enhance the internal op-container used by navigation */
op-website-navigation op-container {
  /* Ensure smooth transitions match ibis navigation */
  transition: background-color 50ms ease, box-shadow 50ms ease;
}

/* Additional styling for better visual consistency */
op-website-navigation op-button {
  /* Ensure buttons have proper spacing and styling */
  transition: background-color 0.15s ease, color 0.15s ease;
}
