* { box-sizing: border-box; }

:root {
  font-family: Inter, sans-serif;
  font-feature-settings: 'liga' 1, 'calt' 1;
  font-optical-sizing: auto;
}

@supports (font-variation-settings: normal) {
  :root {
    font-family: InterVariable, sans-serif;
  }
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  accent-color: var(--primary);
}

/* Sembunyikan visual scrollbar di seluruh elemen yang bisa di-scroll (scroll tetap berfungsi normal) */
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

::selection {
  background: rgba(232, 80, 2, 0.34);
  color: #f9f9f9;
}

.brand-logo-img {
  display: block;
  height: 24px;
  width: auto;
  object-fit: contain;
}

.brand-logo-img.is-sidebar {
  height: 22px;
}

code, pre, kbd, samp { font-family: inherit; }

h1, h2, h3 {
  text-wrap: balance;
  letter-spacing: -0.02em;
}
p { text-wrap: pretty; }

.tabular { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.text-success { color: var(--success); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-accent { color: var(--primary); }

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:focus-visible {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 120;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 600;
  text-decoration: none;
}

:where(button, a, select, input):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* === Buttons & Controls — Shadcn Shine Glow + Emil Kowalski Tactile Motion === */
.btn, select, input[type="search"] {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  min-block-size: 40px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border);
  transition:
    transform 160ms var(--ease-spring),
    background-color 180ms var(--ease-spring),
    border-color 180ms var(--ease-spring),
    box-shadow 200ms var(--ease-spring),
    color 180ms var(--ease-spring),
    opacity 160ms ease;
}

.btn {
  position: relative;
  overflow: hidden;
  padding: 8px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  user-select: none;
}

/* Emil Kowalski: exact 0.96 scale on press */
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }

/* Primary: Shadcn-style Shine Glow Button (#F16001 -> #E85002 -> #C10801) */
.btn-primary {
  background: linear-gradient(180deg, #f16001 0%, #e85002 58%, #c10801 100%);
  color: var(--primary-fg);
  border-color: rgba(249, 249, 249, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(249, 249, 249, 0.36),
    0 1px 2px rgba(0, 0, 0, 0.55),
    var(--primary-glow);
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(249, 249, 249, 0.34) 48%,
    transparent 76%
  );
  transform: translateX(-130%) skewX(-16deg);
  transition: transform 520ms var(--ease-spring);
  pointer-events: none;
}

.btn-primary:hover:not(:disabled) {
  border-color: rgba(217, 195, 171, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(249, 249, 249, 0.48),
    0 2px 8px rgba(0, 0, 0, 0.65),
    0 0 34px -4px rgba(232, 80, 2, 0.85);
}

.btn-primary:hover:not(:disabled)::after {
  transform: translateX(130%) skewX(-16deg);
}

/* Ghost & Secondary with subtle specular border glow */
.btn-ghost {
  background: rgba(239, 236, 227, 0.04);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--highlight-top);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(239, 236, 227, 0.09);
  border-color: var(--border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 14px -6px rgba(0, 0, 0, 0.6);
}

.btn-warn {
  background: #141414;
  color: var(--text);
  border: none;
  font-weight: 500;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.5);
}
.btn-warn:hover:not(:disabled) {
  background: #1c1c1c;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 4px 14px rgba(0, 0, 0, 0.65);
}
.btn-warn .tabular {
  color: var(--primary);
  font-weight: 700;
}

.btn-danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 0 20px -6px rgba(239, 68, 68, 0.5);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.24);
  font-weight: 600;
}
.btn-danger-soft:hover:not(:disabled) { background: rgba(248, 113, 113, 0.22); }

.btn-sm { min-block-size: 36px; padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border);
  background: rgba(239, 236, 227, 0.04);
  color: var(--text);
  box-shadow: var(--highlight-top);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 160ms var(--ease-spring), background-color 160ms ease, border-color 160ms ease;
}
.icon-btn:hover { background: rgba(239, 236, 227, 0.1); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.96); }

