/* Randi Builder Frontend Styles */

.randi-builder-body {
  font-size: 16px;
  line-height: 1.1;
  font-family: "Montserrat", sans-serif;
  font-weight: 400;
}

.randi-builder-body * {
  box-sizing: border-box;
}

.randi-builder-content,
.randi-builder-content * {
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}
#fl-to-top {
  display: none !important;
}

.randi-builder-content {
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}

.randi-builder-content [data-randi-back-to-top] {
  position: absolute;
  z-index: 50;
  transition: opacity 0.2s ease, transform 0.2s ease;
  will-change: opacity, transform;
}

.randi-builder-content [data-randi-back-to-top][data-animate="false"] {
  transition: none;
}

.randi-builder-content [data-randi-back-to-top][data-visible="false"] {
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.randi-builder-content [data-randi-back-to-top][data-visible="true"] {
  transform: translateY(0);
}

/* Sidebar layout (configured via Template Settings) */
.randi-layout {
  display: flex;
  align-items: flex-start;
  gap: var(--randi-sidebar-gap-desktop, var(--randi-sidebar-gap, 24px));
  width: 100%;
}

.randi-layout__main {
  flex: 1 1 0;
  min-width: 0;
}

.randi-layout__sidebar {
  flex: 0 0 var(--randi-sidebar-width-desktop, 30%);
  width: var(--randi-sidebar-width-desktop, 30%);
  min-width: 240px;
}

.randi-layout--sidebar-left .randi-layout__sidebar {
  order: 0;
}

.randi-layout--sidebar-left .randi-layout__main {
  order: 1;
}

.randi-layout--sidebar-right .randi-layout__main {
  order: 0;
}

.randi-layout--sidebar-right .randi-layout__sidebar {
  order: 1;
}

@media (max-width: 1024px) {
  .randi-layout {
    gap: var(--randi-sidebar-gap-tablet, var(--randi-sidebar-gap-desktop, var(--randi-sidebar-gap, 24px)));
  }

  .randi-layout__sidebar {
    flex-basis: var(--randi-sidebar-width-tablet, var(--randi-sidebar-width-desktop, 30%));
    width: var(--randi-sidebar-width-tablet, var(--randi-sidebar-width-desktop, 30%));
    min-width: 200px;
  }
}

@media (max-width: 768px) {
  .randi-layout {
    flex-direction: column;
    gap: var(--randi-sidebar-gap-mobile, var(--randi-sidebar-gap-tablet, var(--randi-sidebar-gap-desktop, var(--randi-sidebar-gap, 24px))));
  }

  /* On mobile, sidebar must stack above main content regardless of left/right position */
  .randi-layout--sidebar-left .randi-layout__sidebar,
  .randi-layout--sidebar-right .randi-layout__sidebar,
  .randi-layout__sidebar {
    order: 0;
  }

  .randi-layout--sidebar-left .randi-layout__main,
  .randi-layout--sidebar-right .randi-layout__main,
  .randi-layout__main {
    order: 1;
  }

  .randi-layout__sidebar {
    flex-basis: auto;
    width: var(--randi-sidebar-width-mobile, 100%);
    min-width: 0;
  }
}

/* Sidebar Visibility */
@media (min-width: 1025px) {
  .randi-sidebar-hidden-desktop {
    display: none !important;
  }
}

@media (max-width: 1024px) and (min-width: 769px) {
  .randi-sidebar-hidden-tablet {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .randi-sidebar-hidden-mobile {
    display: none !important;
  }
}

/* Row & Column Layout */
.randi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.randi-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Button Styles */
.randi-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.randi-button[data-variant="solid"] {
  background-color: #319795;
  color: #ffffff;
  border-color: #319795;
}

.randi-button[data-variant="solid"]:hover {
  background-color: #2c7a7b;
  border-color: #2c7a7b;
  color: #ffffff;
}

.randi-button[data-variant="outline"] {
  background-color: transparent;
  color: #319795;
  border-color: #319795;
}

.randi-button[data-variant="outline"]:hover {
  background-color: #e6fffa;
  color: #319795;
}

/* Hero Section */
.randi-hero {
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  position: relative;
  background-size: cover;
  background-position: center;
}

.randi-hero .hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1200px;
}

/* CSS Reset for Randi Builder content */
.randi-builder-content figure,
.randi-builder-content blockquote,
.randi-builder-content dl,
.randi-builder-content dd,
.randi-builder-content h1,
.randi-builder-content h2,
.randi-builder-content h3,
.randi-builder-content h4,
.randi-builder-content h5,
.randi-builder-content h6,
.randi-builder-content hr,
.randi-builder-content p,
.randi-builder-content pre {
  margin: 0;
}

.randi-builder-content ol,
.randi-builder-content ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.randi-builder-content fieldset {
  margin: 0;
  padding: 0;
}

.randi-builder-content legend {
  padding: 0;
}

.randi-builder-content button,
.randi-builder-content input,
.randi-builder-content optgroup,
.randi-builder-content select,
.randi-builder-content textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  margin: 0;
  padding: 0;
}

