/*
 * CupsByAA shadcn layer
 * The shadcn/ui design language (https://ui.shadcn.com) as plain CSS for Blade:
 * the same tokens, radii, focus ring and component anatomy, no React.
 * Neutral surfaces, one brand colour (pink) as --primary.
 * Static file, no Tailwind rebuild. Components are .ui-* classes and the
 * Blade wrappers live in resources/views/components/ui/.
 */

:root {
  --radius: 0.625rem;
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --popover: #ffffff;
  --popover-foreground: #0a0a0a;
  --primary: #c83f7d;
  --primary-hover: #b23570;
  --primary-foreground: #ffffff;
  --primary-soft: #fdf2f7;
  --secondary: #f5f5f5;
  --secondary-foreground: #171717;
  --muted: #f5f5f5;
  --muted-foreground: #6b6b6b;
  --accent: #f5f5f5;
  --accent-foreground: #171717;
  --destructive: #dc2626;
  --destructive-soft: #fef2f2;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --warning: #a16207;
  --warning-soft: #fefce8;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #e55e99;
  --sidebar: #fafafa;
  --sidebar-foreground: #0a0a0a;
  --sidebar-accent: #f0f0f0;
  --sidebar-border: #e5e5e5;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Layout defaults that a Tailwind utility must be able to override ----------
   Tailwind v4 keeps its utilities in a cascade layer, and a style outside any
   layer beats a layered one whatever its specificity. So "hidden", "lg:hidden"
   or "w-24" on a .ui-* element lost to this file: a converted button that
   carried "hidden" showed anyway. These defaults sit in Tailwind's components
   layer, below utilities, so the utility wins. */
@layer components {
  .ui-btn, .ui-badge, .ui-tab { display: inline-flex; }
  .ui-input { display: block; width: 100%; }
}

/* Button ---------------------------------------------------------------- */
.ui-btn {
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background-color 150ms, color 150ms, border-color 150ms, box-shadow 150ms;
}
.ui-btn:hover { background: var(--primary-hover); }
.ui-btn:focus-visible,
.ui-input:focus-visible,
.ui-tab:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);
}
.ui-btn:disabled,
.ui-btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.ui-btn--secondary { background: var(--secondary); color: var(--secondary-foreground); box-shadow: none; }
.ui-btn--secondary:hover { background: #ebebeb; }
.ui-btn--outline { background: var(--background); color: var(--foreground); border-color: var(--border); }
.ui-btn--outline:hover { background: var(--accent); }
.ui-btn--ghost { background: transparent; color: var(--foreground); box-shadow: none; }
.ui-btn--ghost:hover { background: var(--accent); }
.ui-btn--destructive { background: var(--destructive); color: #fff; }
.ui-btn--destructive:hover { background: #b91c1c; }
.ui-btn--link { background: transparent; color: var(--primary); box-shadow: none; padding: 0; height: auto; }
.ui-btn--link:hover { background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.ui-btn--sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.ui-btn--lg { height: 2.5rem; padding: 0 1.5rem; }
.ui-btn--icon { width: 2.25rem; padding: 0; }
/* Touch: every control keeps a 44px target on coarse pointers. */
@media (pointer: coarse) {
  .ui-btn { min-height: 44px; }
  .ui-btn--icon { min-width: 44px; }
}

/* A quiet control whose action destroys something. */
.ui-btn.co-danger { color: var(--destructive); }
.ui-btn.co-danger:hover { background: var(--destructive-soft); }

/* Card ------------------------------------------------------------------ */
.ui-card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-xs);
}
.ui-card__header { display: flex; flex-direction: column; gap: 0.375rem; padding: 1.5rem 1.5rem 0; }
.ui-card__title { font-size: 1rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.ui-card__description { font-size: 0.875rem; color: var(--muted-foreground); }
.ui-card__content { padding: 1.5rem; }
.ui-card__footer { display: flex; align-items: center; gap: 0.5rem; padding: 0 1.5rem 1.5rem; }

/* Badge ----------------------------------------------------------------- */
.ui-badge {
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
}
.ui-badge--secondary { background: var(--secondary); color: var(--secondary-foreground); }
.ui-badge--outline { background: transparent; color: var(--foreground); border-color: var(--border); }
.ui-badge--success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.ui-badge--warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.ui-badge--destructive { background: var(--destructive-soft); color: var(--destructive); border-color: #fecaca; }
.ui-badge--info { background: var(--info-soft); color: var(--info); border-color: #bfdbfe; }
.ui-badge--primary { background: var(--primary-soft); color: var(--primary); border-color: #f9d3e3; }

/* Form ------------------------------------------------------------------ */
.ui-label { display: block; font-size: 0.875rem; font-weight: 500; line-height: 1; margin-bottom: 0.5rem; color: var(--foreground); }
.ui-input--auto { width: auto; }
.ui-input {
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  /* background-color only: the shorthand would wipe the dropdown arrow image on a <select>. */
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  box-shadow: var(--shadow-xs);
  transition: border-color 150ms, box-shadow 150ms;
}
textarea.ui-input { height: auto; min-height: 4rem; padding: 0.5rem 0.75rem; }
select.ui-input { padding-inline-end: 2rem; }
/* @tailwindcss/forms draws the select arrow on the right. In right-to-left text the
   label runs into it, so move the arrow to the left there. */
[dir="rtl"] select.ui-input { background-position: left 0.5rem center; padding-inline-end: 0.75rem; padding-inline-start: 2rem; }
select.ui-input[multiple] { height: auto; }
.ui-input::placeholder { color: var(--muted-foreground); }
.ui-input:disabled { opacity: 0.5; cursor: not-allowed; }
.ui-help { margin-top: 0.375rem; font-size: 0.8125rem; color: var(--muted-foreground); }

/* Tabs ------------------------------------------------------------------ */
.ui-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  max-width: 100%;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--muted);
  overflow-x: auto;
  scrollbar-width: none;
}
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tab {
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 1.875rem;
  padding: 0 0.75rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color 150ms, background-color 150ms, box-shadow 150ms;
}
.ui-tab:hover { color: var(--foreground); }
.ui-tab[aria-current="page"],
.ui-tab[aria-selected="true"],
.ui-tab.is-active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}
@media (pointer: coarse) { .ui-tab { height: 2.5rem; } }

/* Table ----------------------------------------------------------------- */
.ui-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.ui-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ui-table th {
  height: 2.5rem;
  padding: 0 0.75rem;
  text-align: start;
  font-weight: 500;
  color: var(--muted-foreground);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.ui-table td { padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--border); color: var(--foreground); vertical-align: middle; }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table tbody tr:hover td { background: color-mix(in srgb, var(--muted) 60%, transparent); }

/* Alert ----------------------------------------------------------------- */
.ui-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.875rem;
}
.ui-alert--success { border-color: #bbf7d0; background: var(--success-soft); color: #14532d; }
.ui-alert--destructive { border-color: #fecaca; background: var(--destructive-soft); color: #7f1d1d; }
.ui-alert--info { border-color: #f9d3e3; background: var(--primary-soft); color: #7a1f49; }
.ui-alert--warning { border-color: #fde68a; background: var(--warning-soft); color: #713f12; }

/* Popover / dropdown menu / dialog ------------------------------------- */
.ui-popover {
  background: var(--popover);
  color: var(--popover-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.25rem;
}
.ui-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.375rem 0.5rem;
  border-radius: calc(var(--radius) - 4px);
  color: var(--foreground);
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
}
.ui-menu-item:hover,
.ui-menu-item:focus-visible { background: var(--accent); outline: none; }
.ui-menu-label { padding: 0.375rem 0.5rem; font-size: 0.75rem; font-weight: 500; color: var(--muted-foreground); }
.ui-separator { height: 1px; margin: 0.25rem -0.25rem; background: var(--border); border: 0; }
.ui-dialog-overlay { position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / 0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ui-dialog {
  width: 100%;
  max-width: 32rem;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* Confirm and prompt dialog --------------------------------------------- */
.ui-ask {
  width: min(28rem, calc(100vw - 2rem));
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
}
.ui-ask::backdrop { background: rgb(0 0 0 / 0.5); }
.ui-ask__form { display: grid; gap: 1rem; padding: 1.5rem; }
.ui-ask__text { margin: 0; font-size: 0.9375rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ui-ask__actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }

/* Toast ------------------------------------------------------------------ */
.ui-toast-region {
  position: fixed;
  z-index: 10000;
  inset-block-start: 4.25rem;
  inset-inline-end: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(24rem, calc(100vw - 2rem));
  pointer-events: none;
}
.ui-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--popover);
  color: var(--popover-foreground);
  font-size: 0.875rem;
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: ui-toast-in 160ms ease-out;
}
.ui-toast--error { border-color: #fecaca; background: var(--destructive-soft); color: #7f1d1d; }
.ui-toast__text { flex: 1; min-width: 0; white-space: pre-line; overflow-wrap: anywhere; }
.ui-toast__close {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: inherit;
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}
.ui-toast__close:hover { opacity: 1; background: rgb(0 0 0 / 0.06); }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(-0.375rem); } }
@media (prefers-reduced-motion: reduce) { .ui-toast { animation: none; } }

/* Page header, empty state, skeleton ------------------------------------ */
.ui-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.ui-page-title { font-size: 1.5rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; color: var(--foreground); }
.ui-page-description { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted-foreground); }
.ui-empty { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2.5rem 1.5rem; text-align: center; color: var(--muted-foreground); font-size: 0.875rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.ui-empty__title { font-size: 1rem; font-weight: 500; color: var(--foreground); }
.ui-skeleton { border-radius: calc(var(--radius) - 2px); background: var(--muted); animation: ui-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes ui-pulse { 50% { opacity: 0.5; } }
@media (prefers-reduced-motion: reduce) {
  .ui-skeleton { animation: none; }
  .ui-btn, .ui-tab, .ui-input { transition: none; }
}
