/* ============================================================
   shadcn design system — component styles
   All classes prefixed `ui-`. Driven by tokens in styles.css.
   ============================================================ */

/* ---------------------------------- Button --------------------------------- */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  white-space: nowrap; user-select: none; cursor: pointer;
  font-family: var(--font-sans); font-weight: 400; font-size: 0.875rem; line-height: 1;
  border-radius: 9999px; border: 1px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s, opacity .15s;
  outline: none; height: 2.5rem; padding: 0 1rem;
}
.ui-btn:focus-visible { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.ui-btn:disabled { opacity: .5; pointer-events: none; }
.ui-btn svg { width: 1rem; height: 1rem; flex: none; }

.ui-btn--default   {
  border-radius: 9999px;
  border: 1px solid var(--Button-inner-glow, rgba(255, 255, 255, 0.30));
  background: radial-gradient(100% 100% at 50% 0%, rgba(255, 255, 255, 0.30) 0%, rgba(255, 255, 255, 0.00) 100%), var(--Colors-grey-950, #09090B);
  color: #fff;
  box-shadow: 0 0 0 1px #121212;
}
.ui-btn--default:hover   {
  background: radial-gradient(100% 100% at 50% 0%, rgba(255, 255, 255, 0.40) 0%, rgba(255, 255, 255, 0.02) 100%), var(--Colors-grey-950, #09090B);
}
.ui-btn--secondary { background: #E8E8E8; color: #09090B; }
.ui-btn--secondary:hover { background: color-mix(in srgb, #E8E8E8 92%, #000); }
.ui-btn--destructive { background: var(--destructive); color: var(--destructive-foreground); border-color: color-mix(in srgb, var(--destructive) 82%, #fff); box-shadow: var(--shadow-sm); }
.ui-btn--destructive:hover { background: color-mix(in srgb, var(--destructive) 90%, #000); }
.ui-btn--outline   { background: var(--background); color: var(--foreground); border-color: var(--border); box-shadow: var(--shadow-sm); }
.ui-btn--outline:hover   { background: var(--accent); color: var(--accent-foreground); }
.ui-btn--ghost     { background: transparent; color: var(--foreground); }
.ui-btn--ghost:hover     { background: var(--accent); color: var(--accent-foreground); }
.ui-btn--link      { background: transparent; color: color-mix(in srgb, var(--primary) 45%, var(--foreground)); padding: 0; height: auto; }
.ui-btn--link:hover      { text-decoration: underline; }

.ui-btn--sm  { height: 2.25rem; padding: 0 .875rem; font-size: .8125rem; }
.ui-btn--lg  { height: 2.75rem; padding: 0 2rem; font-size: .9375rem; }
.ui-btn--icon{ height: 2.5rem; width: 2.5rem; padding: 0; }

/* ---------------------------------- Badge ---------------------------------- */
.ui-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  border-radius: 9999px; border: 1px solid transparent;
  padding: .175rem .625rem; font-size: .6875rem; font-weight: 500; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap;
}
.ui-badge--default     { background: var(--primary); color: var(--primary-foreground); }
.ui-badge--secondary   { background: var(--secondary); color: var(--secondary-foreground); }
.ui-badge--destructive { background: var(--destructive); color: var(--destructive-foreground); }
.ui-badge--outline     { background: transparent; color: var(--foreground); border-color: var(--border); }

/* ---------------------------- Input / Textarea ----------------------------- */
.ui-input, .ui-textarea {
  display: flex; width: 100%; font-family: var(--font-sans); font-size: .875rem;
  color: var(--foreground); background: var(--background);
  border: 1px solid var(--input); border-radius: var(--radius-md);
  padding: 0 .75rem; transition: border-color .15s, box-shadow .15s; outline: none;
}
.ui-input { height: 2.5rem; border-radius: 9999px; }
.ui-textarea { min-height: 5rem; padding: .5rem .75rem; line-height: 1.5; resize: vertical; border-radius: 18px; }
.ui-input::placeholder, .ui-textarea::placeholder { color: var(--muted-foreground); }
.ui-input:focus-visible, .ui-textarea:focus-visible {
  border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent);
}
.ui-input:disabled, .ui-textarea:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------------------------- Label ---------------------------------- */
.ui-label {
  font-size: 12px; font-weight: 500; line-height: 1; color: var(--foreground);
  display: inline-flex; align-items: center; gap: .25rem; user-select: none;
}

/* -------------------------------- Separator -------------------------------- */
.ui-separator { background: var(--border); flex: none; }
.ui-separator--h { height: 1px; width: 100%; }
.ui-separator--v { width: 1px; align-self: stretch; }

/* ---------------------------------- Card ----------------------------------- */
.ui-card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.ui-card__header { display: flex; flex-direction: column; gap: .375rem; padding: 1.25rem; }
.ui-card__title { font-size: 1.375rem; font-weight: 400; letter-spacing: -.01em; line-height: 1.1; }
.ui-card__desc { font-size: .875rem; color: var(--muted-foreground); line-height: 1.45; }
.ui-card__content { padding: 0 1.25rem 1.25rem; }
.ui-card__footer { display: flex; align-items: center; gap: .5rem; padding: 0 1.25rem 1.25rem; }

/* ---------------------------------- Alert ---------------------------------- */
.ui-alert {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: .75rem; background: var(--background); color: var(--foreground);
}
.ui-alert > svg { width: 1.375rem; height: 1.375rem; align-self: start; margin-top: -.0625rem; grid-row: span 2; color: currentColor; }
.ui-alert__title { font-weight: 400; font-size: .875rem; line-height: 1.35; }
.ui-alert__desc { font-size: .875rem; color: var(--muted-foreground); line-height: 1.45; }
.ui-alert--destructive {
  background: color-mix(in srgb, var(--destructive) 10%, var(--background));
  border-color: color-mix(in srgb, var(--destructive) 22%, transparent);
  color: var(--destructive);
}
.ui-alert--destructive .ui-alert__desc { color: var(--destructive); }

/* ---------------------------------- Avatar --------------------------------- */
.ui-avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 9999px; overflow: hidden;
  background: var(--muted); color: var(--muted-foreground); flex: none;
  font-size: .875rem; font-weight: 600; user-select: none;
}
.ui-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* -------------------------------- Skeleton --------------------------------- */
.ui-skeleton { background: var(--muted); border-radius: var(--radius-md); animation: ui-pulse 1.6s ease-in-out infinite; }
@keyframes ui-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* -------------------------------- Progress --------------------------------- */
.ui-progress { position: relative; height: .625rem; width: 100%; overflow: hidden; border-radius: 9999px; background: var(--secondary); }
.ui-progress__bar { height: 100%; background: var(--primary); border-radius: 9999px; transition: width .4s cubic-bezier(.4,0,.2,1); }

/* -------------------------------- Checkbox --------------------------------- */
.ui-checkbox {
  appearance: none; -webkit-appearance: none; cursor: pointer; flex: none;
  width: 1.15rem; height: 1.15rem; border: 1px solid var(--border); border-radius: calc(var(--radius-sm) - 1px);
  background: var(--background); display: inline-grid; place-content: center;
  transition: background-color .15s, border-color .15s; position: relative; outline: none;
}
.ui-checkbox:focus-visible { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.ui-checkbox:checked { background: var(--primary); border-color: var(--primary); }
.ui-checkbox:checked::after {
  content: ""; width: .65rem; height: .65rem; background: var(--primary-foreground);
  -webkit-mask: center/contain no-repeat url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
          mask: center/contain no-repeat url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.ui-checkbox:disabled { opacity: .5; cursor: not-allowed; }

/* --------------------------------- Switch ---------------------------------- */
.ui-switch {
  appearance: none; -webkit-appearance: none; cursor: pointer; flex: none; position: relative;
  width: 2.5rem; height: 1.4rem; border-radius: 9999px; background: var(--border);
  transition: background-color .2s; outline: none;
}
.ui-switch:focus-visible { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.ui-switch:checked { background: var(--primary); }
.ui-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.4rem - 4px); height: calc(1.4rem - 4px);
  border-radius: 9999px; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s;
}
.ui-switch:checked::after { transform: translateX(calc(2.5rem - 1.4rem)); }
.ui-switch:disabled { opacity: .5; cursor: not-allowed; }

/* ------------------------------- Radio group ------------------------------- */
.ui-radio {
  appearance: none; -webkit-appearance: none; cursor: pointer; flex: none;
  width: 1.15rem; height: 1.15rem; border: 1px solid var(--border); border-radius: 9999px;
  background: var(--background); display: inline-grid; place-content: center; transition: border-color .15s; outline: none;
}
.ui-radio:focus-visible { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.ui-radio:checked { border-color: var(--primary); }
.ui-radio:checked::after { content: ""; width: .55rem; height: .55rem; border-radius: 9999px; background: var(--primary); }
.ui-radio:disabled { opacity: .5; cursor: not-allowed; }

/* --------------------------------- Select ---------------------------------- */
.ui-select {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between; gap: .5rem;
  height: 2.5rem; width: 100%; padding: 0 .75rem; font-size: .875rem; font-family: var(--font-sans);
  color: var(--foreground); background: var(--background); border: 1px solid var(--input);
  border-radius: 9999px; cursor: pointer; outline: none; transition: border-color .15s, box-shadow .15s;
}
.ui-select[data-placeholder="true"] { color: var(--muted-foreground); }
.ui-select:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.ui-select svg { width: 1rem; height: 1rem; opacity: .55; flex: none; }
.ui-select__menu {
  position: absolute; z-index: 50; top: calc(100% + 4px); left: 0; min-width: 100%;
  background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: .25rem; overflow: hidden;
  animation: ui-pop .12s ease-out;
}
.ui-select__item {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem .4rem 1.75rem; position: relative;
  font-size: .875rem; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.ui-select__item:hover, .ui-select__item[data-active="true"] { background: var(--accent); color: var(--accent-foreground); }
.ui-select__item[data-selected="true"]::before {
  content: ""; position: absolute; left: .5rem; top: 50%; transform: translateY(-50%);
  width: .8rem; height: .8rem; background: currentColor;
  -webkit-mask: center/contain no-repeat url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
          mask: center/contain no-repeat url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

/* --------------------------------- Slider ---------------------------------- */
.ui-slider { position: relative; display: flex; align-items: center; width: 100%; height: 1.25rem; cursor: pointer; }
.ui-slider__track { position: relative; height: .375rem; width: 100%; border-radius: 9999px; background: var(--secondary); }
.ui-slider__range { position: absolute; height: 100%; border-radius: 9999px; background: var(--primary); }
.ui-slider__thumb {
  position: absolute; top: 50%; width: 1.15rem; height: 1.15rem; border-radius: 9999px;
  background: var(--background); border: 2px solid var(--primary); box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%); transition: box-shadow .15s;
}
.ui-slider__thumb:focus-visible { outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--ring) 30%, transparent); }

/* ---------------------------------- Tabs ----------------------------------- */
.ui-tabs__list {
  display: inline-flex; align-items: center; gap: .25rem; padding: .25rem;
  background: var(--secondary); border-radius: 9999px;
}
.ui-tabs__trigger {
  appearance: none; border: none; cursor: pointer; font-family: var(--font-sans);
  font-size: .8125rem; font-weight: 500; color: var(--muted-foreground);
  padding: .375rem .875rem; border-radius: 9999px; background: transparent;
  transition: background-color .15s, color .15s; white-space: nowrap; outline: none;
}
.ui-tabs__trigger:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.ui-tabs__trigger[data-active="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.ui-tabs__content { margin-top: 1rem; }

/* -------------------------------- Accordion -------------------------------- */
.ui-accordion { border-top: 1px solid var(--border); }
.ui-accordion__item { border-bottom: 1px solid var(--border); }
.ui-accordion__trigger {
  appearance: none; width: 100%; background: none; border: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 0; font-family: var(--font-sans); font-size: .9375rem; font-weight: 500; color: var(--foreground);
  outline: none;
}
.ui-accordion__trigger:hover { text-decoration: underline; }
.ui-accordion__trigger svg { width: 1rem; height: 1rem; transition: transform .2s; opacity: .6; flex: none; }
.ui-accordion__trigger[data-open="true"] svg { transform: rotate(180deg); }
.ui-accordion__panel { overflow: hidden; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.ui-accordion__panel[data-open="true"] { grid-template-rows: 1fr; }
.ui-accordion__panel > div { overflow: hidden; }
.ui-accordion__panel p { font-size: .875rem; color: var(--muted-foreground); line-height: 1.5; padding-bottom: 1rem; }

/* --------------------------------- Tooltip --------------------------------- */
.ui-tooltip-wrap { position: relative; display: inline-flex; }
.ui-tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%) translateY(4px);
  background: var(--foreground); color: var(--background); font-size: .75rem; font-weight: 500;
  padding: .375rem .5rem; border-radius: var(--radius-sm); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s, transform .15s; box-shadow: var(--shadow-md); z-index: 60;
}
.ui-tooltip-wrap:hover .ui-tooltip, .ui-tooltip-wrap:focus-within .ui-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------------- Overlays: Dialog / Sheet -------------------------- */
.ui-overlay {
  position: fixed; inset: 0; background: rgb(0 0 0 / .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: ui-fade .2s ease-out;
}
.ui-dialog {
  position: relative; width: 100%; max-width: 30rem; background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: 21px; box-shadow: var(--shadow-xl);
  padding: 1.5rem; animation: ui-zoom .2s ease-out;
}
.ui-dialog__title { font-size: 1.375rem; font-weight: 400; letter-spacing: -.01em; }
.ui-dialog__desc { font-size: .875rem; color: var(--muted-foreground); margin-top: .375rem; line-height: 1.5; }
.ui-dialog__close {
  position: absolute; top: 1rem; right: 1rem; width: 1.75rem; height: 1.75rem; display: grid; place-content: center;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--muted-foreground); background: none; border: none;
}
.ui-dialog__close:hover { background: var(--accent); color: var(--accent-foreground); }
.ui-dialog__footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.5rem; }

.ui-sheet { position: fixed; top: 0; right: 0; height: 100%; width: 100%; max-width: 24rem;
  background: var(--card); color: var(--card-foreground); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl); padding: 1.5rem; animation: ui-slide-r .25s ease-out; z-index: 101; }

/* ----------------------------- Popover / Menu ------------------------------ */
.ui-popover {
  position: absolute; z-index: 70; min-width: 12rem; background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: .75rem; animation: ui-pop .12s ease-out;
}
.ui-menu {
  position: absolute; z-index: 70; min-width: 12rem; background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: .25rem; animation: ui-pop .12s ease-out;
}
.ui-menu__label { padding: .375rem .5rem; font-size: .75rem; font-weight: 600; color: var(--muted-foreground); }
.ui-menu__item {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; font-size: .875rem;
  border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; color: var(--popover-foreground);
}
.ui-menu__item:hover { background: var(--accent); color: var(--accent-foreground); }
.ui-menu__item svg { width: 1rem; height: 1rem; opacity: .7; }
.ui-menu__item--danger { color: var(--destructive); }
.ui-menu__item--danger:hover { background: color-mix(in srgb, var(--destructive) 12%, transparent); color: var(--destructive); }
.ui-menu__sep { height: 1px; background: var(--border); margin: .25rem -.25rem; }

/* ---------------------------------- Toast ---------------------------------- */
.ui-toast-region { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 120; }
.ui-toast {
  display: flex; align-items: flex-start; gap: .75rem; min-width: 18rem; max-width: 24rem;
  background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: .875rem 1rem; animation: ui-slide-r .25s ease-out;
}
.ui-toast__title { font-size: .875rem; font-weight: 600; }
.ui-toast__desc { font-size: .8125rem; color: var(--muted-foreground); margin-top: .125rem; line-height: 1.4; }

/* ---------------------------------- Table ---------------------------------- */
.ui-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.ui-table caption { color: var(--muted-foreground); font-size: .8125rem; margin-top: .75rem; }
.ui-table thead th {
  text-align: left; font-weight: 500; color: var(--muted-foreground); height: 2.75rem;
  padding: 0 1rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.ui-table tbody td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.ui-table tbody tr:hover { background: color-mix(in srgb, var(--muted) 50%, transparent); }
.ui-table tbody tr:last-child td { border-bottom: none; }
.ui-table .ui-num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------- Breadcrumb -------------------------------- */
.ui-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; font-size: .75rem; color: var(--muted-foreground); }
.ui-breadcrumb a { color: var(--muted-foreground); text-decoration: none; transition: color .15s; }
.ui-breadcrumb a:hover { color: var(--foreground); }
.ui-breadcrumb__sep { color: var(--muted-foreground); opacity: .6; display: inline-flex; }
.ui-breadcrumb__current { color: var(--foreground); font-weight: 500; }

/* ------------------------------- Pagination -------------------------------- */
.ui-pagination { display: flex; align-items: center; gap: .25rem; }
.ui-page {
  display: inline-flex; align-items: center; justify-content: center; gap: .25rem; min-width: 2.5rem; height: 2.5rem;
  padding: 0 .625rem; border-radius: var(--radius-md); border: 1px solid transparent; background: transparent;
  color: var(--foreground); font-size: .875rem; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s; outline: none;
}
.ui-page:hover { background: var(--accent); color: var(--accent-foreground); }
.ui-page[data-active="true"] { border-color: var(--border); background: var(--background); box-shadow: var(--shadow-sm); }
.ui-page svg { width: 1rem; height: 1rem; }
.ui-page--ghost { cursor: default; }
.ui-page--ghost:hover { background: transparent; color: var(--foreground); }

/* -------------------------------- keyframes -------------------------------- */
@keyframes ui-pop   { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ui-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes ui-zoom  { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes ui-slide-r { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
