/* ==========================================================================
   Poodle design system
   The shadcn/ui token set and component anatomy, written as plain CSS so it
   works with Blade. Same variables, same radii, same focus rings — the parts
   that make shadcn look the way it does — without needing React.
   ========================================================================== */

:root {
  /* neutrals */
  --background:            0 0% 100%;
  --foreground:            240 10% 3.9%;
  --card:                  0 0% 100%;
  --card-foreground:       240 10% 3.9%;
  --popover:               0 0% 100%;
  --popover-foreground:    240 10% 3.9%;

  /* Poodle orange, kept as the primary so the product stays recognisable */
  --primary:               24 94% 56%;
  --primary-foreground:    0 0% 100%;
  --primary-soft:          28 100% 96%;

  --secondary:             240 4.8% 95.9%;
  --secondary-foreground:  240 5.9% 10%;
  --muted:                 240 4.8% 95.9%;
  --muted-foreground:      240 3.8% 46.1%;
  --accent:                240 4.8% 95.9%;
  --accent-foreground:     240 5.9% 10%;

  --destructive:           0 72% 51%;
  --destructive-foreground: 0 0% 100%;
  --success:               142 71% 33%;
  --success-soft:          142 60% 96%;
  --warning:               38 92% 45%;
  --warning-soft:          45 100% 96%;

  --border:                240 5.9% 90%;
  --input:                 240 5.9% 90%;
  --ring:                  24 94% 56%;

  --radius: 0.875rem;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: "Noto Sans Arabic", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --shadow-sm: none;
  --shadow:    none;
  --shadow-md: 0 1px 3px 0 hsl(240 6% 10% / .06);
  --shadow-lg: 0 8px 24px -8px hsl(240 6% 10% / .14);
}

.dark {
  --background:            240 10% 3.9%;
  --foreground:            0 0% 98%;
  --card:                  240 8% 6.5%;
  --card-foreground:       0 0% 98%;
  --popover:               240 8% 7.5%;
  --popover-foreground:    0 0% 98%;

  --primary:               24 94% 56%;
  --primary-foreground:    0 0% 100%;
  --primary-soft:          24 40% 14%;

  --secondary:             240 3.7% 15.9%;
  --secondary-foreground:  0 0% 98%;
  --muted:                 240 3.7% 15.9%;
  --muted-foreground:      240 5% 64.9%;
  --accent:                240 3.7% 15.9%;
  --accent-foreground:     0 0% 98%;

  --destructive:           0 63% 45%;
  --destructive-foreground: 0 0% 98%;
  --success:               142 60% 45%;
  --success-soft:          142 40% 12%;
  --warning:               38 90% 55%;
  --warning-soft:          38 45% 13%;

  --border:                240 3.7% 17%;
  --input:                 240 3.7% 20%;
  --ring:                  24 94% 56%;

  --shadow-sm: none;
  --shadow:    none;
  --shadow-md: 0 1px 3px 0 hsl(0 0% 0% / .3);
  --shadow-lg: 0 8px 24px -8px hsl(0 0% 0% / .5);
}

/* ---------------------------------------------------------------- base --- */

*, *::before, *::after { box-sizing: border-box; border-color: hsl(var(--border)); }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[dir="rtl"] body { font-family: var(--font-arabic); line-height: 1.85; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.0625rem; }
p  { margin: 0 0 1rem; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

small { font-size: 0.8125rem; }
code, kbd, pre, .mono, .vnum { font-family: var(--font-mono); font-variant-ligatures: none; }

hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: 1.5rem 0; }

::selection { background: hsl(var(--primary) / .18); }

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: calc(var(--radius) - 4px);
}

/* thin scrollbars, matching the surface */
* { scrollbar-width: thin; scrollbar-color: hsl(var(--border)) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / .5); background-clip: content-box; }

/* ------------------------------------------------------------ primitives - */

.icon { width: 1rem; height: 1rem; flex: none; stroke: currentColor; fill: none;
        stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 0.875rem; height: 0.875rem; }

/* button ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: 2.75rem; padding: 0 1.375rem;
  border: 1px solid transparent; border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font: inherit; font-size: 0.875rem; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: hsl(var(--primary) / .9); color: hsl(var(--primary-foreground)); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn.busy { opacity: .6; pointer-events: none; }
.btn[disabled] {
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
  border-color: hsl(var(--border)); box-shadow: none; cursor: not-allowed; pointer-events: none;
}

.btn.ghost, .btn.ghost-line {
  background: hsl(var(--background)); color: hsl(var(--foreground));
  border-color: hsl(var(--border)); box-shadow: var(--shadow-sm);
}
.btn.ghost:hover, .btn.ghost-line:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.btn.danger {
  background: hsl(var(--background)); color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / .35); box-shadow: var(--shadow-sm);
}
.btn.danger:hover { background: hsl(var(--destructive) / .08); color: hsl(var(--destructive)); }

.btn.sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.btn.lg { height: 3.25rem; padding: 0 2rem; font-size: 1rem; border-radius: 999px; }

/* card -------------------------------------------------------------------- */
.card, .box, .panel, .tile {
  background: hsl(var(--card)); color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* badge ------------------------------------------------------------------- */
.badge, .pill, .tag, .chip-on, .chip-off, .level, .soon {
  display: inline-flex; align-items: center; gap: 0.25rem;
  border: 1px solid transparent; border-radius: 999px;
  padding: 0.125rem 0.5rem; font-size: 0.75rem; font-weight: 500; line-height: 1.4;
  white-space: nowrap;
}
.badge, .chip-off, .tag {
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--border));
}
.badge.ok  { background: hsl(var(--success-soft)); color: hsl(var(--success)); border-color: hsl(var(--success) / .25); }
.badge.latest, .pill, .chip-on, .level.update {
  background: hsl(var(--primary-soft)); color: hsl(var(--primary)); border-color: hsl(var(--primary) / .28);
}
.badge.draft { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.soon, .level.warning { background: hsl(var(--warning-soft)); color: hsl(var(--warning)); border-color: hsl(var(--warning) / .3); }
.level.info { background: hsl(210 100% 96%); color: hsl(215 90% 42%); border-color: hsl(215 90% 42% / .25); }
.dark .level.info { background: hsl(215 60% 14%); color: hsl(210 90% 68%); }

/* form controls ----------------------------------------------------------- */
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=tel], input[type=date], input[type=datetime-local], input[type=search],
input[type=number], select, textarea {
  width: 100%; height: 2.5rem; padding: 0 0.75rem;
  font: inherit; font-size: 0.875rem;
  color: hsl(var(--foreground)); background: hsl(var(--background));
  border: 1px solid hsl(var(--input)); border-radius: calc(var(--radius) - 2px);
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 6rem; padding: 0.625rem 0.75rem; resize: vertical; line-height: 1.6; }
select {
  appearance: none; padding-inline-end: 2rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.625rem center; background-size: 1rem;
}
html[dir="rtl"] select { background-position: left 0.625rem center; }

