/* All Valley Championship - Custom Tailwind Enhancements & Micro-interactions */

/* Responsive guardrails */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  max-width: 100%;
  overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

pre,
code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

table {
  max-width: 100%;
}

.min-w-0,
.flex,
.grid {
  min-width: 0;
}

.theme-dropdown-menu {
  max-width: calc(100vw - 2rem);
}

/* Continuous Marquee Ticker Animation */
@keyframes marqueeScroll {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}

.animate-marquee {
  display: inline-flex;
  white-space: nowrap;
  animation: marqueeScroll 28s linear infinite;
}

.animate-marquee:hover {
  animation-play-state: paused;
}

/* Digital Signature Pad */
.signature-wrapper {
  position: relative;
  background-color: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  overflow: hidden;
  transition: border-color 0.2s;
}

.signature-wrapper:hover,
.signature-wrapper:focus-within {
  border-color: #f9bf41;
}

.signature-canvas {
  width: 100%;
  height: clamp(140px, 38vw, 180px);
  touch-action: none;
  cursor: crosshair;
  background-color: #fafafa;
}

/* Star Rating System */
.star-rating {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.25rem;
}

.star-rating input {
  display: none;
}

.star-rating label {
  color: #cbd5e1;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.15s ease-in-out, transform 0.15s;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
  color: #f9bf41;
  transform: scale(1.1);
}

/* AJAX Notification Alerts (for js/app.js) */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.925rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.alert-success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alert-error {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert button {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
  padding: 0 0.25rem;
}

.alert button:hover {
  opacity: 1;
}

/* Custom Form Dropdown Styling */
select.custom-select,
select.custom-select-control,
.custom-select-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
  background-position: right 0.75rem center !important;
  background-repeat: no-repeat !important;
  background-size: 1.25em 1.25em !important;
  padding-right: 2.5rem !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  cursor: pointer;
}

html.dark select.custom-select,
html.dark select.custom-select-control,
html.dark .custom-select-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
}

html.dark select option,
html.dark select.custom-select option,
html.dark select.custom-select-control option,
html.dark .custom-select-control option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  padding: 0.5rem !important;
}

html:not(.dark) select option,
html:not(.dark) select.custom-select option,
html:not(.dark) select.custom-select-control option,
html:not(.dark) .custom-select-control option {
  background-color: #ffffff !important;
  color: #0f172a !important;
  padding: 0.5rem !important;
}

/* Universal Form Elements Primary Theming (#f9bf41) */
input[type="checkbox"],
input[type="radio"],
input[type="range"],
progress {
  accent-color: #f9bf41 !important;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: #f9bf41 !important;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid #f9bf41 !important;
  outline-offset: 2px !important;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  accent-color: #f9bf41 !important;
}

/* Focus styles for text inputs, textareas, selects */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  border-color: #f9bf41 !important;
  box-shadow: 0 0 0 3px rgba(249, 191, 65, 0.22) !important;
  outline: none !important;
}

/* Text Selection Highlight with Primary Brand Color */
::selection {
  background-color: #f9bf41 !important;
  color: #020617 !important;
}

::-moz-selection {
  background-color: #f9bf41 !important;
  color: #020617 !important;
}


/* Quill WYSIWYG Editor Theming & Strict Containment */
.ql-toolbar.ql-snow,
.ql-container.ql-snow,
.ql-editor,
.ql-snow * {
  box-sizing: border-box !important;
  max-width: 100% !important;
}

.ql-toolbar.ql-snow {
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom-width: 1px !important;
  border-bottom-style: solid !important;
  border-radius: 0 !important;
  padding: 0.6rem 0.75rem !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.25rem 0.5rem !important;
  width: 100% !important;
}

html.dark .ql-toolbar.ql-snow {
  background-color: #0f172a !important;
  border-bottom-color: #334155 !important;
}

html:not(.dark) .ql-toolbar.ql-snow {
  background-color: #f8fafc !important;
  border-bottom-color: #e2e8f0 !important;
}

.ql-container.ql-snow {
  border: none !important;
  border-radius: 0 !important;
  width: 100% !important;
  font-family: inherit !important;
  font-size: 0.875rem !important;
}

html.dark .ql-container.ql-snow {
  background-color: #020617 !important;
  color: #f8fafc !important;
}

