:root {
  /* Brand / primary */
  --ukhls-primary: #2d6ec1;
  --ukhls-primary-light: #2d6ec11f;
  --ukhls-primary-dark: #1f4f8a;

  /* Neutrals */
  --ukhls-muted: #6c757d;
  --ukhls-border: #ccc;
  --ukhls-bg-soft: #f8f9fa;

  /* States */
  --ukhls-focus-ring: rgba(45, 110, 193, 0.25);
}



/* =========================================================
   CODE CREATOR: Code output area
   ========================================================= */

/* General textarea styles */
textarea.copytext {
  border: none; /* Combine border-style and border-color */
  outline: none;
  resize: none;
  width: 100%;
  font-size: 18px;
  padding: 10px;
  background: transparent; /* Use transparent background */
  overflow: auto; /* Ensure scrollbars appear when needed */
}

/* Specific styling for the .code textarea */
textarea.copytext.code {
  max-height: 600px; /* Limit height to 600px */
  font-size: 16px; /* Override font size to 16px for .code class */
  font-family: Arial, sans-serif; /* Use Arial font, fallback to sans-serif */
}

/* Preformatted text block styling */
pre {
  clear: both; /* Ensure content doesn't overlap with floats */
}

/* Styling for code within preformatted text */
pre code {
  white-space: pre-wrap; /* Allow text to wrap inside <code> */
}


/* =========================================================
   FAVOURITES: Saved variables list layout + controls
   ========================================================= */

#favourites-list-ul li {
  display: flex;
  align-items: flex-start; /* allow label underneath without odd vertical centring */
  gap: .5rem;
  overflow: visible; /* prevents clipping during hover transforms */
}

/* Wrapper for title + label column */
.favourite-meta {
  flex: 1;
  min-width: 0; /* prevents odd overflow in flex */
}

.favourite-meta > a {
  display: inline-block;
  font-weight: 600;
  line-height: 1.3;
}

.favourite-label {
  display: block;
  font-size: .875rem;
  line-height: 1.3;
  color: #6c757d; /* Bootstrap muted */
  margin-top: .125rem;
}

/* Remove control: fixed-size slot so it never pushes layout */
.remove-favourite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 1.75rem;
  padding: 0;
  line-height: 1;
  text-decoration: none;
}

/* Remove icon behaviour */
.remove-favourite .bi {
  display: inline-block;
  font-size: 1.1rem;
  transform-origin: 50% 50%;
  transition: transform 120ms ease, opacity 120ms ease;
  opacity: .85;
}

.remove-favourite:hover .bi,
.remove-favourite:focus-visible .bi {
  transform: scale(1.2);
  opacity: 1;
}

/* Legacy/alternate remove icon (kept as comment)
.remove-favourite::after {
  content: '❌';
  display: inline-block;
  font-size: 12px;
  float: right;
}
*/


/* =========================================================
   FAVOURITES: Drawer container + behaviour
   ========================================================= */

.favourites-container {
  position: fixed;
  bottom: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  transition: transform 0.3s ease;
  box-shadow: 0 -4px 8px rgba(0,0,0,0.1);
  z-index: 150; /* above normal content */
}

/* Collapsed: only header visible (slide container mostly off screen) */
.favourites-container.collapsed {
  transform: translateY(calc(100% - 60px));
  cursor: pointer;
}

/* Expanded: container fully visible */
.favourites-container.expanded {
  transform: translateY(0);
  cursor: default;
}

/* Header styling (click target) */
.favourites-header {
  user-select: none;
  padding: 10px 15px;
  background-color: #007bff;
  font-weight: 600;
  border-top-left-radius: 0.25rem;
  border-top-right-radius: 0.25rem;
}

#favourites-header .handle-icon {
  line-height: 1rem;
}

/* Save button layout */
.save-favourite,
#save-to-favourites {
  display: block;
  width: 100%;
  float: none;
  margin-bottom: 1rem; /* optional spacing */
}

/* At md and above: float right, shrink to fit */
@media (min-width: 768px) {
  .save-favourite,
  #save-to-favourites {
    float: right;
    width: auto;
    display: inline-block;
  }
}

/* On large screens: always expanded, no transform */
@media (min-width: 769px) {
  .favourites-container.cc-drawer {
    position: fixed;
    transform: translateY(-50%) translateX(calc(100% - 64px)) !important;
    top: 50%;
    right: 0;
    bottom: auto;
    width: 360px;
    max-width: 90vw;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: 1050;
  }

  .favourites-container.cc-drawer.expanded {
    transform: translateY(-50%) translateX(0) !important;
  }

  .favourites-container.cc-drawer.collapsed {
    transform: translateY(-50%) translateX(calc(100%)) !important;
  }
}


/* =========================================================
   FAVOURITES: Scroll behaviour + optional hinting
   ========================================================= */

#favourites-list-ul {
  max-height: 30vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* WebKit scrollbar cosmetics (optional) */
#favourites-list-ul::-webkit-scrollbar {
  width: 6px;
}

#favourites-list-ul::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.2);
  border-radius: 3px;
}