/* Image Styles */
.randi-builder-content figure img {
  max-width: 100%;
  height: auto;
  display: block;
}

.randi-builder-content figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #718096;
  text-align: center;
}

/* Typography */
.randi-builder-content .randi-wysiwyg-content h1,
.randi-builder-content .randi-wysiwyg-content h2,
.randi-builder-content .randi-wysiwyg-content h3,
.randi-builder-content .randi-wysiwyg-content h4,
.randi-builder-content .randi-wysiwyg-content h5,
.randi-builder-content .randi-wysiwyg-content h6 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-weight: 500;
  line-height: 1.1;
}

.randi-builder-content .randi-wysiwyg-content h1 {
  font-size: 2.25rem;
}

.randi-builder-content .randi-wysiwyg-content h2 {
  font-size: 1.875rem;
}

.randi-builder-content .randi-wysiwyg-content h3 {
  font-size: 1.5rem;
}

.randi-builder-content .randi-wysiwyg-content p {
  margin-bottom: 1em;
  line-height: 1.6;
}

.randi-builder-content .randi-wysiwyg-content mark,
[data-randi-id] mark {
  padding: 2px 4px;
  border-radius: 3px;
  background-color: transparent;
}

.randi-builder-content .randi-wysiwyg-content strong {
  font-weight: bold;
}

.randi-builder-content .randi-wysiwyg-content em {
  font-style: italic;
}

.randi-builder-content .randi-wysiwyg-content u {
  text-decoration: underline;
}

.randi-builder-content .randi-wysiwyg-content s {
  text-decoration: line-through;
}

.randi-builder-content .randi-wysiwyg-content a {
  color: #3182ce;
  text-decoration: underline;
}

.randi-builder-content .randi-wysiwyg-content a:hover {
  color: #2b6cb0;
}

.randi-builder-content .randi-wysiwyg-content ul,
.randi-builder-content .randi-wysiwyg-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1em;
}

.randi-builder-content .randi-wysiwyg-content ul {
  list-style-type: disc;
}

.randi-builder-content .randi-wysiwyg-content ol {
  list-style-type: decimal;
}

.randi-container:not(:has(.quote-wrapper)) blockquote {
  border-left: 4px solid #e2e8f0;
  padding-left: 1rem;
  margin-left: 0;
  margin-top: 1rem;
  margin-bottom: 1rem;
  margin-right: 0;
  font-style: italic;
  color: #718096;
  display: block;
}

.randi-builder-content blockquote p {
  margin: 0;
}

.randi-builder-content blockquote p:not(:last-child) {
  margin-bottom: 0.5rem;
}