html:not(.dark) .ql-container.ql-snow {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

.ql-editor {
  line-height: 1.6 !important;
  min-height: 180px !important;
  max-height: 450px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  padding: 1rem 1.25rem !important;
}

html.dark .ql-snow .ql-stroke {
  stroke: #94a3b8 !important;
}

html.dark .ql-snow .ql-fill {
  fill: #94a3b8 !important;
}

html.dark .ql-snow .ql-picker {
  color: #94a3b8 !important;
}

html.dark .ql-snow .ql-picker-options {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  border-radius: 0.5rem !important;
  padding: 0.5rem !important;
  z-index: 50 !important;
}

html:not(.dark) .ql-snow .ql-stroke {
  stroke: #475569 !important;
}

html:not(.dark) .ql-snow .ql-fill {
  fill: #475569 !important;
}

html:not(.dark) .ql-snow .ql-picker {
  color: #475569 !important;
}

html:not(.dark) .ql-snow .ql-picker-options {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  border-radius: 0.5rem !important;
  padding: 0.5rem !important;
  z-index: 50 !important;
}

.ql-snow .ql-picker-item:hover {
  color: #f9bf41 !important;
}

.ql-editor.ql-blank::before {
  color: #64748b !important;
  font-style: normal !important;
}

.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow .ql-toolbar button.ql-active .ql-stroke {
  stroke: #f9bf41 !important;
}

.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow .ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill,
.ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: #f9bf41 !important;
}

/* Primary Button High-Contrast Styling */
.btn-primary-action {
  background-color: #f9bf41;
  color: #0f172a;
  font-weight: 700;
  transition: all 0.15s ease-in-out;
}
.btn-primary-action:hover {
  background-color: #fad252;
  color: #020617;
  transform: translateY(-1px);
}

/* Secondary Color (#aae1f4) Badge & Background Accent Helpers */
.badge-secondary-accent {
  background-color: rgba(170, 225, 244, 0.22);
  color: #0369a1;
  border: 1px solid rgba(170, 225, 244, 0.45);
}
html.dark .badge-secondary-accent {
  background-color: rgba(170, 225, 244, 0.12);
  color: #aae1f4;
  border-color: rgba(170, 225, 244, 0.25);
}

.bg-secondary-tint {
  background-color: rgba(170, 225, 244, 0.14);
}

/* Website component tab rail */
.component-tabs-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.component-tabs-scroll::-webkit-scrollbar {
  height: 6px;
}

.component-tabs-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.component-tabs-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

html.dark .component-tabs-scroll {
  scrollbar-color: #475569 transparent;
}

html.dark .component-tabs-scroll::-webkit-scrollbar-thumb {
  background: #475569;
}

.component-tabs {
  align-items: center;
  flex-wrap: nowrap;
  width: max-content;
  min-width: max-content;
}

.component-tabs .tab-btn {
  flex: 0 0 auto;
  min-height: 2.5rem;
  min-width: max-content;
  white-space: nowrap;
}

/* Admin and dense-page responsive helpers */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
}

main .overflow-x-auto > table {
  min-width: max-content;
}

@media (max-width: 1023px) {
  [id="adminMobileDrawer"] .fixed.inset-y-0.left-0 {
    width: min(18rem, calc(100vw - 2rem));
    overflow-y: auto;
  }
}

