@tailwind base;
@tailwind components;
@tailwind utilities;

@import url("https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&ampdisplay=swap");
@import url("https://ga.jspm.io/npm:slim-select@2.10.0/dist/slimselect.css");

@layer utilities {
  /* Hide scrollbar for Chrome, Safari and Opera */
  .no-scrollbar::-webkit-scrollbar {
      display: none;
  }
 /* Hide scrollbar for IE, Edge and Firefox */
  .no-scrollbar {
      -ms-overflow-style: none;  /* IE and Edge */
      scrollbar-width: none;  /* Firefox */
  }
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

/* Root */
:root {
  --primary-color: #ec6b22;
}

/* Custom Placeholder */
::placeholder {
  color: var(--gray-place-holder, #C4C4C4) !important;
  font-weight: 100 !important;
  font-size: 14px;
}

/* Custom Loading */
button .show-when-disabled {
  display: none;
}
button:disabled .show-when-disabled {
  display: initial
}
button .show-when-enabled {
  display: initial;
}
button:disabled .show-when-enabled {
  display:none;
}

/* Custom Pagy */
.pagination-footer {
  padding: 16px 24px;
  border-top: 1px solid #ebe9ef;
}

.pagination-footer-content:not(.hidden) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.pagination-summary {
  margin: 0;
  color: #6f6b7d;
  font-size: 13px;
  line-height: 20px;
}

.pagination-summary strong {
  color: #5d596c;
  font-weight: 600;
}

.pagination-range {
  margin-inline-start: 2px;
  white-space: nowrap;
}

.pagination-controls {
  max-width: 100%;
  margin-inline-start: auto;
}

.pagy {
  --pagy-accent: var(--primary-color);
  --pagy-accent-strong: #b2511a;
  --pagy-accent-soft: #fff3eb;
  --pagy-border: #d9dde5;
  --pagy-text: #5d596c;
  --pagy-muted: #a3a1ad;

  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 100%;
}

.pagy > a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--pagy-border);
  border-radius: 6px;
  background-color: white;
  color: var(--pagy-text);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(47, 43, 61, 0.04);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.pagy > a[href]:hover {
  border-color: var(--pagy-accent);
  background-color: var(--pagy-accent-soft);
  color: var(--pagy-accent-strong);
}

.pagy > a[href]:focus-visible {
  outline: 2px solid var(--pagy-accent-strong);
  outline-offset: 3px;
}

.pagy > a:first-child,
.pagy > a:last-child {
  font-size: 16px;
  font-weight: 600;
}

.pagy > a[aria-current="page"] {
  border-color: var(--pagy-accent-strong);
  background-color: var(--pagy-accent-strong);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(178, 81, 26, 0.18);
  cursor: default;
}

.pagy > a:first-child[href],
.pagy > a:last-child[href] {
  border-color: #f2d6c5;
  background-color: var(--pagy-accent-soft);
  color: var(--pagy-accent-strong);
}

.pagy > a:first-child[href]:hover,
.pagy > a:last-child[href]:hover {
  border-color: var(--pagy-accent);
  background-color: #ffefe5;
}

.pagy > a:not([href]):not([aria-current]):not([role="separator"]) {
  border-color: #ececf0;
  background-color: #f8f8fa;
  color: var(--pagy-muted);
  box-shadow: none;
  cursor: default;
}

.pagy > a[role="separator"] {
  width: 20px;
  border-color: transparent;
  background-color: transparent;
  color: var(--pagy-muted);
  box-shadow: none;
  cursor: default;
}

@media (max-width: 640px) {
  .pagination-footer {
    padding: 12px 14px;
  }

  .pagination-footer-content:not(.hidden) {
    gap: 8px 12px;
  }

  .pagination-summary {
    font-size: 12px;
    line-height: 18px;
  }

  .pagy {
    flex-wrap: nowrap;
    gap: 4px;
  }

  .pagy > a {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    font-size: 12px;
    line-height: 16px;
  }

  .pagy > a:first-child,
  .pagy > a:last-child {
    font-size: 14px;
  }

  .pagy > a[role="separator"] {
    width: 14px;
  }

  /* Keep previous, current, and next visible inside narrow table footers. */
  .pagy > a:not(:first-child):not(:last-child):not([aria-current]) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pagy > a {
    transition: none;
  }
}

/* Custom Slim Search */
.ss-list {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;
}
.ss-list::-webkit-scrollbar {
  display: none;
}
.ss-main {
  display: flex !important;
  padding: 10.5px;
}
.ss-search {
  font-size: .875rem !important;
}
.ss-content .ss-list .ss-option:hover {
  background-color: var(--primary-color) !important;
}
.ss-content .ss-list .ss-option:not(.ss-disabled).ss-selected {
  background-color: var(--primary-color) !important;
}
.ss-main .ss-values .ss-placeholder {
  padding: 0;
  color: #c6c6c6;
  font-weight: 300;
  font-size: .875rem;
  line-height: 1.25rem;
}
.ss-main .ss-values .ss-single {
  font-weight: 300;
  font-size: .875rem;
  line-height: 1.25rem;
}
.ss-content .ss-list .ss-option {
  font-weight: 300;
  font-size: .875rem;
  line-height: 1.25rem;
}
.ellipsis-text-overflow .ss-values .ss-single {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 145px;
}
.ss-content .ss-search .ss-addable {
  width: 35px;
}
.ss-content .ss-search .ss-addable svg {
  color: white;
}
.ss-main .ss-values .ss-value {
  background-color: var(--primary-color);
}
.ss-main:focus {
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 0 var(--primary-color);
}
.ss-main {
  border-radius: 0.5rem;
}
.ss-search {
  color: #c6c6c6 !important;
  font-weight: 300;
  font-size: .875rem;
  line-height: 1.25rem;
}
.ss-search input {
  color: #4d4d4d;
  font-weight: 300;
  font-size: .875rem;
  line-height: 1.25rem;
}
.ss-search input:focus {
  border: 1px solid var(--primary-color);
  box-shadow: 0 0 0 var(--primary-color) !important;
}

/* Admin layout: keep dense tables scrollable without widening the page. */
.admin-main {
  min-width: 0;
}

.admin-main section {
  min-width: 0;
  max-width: 100%;
}

.admin-main .overflow-x-scroll,
.admin-main .overflow-x-auto {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.admin-main turbo-frame#search {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.admin-main section[data-controller="report"] form[class~="flex"] {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-main iframe {
  max-width: 100%;
}

@media (max-width: 1023px) {
  .admin-main [class~="grid-cols-4"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-main [class~="grid-cols-6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-main [class*="w-["]:not([class*="min-w-"]):not([class*="max-w-"]) {
    max-width: 100%;
  }

  .admin-main form [class*="min-w-["] {
    min-width: 0;
  }

  .admin-main form[class~="flex"] {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .admin-main form[class~="flex"] > div[class*="w-["]:not([class*="min-w-"]):not([class*="max-w-"]) {
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
  }

  .admin-main form[class~="flex"] > [class~="ml-auto"] {
    flex: 1 1 100%;
    margin-left: 0;
  }

  .admin-main section > [class~="flex"],
  .admin-main section > [class~="flex"] > [class~="flex"],
  .admin-main [class~="flex"][class~="justify-between"] {
    flex-wrap: wrap;
  }

  .admin-main section > [class~="flex"] > [class~="flex"] {
    flex: 1 1 100%;
    min-width: 0;
  }

  .admin-main section > [class~="flex"] > [class~="flex"] > [class~="relative"] {
    width: 100%;
    max-width: 100%;
  }

  .admin-main .overflow-x-scroll,
  .admin-main .overflow-x-auto {
    overflow-x: auto;
  }

  .admin-main section[class~="overflow-x-auto"] {
    overflow-x: visible;
  }

  .admin-main [class~="grid-cols-2"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-main [class~="grid-cols-3"],
  .admin-main [class~="grid-cols-4"],
  .admin-main [class~="grid-cols-5"],
  .admin-main [class~="grid-cols-6"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-main .admin-dashboard-categories {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 380px) {
  .admin-main [class~="grid-cols-3"],
  .admin-main [class~="grid-cols-4"],
  .admin-main [class~="grid-cols-5"],
  .admin-main [class~="grid-cols-6"] {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Flash Toast */
@keyframes flash-enter {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.flash-enter {
  animation: flash-enter 0.25s ease-out;
}

.flash-leave {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
