/*
 * Kolabaja UI kit (26 Nov 2026: "dropdown dan form-nya dipercantik, modern, jangan flat; animasi ciamik").
 * One file for creator, brand, buyer pages and Kelas (copy at kelas/public/kb-ui.css, kept identical by a test).
 *
 * - Fields: every text-like input, select and textarea inside <body class="kb-ui"> gets the same soft, raised look:
 *   paper gradient, hairline border, inner + drop shadow, a red glow ring on focus, a short shake when invalid.
 * - Select: our own chevron (rotates while open); the open list is drawn by kb-ui.js (.kb-list) on computers.
 * - Checkbox / radio: drawn boxes with a pop on check. File: a pill "Pilih file" button in a dashed drop zone.
 * - Buttons (.btn, submit buttons): depth, lift on hover, press on click, a ripple from the click point (kb-ui.js).
 * The dropdown list (.kb-list) is global, so pages without .kb-ui (admin, landing) get it too.
 * Opt out per element or container with data-kb-plain. prefers-reduced-motion: no movement, only colour.
 */

:root {
  --kb-ink: #12110e;
  --kb-muted: #6d665b;
  --kb-red: #b52a2a;
  --kb-red-2: #d6413a;
  --kb-paper: #fffdf9;
  --kb-paper-2: #f8f4ec;
  --kb-line: rgba(18, 17, 14, 0.13);
  --kb-line-2: rgba(18, 17, 14, 0.24);
  --kb-ring: rgba(214, 65, 58, 0.16);
  --kb-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --kb-spring: cubic-bezier(0.18, 0.89, 0.32, 1.22);
}