/* Global Templates */
/* Global templates should span full width; only rows inside should respect container max-width */
.randi-global-template {
  width: 100% !important;
  max-width: none !important;
  margin: 0 0 2rem 0;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.randi-global-template--header {
  margin-bottom: 2rem;
  margin-top: 0;
}

.randi-global-template--footer {
  margin-top: 2rem;
  margin-bottom: 0;
}

.randi-global-template .randi-builder-content {
  width: 100%;
}

/* Standalone HTML admin header (non-editor context only) */
.randi-standalone-shell {
  position: relative;
}

.randi-standalone-admin-header {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 9990;
  width: 100%;
  background: #ffffff;
  color: #000000;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.15);
}

.randi-standalone-admin-header.is-hidden {
  clip-path: inset(0 100% 0 0);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  border-color: transparent;
  border-width: 0;
  box-shadow: none;
}

.randi-standalone-admin-header.is-collapsing {
  animation: randi-header-collapse 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
  overflow: hidden;
}

.randi-standalone-admin-header.is-expanding {
  animation: randi-header-expand 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  overflow: hidden;
}

@keyframes randi-header-collapse {
  0% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
  40% {
    opacity: 0;
  }
  100% {
    clip-path: inset(0 100% 0 0);
    opacity: 0;
    border-color: transparent;
    box-shadow: none;
  }
}

@keyframes randi-header-expand {
  0% {
    clip-path: inset(0 100% 0 0);
    opacity: 0;
  }
  60% {
    clip-path: inset(0 0 0 0);
    opacity: 0;
  }
  100% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}

.randi-standalone-admin-header__inner {
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.randi-standalone-admin-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0 1 auto;
}

.randi-standalone-admin-header__logo {
  width: 25px;
  height: 25px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.randi-standalone-admin-header__title {
  font-size: 13px;
  line-height: 1;
  font-weight: 500;
  color: #ffffff;
  background: #000000;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
  margin-left: 4px;
}

.randi-standalone-admin-header__controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  min-width: 0;
  flex: 1 1 auto;
}

.randi-standalone-admin-header__links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.randi-standalone-admin-header__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 14px;
  line-height: 1;
  font-weight: 400;
  color: #000000;
  padding: 4px 0;
  transition: color 0.2s ease;
}

.randi-standalone-admin-header__link-icon {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.randi-standalone-admin-header__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 999px;
  background: #000000;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.2s ease;
}

.randi-standalone-admin-header__link:hover,
.randi-standalone-admin-header__link:focus-visible {
  color: #000000;
}

.randi-standalone-admin-header__link:hover::after,
.randi-standalone-admin-header__link:focus-visible::after {
  transform: scaleX(1);
}

.randi-standalone-admin-header__link--emphasis {
  color: #000000;
  font-weight: 400;
}

.randi-standalone-admin-header__mobile-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.randi-standalone-admin-header__title--mobile {
  display: none;
}