/* Visual hint that list is scrollable (requires positioned parent) */
.favourites-scroll-hint::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(to top, white, transparent);
  pointer-events: none;
}


/* =========================================================
   ACCESSIBILITY / UI STATE HELPERS
   ========================================================= */

/* Visually look enabled, even when disabled */
.visually-enabled:disabled {
  opacity: 1 !important;
  pointer-events: auto; /* allow pointer events if you want tooltips */
  cursor: not-allowed;  /* optional: change to pointer if you prefer */
}

/* Form is submitting / busy */
.code-creator-busy {
  opacity: 0.5;
  pointer-events: none; /* prevents clicks & changes */
  transition: opacity 0.2s ease;
}

/* Optional: keep cursor sensible */
.code-creator-busy * {
  cursor: wait;
}


/* =========================================================
   ANIMATIONS: utility classes
   ========================================================= */

@keyframes animate-bounce {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

.animate-bounce {
  animation: animate-bounce 0.4s ease-out;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

.animate-pulse {
  animation: pulse 0.4s ease-out;
}

/* Slide-up effect when modal opens */
@keyframes slideUp {
  0% {
    transform: translateY(100%); /* Start below the screen */
    opacity: 0;
  }
  100% {
    transform: translateY(0); /* End at normal position */
    opacity: 1;
  }
}

.modal.slide-up {
  animation: slideUp 0.5s ease-in-out;
}

/* Heart throb animation (used on favourites count) */
@keyframes throb-once {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(1); }
  100% { transform: scale(1); }
}

.throb-once {
  display: inline-block;
  animation: throb-once 0.6s ease-out 1;
}


/* =========================================================
   SPINNER OVERLAY: AJAX loading state
   ========================================================= */

#spinner-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  z-index: 9999;
}

/* Bootstrap spinner hidden when using custom SVG spinner */
.spinner-border {
  display: none;
}

/* Wrapper for custom spinner content */
.code-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Custom animated spinner SVG sizing */
.spinner-svg {
  width: 225px;
  height: 225px;
}


/* =========================================================
   CUSTOM RADIO UI: format + language selectors
   ========================================================= */

.custom-radio-group {
  display: flex;
  gap: 1rem; /* adds spacing between the two buttons */
}

.custom-radio-label {
  flex: 1 1 50%;
  text-align: center;
  border: 2px solid #ccc;
  padding: 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.custom-radio-input {
  display: none;
}

.custom-radio-input:checked + .custom-radio-label,
.custom-radio-label:hover {
  border-color: var(--ukhls-primary);
  background-color: var(--ukhls-primary-light); 
  color: var(--ukhls-primary);
  box-shadow: 0 0 0 0.2rem var(--ukhls-focus-ring);
}





@media (min-width: 769px) {

  .favourites-container.cc-drawer .favourites-tab {
    position: absolute;
    top: 50%;
    left: 0;

    /* Fixed attachment to drawer */
    transform: translate(-100%, -50%);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px;
    background: var(--ukhls-primary, #2d6ec1);
    border-radius: 10px 0 0 10px;

    cursor: pointer;
    user-select: none;
    z-index: 9999;

    /* Default shadow */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);

    /* Smooth motion */
    transition:
      transform 160ms ease-out,
      box-shadow 160ms ease-out;
  }

  /* Hover / keyboard focus: lift slightly + soften shadow */
  .favourites-container.cc-drawer .favourites-tab:hover,
  .favourites-container.cc-drawer .favourites-tab:focus-visible {
    transform: translate(-100%, calc(-50% - 2px)); /* lift up */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }

  .favourites-container.cc-drawer .favourites-tab .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 !important;
    pointer-events: none;
  }
}

.favourites-container.cc-drawer #favourites-header,
.favourites-container.cc-drawer #favourites-header .card-header {
  overflow: visible !important;
}

/* Make it obvious the label is clickable */
#favourites-checkboxes .form-check-label {
  cursor: pointer;
}

/* Optional: if you make the whole row clickable */
#favourites-checkboxes li {
  cursor: pointer;
}



/* =========================================================
   CODE CREATOR: Prism code block polish
   ========================================================= */

.code-creator-output .code-responsive {
  overflow: hidden;
}

.code-creator-output .generated-code-block,
.code-creator-output pre[class*="language-"] {
  max-height: 600px;
  overflow: auto;
  scrollbar-gutter: stable;
  margin-top: 0;
}

.code-creator-output .generated-code-block code,
.code-creator-output code[class*="language-"] {
  display: block;
  white-space: pre;
}

/* Prism line numbers spacing */
.code-creator-output pre.line-numbers {
  padding-left: 3.8em;
}

.code-creator-output .line-numbers .line-numbers-rows {
  pointer-events: none;
}

/* Slightly cleaner scrollbar on WebKit browsers */
.code-creator-output .generated-code-block::-webkit-scrollbar,
.code-creator-output pre[class*="language-"]::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.code-creator-output .generated-code-block::-webkit-scrollbar-thumb,
.code-creator-output pre[class*="language-"]::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

code[class*=language-], pre[class*=language-] {
  font-size: 1rem;
}