input:focus, select:focus, textarea:focus {
  outline: none; border-color: hsl(var(--ring)); box-shadow: 0 0 0 3px hsl(var(--ring) / .15);
}
input::placeholder, textarea::placeholder { color: hsl(var(--muted-foreground)); }
input[type=file] {
  height: auto; padding: 0.5rem 0.75rem; cursor: pointer;
  background: hsl(var(--muted)); font-size: 0.8125rem;
}
input[type=checkbox] { accent-color: hsl(var(--primary)); width: 1rem; height: 1rem; }

.field { margin-bottom: 1.125rem; }
.field label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.4375rem; }
.field .help, .help { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); margin-top: 0.4375rem; line-height: 1.55; }

/* table ------------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: start; padding: 0.75rem 1rem; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
th { font-weight: 500; color: hsl(var(--muted-foreground)); background: hsl(var(--muted) / .5); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: hsl(var(--muted) / .45); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }

/* alert ------------------------------------------------------------------- */
.flash, .errors, .note {
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  padding: 0.875rem 1rem; margin-bottom: 1.25rem; font-size: 0.875rem;
}
.flash, .note.ok { background: hsl(var(--success-soft)); border-color: hsl(var(--success) / .3); color: hsl(var(--success)); }
.errors, .note.err { background: hsl(var(--destructive) / .07); border-color: hsl(var(--destructive) / .3); color: hsl(var(--destructive)); }
.errors ul, .note ul { margin: 0.25rem 0 0; padding-inline-start: 1.125rem; }

/* misc -------------------------------------------------------------------- */
.empty { padding: 2.5rem 1rem; text-align: center; color: hsl(var(--muted-foreground)); font-size: 0.875rem; }
.lead { color: hsl(var(--muted-foreground)); }
.pw-note { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); margin: 0.5rem 0 0; }

.separator { height: 1px; background: hsl(var(--border)); border: 0; margin: 1.5rem 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* theme toggle: show the icon for the mode you would switch to */
[data-theme-toggle] .moon { display: none; }
[data-theme-toggle] .sun  { display: block; }
.dark [data-theme-toggle] .moon { display: block; }
.dark [data-theme-toggle] .sun  { display: none; }

/* a copy button confirms itself for a moment */
.btn.copied, .btn.ghost.copied {
  background: hsl(var(--success)); border-color: transparent; color: #fff;
}

/* url row: a copyable address, used on the site and in the admin panel */
.urlrow {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.375rem 0.375rem 0.375rem 0.75rem;
  background: hsl(var(--muted) / .6); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
}
html[dir="rtl"] .urlrow { padding: 0.375rem 0.75rem 0.375rem 0.375rem; }
.urlrow code {
  flex: 1; min-width: 0; font-size: 0.75rem; direction: ltr; text-align: start;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.urlrow .btn { flex: none; }

/* stars */
.stars { display: inline-flex; gap: 0.0625rem; vertical-align: middle; }
.stars svg { width: 0.9375rem; height: 0.9375rem; fill: hsl(var(--border)); stroke: none; }
.stars svg.on { fill: hsl(38 92% 50%); }
.stars.lg svg { width: 1.25rem; height: 1.25rem; }

/* ================= right-to-left scripts =================
   Arabic-script letters join to each other. Any letter-spacing pulls them
   apart, and a monospace font has no Arabic glyphs, so the browser falls
   back glyph by glyph and the word breaks up. Both are fine for Latin text
   and wrong here, so they are undone for every right-to-left page. */
html[dir="rtl"] * { letter-spacing: 0 !important; }

html[dir="rtl"] .mono,
html[dir="rtl"] .os-ver,
html[dir="rtl"] .tile-meta,
html[dir="rtl"] .nav-card-text span,
html[dir="rtl"] .update-k,
html[dir="rtl"] .rating-bar,
html[dir="rtl"] .up-foot,
html[dir="rtl"] .file-sub {
  font-family: var(--font-arabic);
}

/* numbers, versions, addresses and code stay monospaced and left-to-right */
html[dir="rtl"] .vnum,
html[dir="rtl"] .num,
html[dir="rtl"] code,
html[dir="rtl"] kbd,
html[dir="rtl"] pre,
html[dir="rtl"] [dir="ltr"] {
  font-family: var(--font-mono);
  direction: ltr;
  unicode-bidi: isolate;
}