@media (max-width: 767px) {
  body {
    min-width: 0;
  }

  main {
    width: 100%;
  }

  h1,
  h2,
  h3,
  p,
  a,
  span,
  div {
    overflow-wrap: anywhere;
  }

  .alert {
    align-items: flex-start;
    gap: 0.75rem;
  }

  .star-rating {
    gap: 0.15rem;
  }

  .star-rating label {
    font-size: clamp(1.05rem, 7vw, 1.5rem);
  }

  .ql-toolbar.ql-snow {
    padding: 0.5rem !important;
  }

  .ql-editor {
    padding: 0.875rem !important;
    min-height: 150px !important;
  }

  input[type="file"]::file-selector-button {
    margin-bottom: 0.4rem;
  }

  .lg\:pl-64 main {
    padding: 1rem 0.75rem !important;
  }

  .lg\:pl-64 main > div {
    width: 100%;
    max-width: 100%;
  }

  .lg\:pl-64 main .pb-6 {
    padding-bottom: 1rem !important;
  }

  .lg\:pl-64 main .p-8,
  .lg\:pl-64 main .p-6 {
    padding: 1rem !important;
  }

  .lg\:pl-64 main .p-5 {
    padding: 0.875rem !important;
  }

  .lg\:pl-64 main .gap-8 {
    gap: 1rem !important;
  }

  .lg\:pl-64 main .gap-6 {
    gap: 1rem !important;
  }

  .lg\:pl-64 main .space-y-6 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1rem !important;
  }

  .lg\:pl-64 main h1 {
    font-size: 1.35rem !important;
    line-height: 1.2 !important;
  }

  .lg\:pl-64 main h2 {
    font-size: 1.05rem !important;
    line-height: 1.25 !important;
  }

  .lg\:pl-64 main .flex.items-center.justify-between,
  .lg\:pl-64 main .flex.items-start.justify-between {
    align-items: flex-start !important;
  }

  .lg\:pl-64 main .flex.items-center.justify-between.gap-4,
  .lg\:pl-64 main .flex.items-start.justify-between.gap-4,
  .lg\:pl-64 main form.flex {
    flex-wrap: wrap;
  }

  .lg\:pl-64 main form.flex > *,
  .lg\:pl-64 main .flex.flex-col.sm\:flex-row > div:last-child,
  .lg\:pl-64 main .flex.items-center.gap-3.flex-wrap,
  .lg\:pl-64 main .flex.items-center.gap-2.w-full {
    width: 100%;
  }

  .lg\:pl-64 main .flex.items-center.gap-3.flex-wrap > a,
  .lg\:pl-64 main .flex.items-center.gap-3.flex-wrap > button,
  .lg\:pl-64 main form button[type="submit"] {
    flex: 1 1 auto;
    justify-content: center;
  }

  .lg\:pl-64 main .grid {
    gap: 0.875rem !important;
  }

  .lg\:pl-64 main .overflow-x-auto {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    border-radius: 0.75rem !important;
  }

  .lg\:pl-64 main table {
    font-size: 0.72rem;
  }

  .lg\:pl-64 main th,
  .lg\:pl-64 main td {
    padding: 0.65rem 0.7rem !important;
    vertical-align: top;
  }

  .lg\:pl-64 main td .truncate {
    max-width: 11rem;
  }

  .lg\:pl-64 main .whitespace-nowrap {
    white-space: normal !important;
  }

  .lg\:pl-64 main .text-right {
    text-align: left !important;
  }

  .lg\:pl-64 main .justify-end {
    justify-content: flex-start !important;
  }

  .lg\:pl-64 main [id$="Modal"],
  .lg\:pl-64 main [id*="Modal"],
  .lg\:pl-64 main .fixed.inset-0 {
    padding: 0.75rem !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
  }

  .lg\:pl-64 main [id$="Modal"] > div,
  .lg\:pl-64 main [id*="Modal"] > div,
  .lg\:pl-64 main .fixed.inset-0 > .bg-white,
  .lg\:pl-64 main .fixed.inset-0 > .dark\:bg-slate-900 {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
  }

  .event-row {
    align-items: flex-start !important;
  }

  .event-row input {
    min-width: 0;
  }

  .tab-pane > .pb-3.flex,
  .tab-pane > .pb-4.flex {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }

  .tab-pane > .pb-3.flex > span,
  .tab-pane > .pb-4.flex > span {
    max-width: 100%;
    white-space: normal;
  }

  .tab-pane form .flex.items-center.justify-end {
    justify-content: stretch !important;
  }

  .tab-pane form .flex.items-center.justify-end > button,
  .tab-pane form .flex.items-center.justify-end > a {
    width: 100%;
    justify-content: center;
  }

  .tab-pane input,
  .tab-pane select,
  .tab-pane textarea {
    font-size: 0.875rem;
  }

  #tab-pane-marquee .flex.items-center.justify-between.text-\[11px\],
  #tab-pane-marquee .bg-sky-50.flex,
  #tab-pane-marquee .flex.items-center.justify-between.text-xs {
    flex-direction: column;
    align-items: flex-start !important;
  }

  #tab-pane-marquee .bg-slate-900.flex {
    align-items: stretch !important;
  }

  #tab-pane-marquee .bg-slate-900.flex > .overflow-hidden {
    min-height: 2rem;
    margin-left: 0;
    margin-right: 0;
  }

  #tab-pane-marquee .self-end {
    align-self: stretch !important;
    flex-wrap: wrap;
    justify-content: flex-start !important;
  }

  #tab-pane-marquee .self-end button {
    min-width: 2rem;
  }

  #tab-pane-media input[type="file"],
  .tab-pane input[type="file"] {
    color: transparent;
  }

  #tab-pane-media input[type="file"]::file-selector-button,
  .tab-pane input[type="file"]::file-selector-button {
    width: 100%;
    margin-right: 0;
  }

  #tab-pane-promos form.grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #tab-pane-promos [id^="disc-item-"] {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }

  #tab-pane-promos [id^="disc-item-"] form {
    width: 100%;
  }

  #tab-pane-promos [id^="disc-item-"] button {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .rounded-3xl {
    border-radius: 1rem !important;
  }

  .rounded-2xl {
    border-radius: 0.875rem !important;
  }
}