/* ---------- Fields ---------- */
.kb-ui
  :is(
    input:not([type]),
    input[type='text'],
    input[type='email'],
    input[type='password'],
    input[type='tel'],
    input[type='number'],
    input[type='url'],
    input[type='search'],
    input[type='date'],
    input[type='datetime-local'],
    input[type='time'],
    input[type='month'],
    select,
    textarea
  ):not([data-kb-plain]):not([data-kb-plain] *) {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  max-width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--kb-line);
  background:
    linear-gradient(180deg, #fff 0%, var(--kb-paper) 55%, var(--kb-paper-2) 100%) padding-box;
  color: var(--kb-ink);
  font: 400 16px/1.35 var(--font, 'General Sans', system-ui, sans-serif);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(18, 17, 14, 0.03),
    0 1px 2px rgba(18, 17, 14, 0.05),
    0 6px 16px -10px rgba(18, 17, 14, 0.22);
  transition:
    border-color 0.2s var(--kb-ease),
    box-shadow 0.25s var(--kb-ease),
    background-color 0.2s var(--kb-ease),
    transform 0.2s var(--kb-ease);
  outline: none;
}
.kb-ui textarea:not([data-kb-plain]):not([data-kb-plain] *) {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}
.kb-ui :is(input, select, textarea):not([data-kb-plain]):not([data-kb-plain] *)::placeholder {
  color: #a19a8e;
  opacity: 1;
}
.kb-ui :is(input, select, textarea):not([type='checkbox']):not([type='radio']):not([type='file']):not([data-kb-plain]):not([data-kb-plain] *):hover {
  border-color: var(--kb-line-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(18, 17, 14, 0.06),
    0 10px 22px -12px rgba(18, 17, 14, 0.3);
}
.kb-ui :is(input, select, textarea):not([type='checkbox']):not([type='radio']):not([type='file']):not([data-kb-plain]):not([data-kb-plain] *):focus,
.kb-ui select.ks-open:not([data-kb-plain]) {
  border-color: var(--kb-red-2);
  background: #fff;
  box-shadow:
    0 0 0 4px var(--kb-ring),
    0 12px 26px -14px rgba(181, 42, 42, 0.45);
}
.kb-ui :is(input, textarea):not([data-kb-plain]):read-only:not([type='checkbox']):not([type='radio']):not([type='file']) {
  background: var(--kb-paper-2);
}
.kb-ui :is(input, select, textarea):not([data-kb-plain]):disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
/* Invalid only after the visitor touched it (no red wall on page load). */
.kb-ui :is(input, select, textarea):not([data-kb-plain]):user-invalid {
  border-color: var(--kb-red);
  box-shadow: 0 0 0 4px rgba(181, 42, 42, 0.1);
  animation: kb-shake 0.36s var(--kb-ease);
}
@keyframes kb-shake {
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}

/* Filter bars and toolbars (search + status filter): compact pills, same depth. */
.kb-ui :is(.toolbar, .filters, [data-kb-compact]) :is(input, select):not([type='checkbox']):not([type='radio']):not([data-kb-plain]) {
  min-height: 42px;
  padding-top: 8px;
  padding-bottom: 8px;
  border-radius: 999px;
  font-size: 15px;
}

/* Select chevron (rotates while our list is open). */
.kb-ui select:not([multiple]):not([size]):not([data-kb-plain]):not([data-kb-plain] *) {
  padding-right: 48px;
  cursor: pointer;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b52a2a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #fff 0%, var(--kb-paper) 55%, var(--kb-paper-2) 100%);
  background-repeat: no-repeat, no-repeat;
  background-position: right 16px center, 0 0;
  background-size: 18px 18px, 100% 100%;
}
.kb-ui select.ks-open:not([data-kb-plain]) {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b52a2a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E"),
    linear-gradient(#fff, #fff);
}

/* Labels above fields: a touch bolder, and the label of the focused field turns red. */
.kb-ui label:has(> :is(input, select, textarea):focus):not([data-kb-plain]) {
  color: var(--kb-red);
  transition: color 0.2s var(--kb-ease);
}

/* ---------- Checkbox and radio ---------- */
.kb-ui :is(input[type='checkbox'], input[type='radio']):not([data-kb-plain]):not([data-kb-plain] *):not([role='switch']) {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0 8px 0 0;
  vertical-align: -5px;
  border-radius: 7px;
  border: 1.5px solid var(--kb-line-2);
  background: linear-gradient(180deg, #fff, var(--kb-paper-2));
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px -3px rgba(18, 17, 14, 0.3);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background 0.2s var(--kb-ease), border-color 0.2s var(--kb-ease), box-shadow 0.2s var(--kb-ease), transform 0.15s var(--kb-ease);
}
.kb-ui input[type='radio']:not([data-kb-plain]):not([data-kb-plain] *) {
  border-radius: 50%;
}
.kb-ui :is(input[type='checkbox'], input[type='radio']):not([data-kb-plain]):not([data-kb-plain] *):not([role='switch'])::before {
  content: '';
  width: 12px;
  height: 12px;
  transform: scale(0);
  transition: transform 0.28s var(--kb-spring);
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.kb-ui input[type='radio']:not([data-kb-plain]):not([data-kb-plain] *)::before {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  clip-path: none;
}
.kb-ui :is(input[type='checkbox'], input[type='radio']):not([data-kb-plain]):not([data-kb-plain] *):not([role='switch']):checked {
  border-color: transparent;
  background: linear-gradient(160deg, var(--kb-red-2), var(--kb-red));
  box-shadow: 0 6px 14px -6px rgba(181, 42, 42, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: kb-pop 0.32s var(--kb-spring);
}
.kb-ui :is(input[type='checkbox'], input[type='radio']):not([data-kb-plain]):not([data-kb-plain] *):not([role='switch']):checked::before {
  transform: scale(1);
}
.kb-ui :is(input[type='checkbox'], input[type='radio']):not([data-kb-plain]):not([data-kb-plain] *):focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--kb-ring);
}
@keyframes kb-pop {
  0% { transform: scale(0.82); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ---------- File ---------- */
.kb-ui input[type='file']:not([data-kb-plain]):not([data-kb-plain] *) {
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  border-radius: 16px;
  border: 1.5px dashed var(--kb-line-2);
  background: repeating-linear-gradient(135deg, rgba(18, 17, 14, 0.015) 0 10px, transparent 10px 20px), var(--kb-paper);
  color: var(--kb-muted);
  font: 400 14px/1.3 var(--font, system-ui, sans-serif);
  cursor: pointer;
  transition: border-color 0.2s var(--kb-ease), background-color 0.2s var(--kb-ease), box-shadow 0.2s var(--kb-ease);
}
.kb-ui input[type='file']:not([data-kb-plain]):hover,
.kb-ui input[type='file']:not([data-kb-plain]).kb-drag {
  border-color: var(--kb-red-2);
  background-color: #fff;
  box-shadow: 0 0 0 4px var(--kb-ring);
}
.kb-ui input[type='file']:not([data-kb-plain]):not([data-kb-plain] *)::file-selector-button {
  margin-right: 12px;
  padding: 10px 16px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, #24221d, var(--kb-ink));
  color: #fff8ea;
  font: 600 14px/1 var(--font, system-ui, sans-serif);
  cursor: pointer;
  box-shadow: 0 6px 14px -8px rgba(18, 17, 14, 0.8);
  transition: transform 0.15s var(--kb-ease), background 0.2s var(--kb-ease);
}
.kb-ui input[type='file']:not([data-kb-plain]):hover::file-selector-button {
  background: linear-gradient(180deg, var(--kb-red-2), var(--kb-red));
}

/* ---------- Buttons ----------
   Zero specificity (:where): a page's own button design (hard offset shadows, pills) wins; plain buttons get depth. */
:where(.kb-ui) :where(.btn, button[type='submit'], input[type='submit']):where(:not([data-kb-plain])) {
  position: relative;
  isolation: isolate;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(18, 17, 14, 0.08),
    0 8px 18px -12px rgba(18, 17, 14, 0.45);
  transition:
    transform 0.18s var(--kb-ease),
    box-shadow 0.25s var(--kb-ease),
    background-color 0.2s var(--kb-ease),
    border-color 0.2s var(--kb-ease),
    filter 0.2s var(--kb-ease);
}
@media (hover: hover) {
  :where(.kb-ui) :where(.btn, button[type='submit'], input[type='submit']):where(:not([data-kb-plain]):not(:disabled)):hover {
    transform: translateY(-1px);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.35),
      0 2px 4px rgba(18, 17, 14, 0.08),
      0 14px 26px -14px rgba(18, 17, 14, 0.5);
  }
}
:where(.kb-ui) :where(.btn, button[type='submit'], input[type='submit']):where(:not([data-kb-plain]):not(:disabled)):active {
  transform: translateY(1px) scale(0.985);
  box-shadow: inset 0 2px 4px rgba(18, 17, 14, 0.14), 0 2px 6px -4px rgba(18, 17, 14, 0.4);
}
:where(.kb-ui) :where(.btn, button):where(:not([data-kb-plain])):focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--kb-ring), 0 8px 18px -12px rgba(18, 17, 14, 0.45);
}
/* Creator portal (.cp): a form's main button without its own colour is ink, red on hover (was a flat grey). */
.kb-ui .cp form :is(button[type='submit'], input[type='submit']).btn:not(.btn-solid):not(.cp-btn-soft):not(.cp-btn-quiet):not([data-kb-plain]),
.kb-ui .cp form button:not([type]).btn:not(.btn-solid):not(.cp-btn-soft):not(.cp-btn-quiet):not([data-kb-plain]) {
  background: linear-gradient(180deg, #2a2722, var(--kb-ink));
  color: #fff8ea;
  border-color: transparent;
}
.kb-ui .cp form :is(button[type='submit'], input[type='submit']).btn:not(.btn-solid):not(.cp-btn-soft):not(.cp-btn-quiet):not([data-kb-plain]):hover,
.kb-ui .cp form button:not([type]).btn:not(.btn-solid):not(.cp-btn-soft):not(.cp-btn-quiet):not([data-kb-plain]):hover {
  background: linear-gradient(180deg, var(--kb-red-2), var(--kb-red));
  border-color: transparent;
}

/* Ripple (kb-ui.js adds the span on press). */
.kb-ripple {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.kb-ripple i {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.22;
  transform: scale(0);
  animation: kb-ripple 0.6s var(--kb-ease) forwards;
}
@keyframes kb-ripple {
  to { transform: scale(var(--kb-r, 40)); opacity: 0; }
}

/* ---------- Dropdown list (computers; phones keep the native picker) ---------- */
.kb-list {
  position: fixed;
  z-index: 2147483000;
  margin: 0;
  padding: 6px;
  list-style: none;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 18px;
  border: 1px solid rgba(18, 17, 14, 0.08);
  background: rgba(255, 253, 249, 0.94);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 2px 6px rgba(18, 17, 14, 0.06),
    0 28px 60px -20px rgba(18, 17, 14, 0.42);
  color: var(--kb-ink);
  font: 400 15px/1.3 var(--font, 'General Sans', system-ui, sans-serif);
  transform-origin: top center;
  animation: kb-list-in 0.26s var(--kb-spring) both;
  scrollbar-width: thin;
}
.kb-list.ks-up {
  transform-origin: bottom center;
  animation-name: kb-list-in-up;
}
.kb-list.ks-out {
  animation: kb-list-out 0.14s var(--kb-ease) both;
}
@keyframes kb-list-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes kb-list-in-up {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes kb-list-out {
  to { opacity: 0; transform: translateY(-4px) scale(0.98); }
}
.kb-list .kb-search {
  position: sticky;
  top: -6px;
  z-index: 1;
  margin: -6px -6px 6px;
  padding: 8px;
  background: rgba(255, 253, 249, 0.96);
  border-bottom: 1px solid rgba(18, 17, 14, 0.07);
  list-style: none;
}
.kb-list .kb-search input {
  box-sizing: border-box;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px 8px 36px;
  border-radius: 12px;
  border: 1.5px solid var(--kb-line);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d665b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") no-repeat 11px center / 17px;
  font: 400 15px/1.2 var(--font, system-ui, sans-serif);
  color: var(--kb-ink);
  outline: none;
  box-shadow: none;
}
.kb-list .kb-search input:focus {
  border-color: var(--kb-red-2);
  box-shadow: 0 0 0 3px var(--kb-ring);
}
.kb-list .ks-group {
  padding: 10px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kb-muted);
}
.kb-list [role='option'] {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s var(--kb-ease), color 0.15s var(--kb-ease), padding 0.2s var(--kb-ease);
  animation: kb-opt-in 0.3s var(--kb-ease) both;
  animation-delay: calc(var(--i, 0) * 16ms);
}
@keyframes kb-opt-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}
.kb-list [role='option'] .ks-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-list [role='option'].ks-empty {
  color: var(--kb-muted);
}
.kb-list [role='option'].ks-active {
  background: linear-gradient(90deg, rgba(214, 65, 58, 0.12), rgba(214, 65, 58, 0.05));
  color: var(--kb-red);
  padding-left: 18px;
}
.kb-list [role='option'].ks-active::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 4px;
  height: 18px;
  margin-top: -9px;
  border-radius: 4px;
  background: var(--kb-red-2);
}
.kb-list [role='option'][aria-selected='true'] {
  font-weight: 600;
}
.kb-list [role='option'][aria-disabled='true'] {
  opacity: 0.4;
  cursor: default;
}
.kb-list [role='option'][hidden] {
  display: none;
}
.kb-list .ks-check {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--kb-red);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s var(--kb-ease), transform 0.25s var(--kb-spring);
}
.kb-list [aria-selected='true'] .ks-check {
  opacity: 1;
  transform: none;
}
.kb-list .kb-none {
  padding: 14px;
  color: var(--kb-muted);
  font-size: 14px;
  text-align: center;
  list-style: none;
}

@media (prefers-reduced-motion: reduce) {
  .kb-list,
  .kb-list [role='option'],
  .kb-ui :is(input, select, textarea, .btn, button),
  .kb-ripple i {
    animation: none !important;
    transition: none !important;
  }
}