/* === Custom Branded <select> (Fallback + Modern appearance: base-select) === */
select {
  appearance: none;
  -webkit-appearance: none;
  min-inline-size: 168px;
  background-color: var(--surface-elevated);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a7a7a7' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color: var(--text);
  padding: 8px 36px 8px 13px;
  border: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

select:hover {
  background-color: #181818;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

select:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 1px var(--primary),
    0 0 0 3px rgba(232, 80, 2, 0.24);
}

select option {
  background-color: #121212;
  color: #f9f9f9;
}

@supports (appearance: base-select) {
  select,
  select::picker(select) {
    appearance: base-select;
  }

  select {
    background-image: none;
    padding-right: 12px;
    align-items: center;
    gap: 10px;
  }

  select::picker-icon {
    color: var(--muted);
    transition: transform 180ms var(--ease-spring), color 160ms ease;
  }

  select:open::picker-icon {
    transform: rotate(180deg);
    color: var(--text);
  }

  select::picker(select) {
    background: #121212;
    color: var(--text);
    border: none;
    border-radius: 12px;
    padding: 6px;
    margin-block-start: 6px;
    box-shadow: var(--shadow-modal);
  }

  select option {
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: background-color 140ms ease, color 140ms ease;
  }

  select option:hover,
  select option:focus {
    background: rgba(255, 255, 255, 0.08);
  }

  select option:checked {
    background: var(--primary-soft);
    color: #f9f9f9;
    font-weight: 600;
  }

  select option::checkmark {
    color: var(--primary);
  }
}

/* === Custom Toggle Switch Checkbox (Obsidian & Molten Orange) === */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 46px;
  height: 26px;
  min-block-size: 26px;
  flex-shrink: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: #242424;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 2px 4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: background-color 180ms var(--ease-spring), box-shadow 200ms var(--ease-spring), transform 140ms var(--ease-spring);
}

input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f9f9f9;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  transition: transform 200ms var(--ease-spring);
}

input[type="checkbox"]:hover {
  background: #2d2d2d;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.18),
    inset 0 2px 4px rgba(0, 0, 0, 0.45);
}

input[type="checkbox"]:checked {
  background: linear-gradient(180deg, #f16001 0%, #e85002 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 0 16px -3px rgba(232, 80, 2, 0.72);
}

input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

input[type="checkbox"]:active::before {
  transform: scale(0.92);
}

input[type="checkbox"]:checked:active::before {
  transform: translateX(20px) scale(0.92);
}

/* Custom clear button pada input[type="search"] */
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(249, 249, 249, 0.14) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23f9f9f9' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E") center / 10px no-repeat;
  cursor: pointer;
}

input[type="search"]::-webkit-search-cancel-button:hover {
  background-color: rgba(232, 80, 2, 0.65);
}

/* Modern Searchbar with icon + focus ring glow */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: min(320px, 100%);
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
  display: grid;
  place-items: center;
  transition: color 180ms ease;
}

.search-box input[type="search"] {
  width: 100%;
  background: rgba(239, 236, 227, 0.04);
  color: var(--text);
  padding: 8px 38px 8px 36px;
  border-color: var(--border);
  box-shadow: var(--highlight-top);
}

.search-box input[type="search"]::placeholder { color: var(--muted); opacity: 0.78; }

.search-box input[type="search"]:hover {
  background: rgba(239, 236, 227, 0.07);
  border-color: var(--border-strong);
}

.search-box input[type="search"]:focus {
  outline: none;
  background: var(--surface-elevated);
  border-color: rgba(235, 94, 40, 0.65);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 3px rgba(235, 94, 40, 0.18),
    0 0 22px -8px rgba(235, 94, 40, 0.45);
}

.search-box:focus-within .search-icon { color: var(--primary); }

.search-kbd {
  position: absolute;
  right: 10px;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.search-box:focus-within .search-kbd { opacity: 0; }

kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: rgba(239, 236, 227, 0.07);
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  .btn-primary::after { display: none; }
}