.randi-standalone-admin-header__icon-button {
  width: 25px;
  height: 25px;
  border: 0;
  background: transparent;
  color: #000000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.randi-standalone-admin-header__icon-button:hover,
.randi-standalone-admin-header__icon-button:focus-visible {
  color: #000000;
  background: #f1f5f9;
}

.randi-standalone-admin-header__icon {
  width: 14px;
  height: 14px;
  display: block;
}

.randi-standalone-admin-header__menu-toggle {
  display: none;
}

.randi-standalone-admin-header__toggle {
  display: inline-flex;
  border: 0;
  padding: 0;
}

.randi-standalone-admin-header__toggle:hover,
.randi-standalone-admin-header__toggle:focus-visible {
  color: #0f172a;
}

.randi-standalone-admin-fab {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 9991;
  width: auto;
  height: auto;
  padding: 8px;
  border-radius: 0 8px 0 0;
  border: 1px solid #dbe4f1;
  border-left: 0;
  border-bottom: 0;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(245, 166, 35, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px) scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.randi-standalone-admin-fab.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.randi-standalone-admin-fab__logo {
  width: 25px;
  height: 25px;
  display: block;
  object-fit: contain;
}

@media (max-width: 1100px) {
  .randi-standalone-admin-header__links {
    gap: 14px;
  }
}

@media (max-width: 920px) {
  .randi-standalone-admin-header {
    position: fixed;
  }

  .randi-standalone-admin-header__inner {
    flex-direction: row;
    align-items: center;
    padding: 8px;
    gap: 8px;
  }

  .randi-standalone-admin-header__brand {
    flex: 0 0 auto;
  }

  .randi-standalone-admin-header__brand .randi-standalone-admin-header__title {
    display: none;
  }

  .randi-standalone-admin-header__controls {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 0;
  }

  .randi-standalone-admin-header__mobile-actions {
    gap: 8px;
  }

  .randi-standalone-admin-header__menu-toggle {
    display: inline-flex;
    order: -1;
  }

  .randi-standalone-admin-header__toggle {
    display: inline-flex;
  }

  .randi-standalone-admin-header__links {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    padding: 12px 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .randi-standalone-admin-header__links.is-open {
    display: flex;
  }

  .randi-standalone-admin-header__title--mobile {
    display: inline-block;
  }

  .randi-standalone-admin-header__link {
    font-size: 15px;
    line-height: 1.2;
  }
}



/* Responsive */
@media (max-width: 768px) {
  .randi-row {
    flex-direction: column;
  }

  .randi-hero {
    min-height: 300px;
    padding: 3rem 1.5rem;
  }
}

/* Stripe Elements default styling */
.randi-payment-stripe {
  display: block;
}
.randi-stripe-element {
  border: 1px solid #d1d5db; /* matches input border default in render */
  padding: 0.75rem;
  border-radius: 6px;
  background-color: #ffffff;
  box-sizing: border-box;
  min-height: 44px;
  display: block;
}
.randi-stripe-element.randi-stripe-card {
  margin-bottom: 0.75rem;
}
.randi-stripe-error {
  color: #e11d48; /* tomato / error color */
  margin-top: 0.5rem;
  font-size: 0.875rem;
}
.randi-stripe-element:focus-within {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.12);
}

/* Checkout submit button animations */
.randi-submit-anim {
  position: relative;
  overflow: hidden;
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.18s ease;
}

.randi-submit-anim::before,
.randi-submit-anim::after {
  content: "";
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.randi-submit-anim::before {
  inset: 0;
}

.randi-submit-anim::after {
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin-top: -9px;
  margin-left: -9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.randi-submit-anim:not(.is-loading):not(.is-success):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.randi-submit-anim.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.randi-submit-anim.is-loading::after {
  opacity: 1;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: randiSubmitSpin 0.8s linear infinite;
}

.randi-submit-anim.is-success {
  pointer-events: none;
  background-image: linear-gradient(130deg, #050505, #2f2f35, #050505) !important;
  background-size: 220% 220%;
  animation: randiSubmitSheen 2.4s ease-in-out forwards;
  box-shadow: 0 16px 28px rgba(5, 5, 5, 0.45);
  position: static;
  margin-left: initial;
  margin-top: initial;
}

.randi-submit-anim.is-success::before {
  opacity: 1;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.4), transparent 60%);
  animation: randiSubmitPulse 0.9s ease forwards;
}

.randi-submit-anim.is-success::after {
  opacity: 1;
  content: "✓";
  color: #fff;
  font-size: 18px;
  animation: randiSubmitCheck 0.55s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes randiSubmitSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes randiSubmitPulse {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  40% {
    opacity: 0.9;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.3);
  }
}

@keyframes randiSubmitCheck {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes randiSubmitSheen {
  0% {
    background-position: 0% 50%;
  }
  60% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 50% 50%;
  }
}

/* Checkout Form Styles moved from JS */
.randi-field-error {
  border: 1px solid #E11D48 !important;
  box-shadow: 0 0 0 3px rgba(225,29,72,0.06) !important;
}
.randi-field-error-message {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  padding: 6px 12px;
  background-color: #E11D48;
  color: #fff;
  margin-top: 6px;
  border-radius: 4px;
}
/* Stripe error container styling */
.randi-stripe-error {
  color: #fa755a;
  font-size: 14px;
  margin-top: 8px;
}
/* Prevent native browser focus outlines from appearing for our error style; we use box-shadow instead */
.randi-field-error:focus,
.randi-field-error:focus-visible,
.randi-field-error-message:focus {
  outline: none !important;
}
/* Spinner styles */
.randi-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: randi-spin 0.75s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -0.5em;
  margin-left: -0.5em;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
@keyframes randi-spin {
  100% { transform: rotate(360deg); }
}
.randi-btn-content {
  transition: opacity 0.3s ease;
}
.randi-btn-loading .randi-btn-content {
  opacity: 0;
}
.randi-btn-loading .randi-spinner {
  opacity: 1;
}
.randi-coupon-btn {
  position: relative;
}

/* Promo Code section */
.coupon-trigger-icon {
  transition: transform 0.2s ease;
}

.coupon-trigger.open .coupon-trigger-icon {
  transform: rotate(90deg);
}

.coupon-message-error {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #E11D48;
}

@keyframes randi-coupon-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.coupon-input-group.randi-coupon-shake {
  animation: randi-coupon-shake 0.4s ease-in-out;
}

/* Fix for TomSelect and IntlTelInput wrappers showing square error borders */
.ts-wrapper.randi-field-error,
.iti.randi-field-error {
  border: none !important;
  box-shadow: none !important;
}

.ts-wrapper.randi-field-error .ts-control {
  border: 1px solid #E11D48 !important;
  box-shadow: 0 0 0 3px rgba(225,29,72,0.06) !important;
}

/* WP Admin Bar offset for logged-in users */
.admin-bar .randi-builder-content {
  margin-top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .randi-builder-content {
    margin-top: 46px;
  }
}