/* Hide scrollbars for smooth slider tracks */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html.dark .bg-secondary-tint {
  background-color: rgba(170, 225, 244, 0.08);
}

/* Universal Dark Mode Table Row Hover Safety */
html.dark table tbody tr:hover,
html.dark table tr.hover\:bg-slate-50:hover,
html.dark tr.dark\:hover\:bg-slate-800\/60:hover,
html.dark tr.dark\:hover\:bg-slate-850\/40:hover {
  background-color: rgba(30, 41, 59, 0.55) !important;
}

.print-only {
  display: none;
}

/* Print Stylesheet for Competitor Pass, Dossier & Receipt */
@media print {
  @page {
    size: letter;
    margin: 0.45in;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
    transition: none !important;
    animation: none !important;
  }

  html,
  body {
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 10.5pt !important;
    line-height: 1.35 !important;
    width: 100% !important;
    min-height: auto !important;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  aside,
  body > aside,
  body > header,
  header,
  footer,
  nav,
  script,
  .no-print,
  #sitePreloader,
  #globalAlertDialog,
  #adminMobileDrawer,
  .theme-dropdown-container,
  button,
  .btn {
    display: none !important;
  }

  main,
  .print-document {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    color: #111827 !important;
  }

  [class*="lg:pl-"],
  [class*="lg:ml-"],
  [class*="max-w-"] {
    max-width: 100% !important;
    padding-left: 0 !important;
    margin-left: 0 !important;
  }

  .print-only {
    display: block !important;
  }

  .print-document-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 18pt !important;
    padding: 0 0 14pt !important;
    margin: 0 0 16pt !important;
    border-bottom: 2px solid #111827 !important;
    page-break-after: avoid;
  }

  .print-document-header h1 {
    margin: 2pt 0 3pt !important;
    color: #111827 !important;
    font-size: 22pt !important;
    line-height: 1.1 !important;
    font-weight: 900 !important;
  }

  .print-document-header p {
    margin: 0 !important;
    color: #475569 !important;
    font-size: 9.5pt !important;
  }

  .print-kicker {
    color: #92400e !important;
    font-size: 8pt !important;
    font-weight: 800 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
  }

  .print-status {
    border: 1px solid #111827 !important;
    border-radius: 999px !important;
    color: #111827 !important;
    font-size: 8pt !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    padding: 6pt 10pt !important;
    text-transform: uppercase !important;
  }

  .print-status.is-paid {
    border-color: #047857 !important;
    color: #047857 !important;
  }

  .print-status.is-pending {
    border-color: #b45309 !important;
    color: #b45309 !important;
  }

  .grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12pt !important;
  }

  .md\:col-span-2,
  .lg\:col-span-8,
  .lg\:col-span-4 {
    grid-column: span 2 / span 2 !important;
  }

  .bg-white,
  .dark\:bg-slate-900,
  .dark\:bg-slate-950,
  .bg-slate-50,
  .dark\:bg-slate-950\/40,
  .dark\:bg-slate-950\/60 {
    background: #ffffff !important;
  }

  .rounded-3xl,
  .rounded-2xl,
  .rounded-xl,
  .rounded-lg {
    border-radius: 6pt !important;
  }

  .border,
  [class*="border-"] {
    border-color: #cbd5e1 !important;
  }

  .shadow-xl,
  .shadow-2xl,
  .shadow-sm,
  .dark\:shadow-xl {
    box-shadow: none !important;
  }

  .print-document > div,
  .print-document .bg-white,
  .print-document .dark\:bg-slate-900 {
    page-break-inside: avoid;
  }

  h1,
  h2,
  h3,
  h4,
  strong,
  .font-bold,
  .font-black,
  .text-slate-900,
  .dark\:text-white {
    color: #111827 !important;
  }

  .text-slate-500,
  .text-slate-600,
  .text-slate-700,
  .dark\:text-slate-400,
  .dark\:text-slate-300 {
    color: #475569 !important;
  }

  a {
    color: #111827 !important;
    text-decoration: none !important;
  }

  pre,
  details {
    white-space: pre-wrap !important;
    max-height: none !important;
    overflow: visible !important;
    font-size: 7.5pt !important;
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  .p-6,
  .sm\:p-8 {
    padding: 12pt !important;
  }

  .space-y-6 > :not([hidden]) ~ :not([hidden]),
  .space-y-8 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 12pt !important;
  }

  .card-print {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
  }
}
