/* UZU designed controls (shared by base.html, owner_center/pc_layout.html, owner_center/mobile_layout.html).
   1) Designed file picker: static/js/uzu-file-input.js wraps every input[type=file] (except [data-native-file],
      [hidden] or already visually hidden custom pickers) in .uzu-file = [button] [file name / count] [지우기].
      The real input stays in place (transparent, covering the box): click, keyboard, label[for], drag & drop,
      required validation, accept and multiple keep the browser's own behaviour.
   2) No-JS fallback / safety net: ::file-selector-button is styled with the same tokens, so the OS button
      never shows even before (or without) the script.
   3) Safety net for <button>/input buttons with no class: zero-specificity (:where) flat look so a missing
      design class never falls back to the OS button. Any contextual rule overrides it.
   Tokens are re-pointed per design system: default (base.html pages: admin, auth, legacy), .oc (owner PC),
   body.ua (consumer app, instructor app, owner mobile), .adm (관리자 콘솔 v2 셸), .am-shell / .am-drawer (광고 관리자). Flat, no gradients. */

:root {
  --uzu-file-accent: #0f5fc2;          /* button text / icon */
  --uzu-file-accent-bg: #ffffff;       /* button fill */
  --uzu-file-accent-line: #b9d3f3;     /* button border */
  --uzu-file-hover-bg: #eef5fe;
  --uzu-file-line: #dfe5ee;            /* box border */
  --uzu-file-surface: #ffffff;
  --uzu-file-text: #1d2433;
  --uzu-file-muted: #6b7686;
  --uzu-file-danger: #d92d20;
  --uzu-file-focus: #1879ec;
  --uzu-file-radius: 12px;
  --uzu-file-btn-radius: 9px;
  --uzu-file-h: 48px;
  --uzu-file-btn-h: 34px;
  --uzu-file-fs: 14px;
  --uzu-btn-bg: #f2f5f9;
  --uzu-btn-line: #dce4ee;
  --uzu-btn-radius: 8px;
}
.oc {
  --uzu-file-accent: #0f5fc2; --uzu-file-accent-bg: #ffffff; --uzu-file-accent-line: #b9d3f3; --uzu-file-hover-bg: #e8f1fd;
  --uzu-file-line: #d3dce8; --uzu-file-text: #162137; --uzu-file-muted: #5c6c82; --uzu-file-danger: #b42318; --uzu-file-focus: #1879ec;
  --uzu-file-radius: 5px; --uzu-file-btn-radius: 4px; --uzu-file-h: 40px; --uzu-file-btn-h: 28px; --uzu-file-fs: 14px;
  --uzu-btn-bg: #f2f5f9; --uzu-btn-line: #e9edf3; --uzu-btn-radius: 5px;
}
body.ua {
  --uzu-file-accent: #0062d6; --uzu-file-accent-bg: #ebf4ff; --uzu-file-accent-line: #ebf4ff; --uzu-file-hover-bg: #dcebff;
  --uzu-file-line: #e1e6ec; --uzu-file-text: #191919; --uzu-file-muted: #8b95a1; --uzu-file-danger: #f04452; --uzu-file-focus: #0878ff;
  --uzu-file-radius: 12px; --uzu-file-btn-radius: 10px; --uzu-file-h: 52px; --uzu-file-btn-h: 36px; --uzu-file-fs: 15px;
  --uzu-btn-bg: #f3f5f8; --uzu-btn-line: #e1e6ec; --uzu-btn-radius: 10px;
}
.adm { /* 관리자 콘솔 v2 셸 (admin/_shell.html) */
  --uzu-file-accent: #1a3fa8; --uzu-file-accent-bg: #ffffff; --uzu-file-accent-line: #c9d6f5; --uzu-file-hover-bg: #eef3ff;
  --uzu-file-line: #cfd6e2; --uzu-file-text: #1d2433; --uzu-file-muted: #5b6578; --uzu-file-danger: #b42318; --uzu-file-focus: #1a3fa8;
  --uzu-file-radius: 8px; --uzu-file-btn-radius: 6px; --uzu-file-h: 40px; --uzu-file-btn-h: 30px; --uzu-file-fs: 14px;
  --uzu-btn-bg: #ffffff; --uzu-btn-line: #dfe5ee; --uzu-btn-radius: 8px;
}
.am-shell, .am-drawer {
  --uzu-file-accent: #1a3fa8; --uzu-file-accent-bg: #ffffff; --uzu-file-accent-line: #c9d6f5; --uzu-file-hover-bg: #eef3ff;
  --uzu-file-line: #dfe5ee; --uzu-file-text: #1d2433; --uzu-file-muted: #5b6578; --uzu-file-danger: #b42318; --uzu-file-focus: #1a3fa8;
  --uzu-file-radius: 8px; --uzu-file-btn-radius: 6px; --uzu-file-h: 40px; --uzu-file-btn-h: 28px; --uzu-file-fs: 14px;
  --uzu-btn-bg: #ffffff; --uzu-btn-line: #dfe5ee; --uzu-btn-radius: 8px;
}

/* ---- 1) enhanced picker ---- */
.uzu-file {
  position: relative; display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 100%; min-height: var(--uzu-file-h); margin: 0; padding: 5px 6px; box-sizing: border-box;
  border: 1px solid var(--uzu-file-line); border-radius: var(--uzu-file-radius); background: var(--uzu-file-surface);
  color: var(--uzu-file-text); font-size: var(--uzu-file-fs); line-height: 1.4; text-align: left; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.uzu-file > input[type="file"] {
  position: absolute !important; inset: 0 !important; z-index: 1;
  width: 100% !important; height: 100% !important; min-height: 0 !important; max-width: none !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: inherit !important;
  opacity: 0 !important; cursor: pointer; font-size: 0; color: transparent;
}
.uzu-file > input[type="file"]:disabled { cursor: not-allowed; }
.uzu-file__btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--uzu-file-btn-h); padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--uzu-file-accent-line); border-radius: var(--uzu-file-btn-radius);
  background: var(--uzu-file-accent-bg); color: var(--uzu-file-accent);
  font-size: calc(var(--uzu-file-fs) - 1px); font-weight: 600; line-height: 1; white-space: nowrap;
  transition: background-color .15s ease;
}
.uzu-file__btn svg { width: 16px; height: 16px; flex: none; }
.uzu-file__name {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--uzu-file-muted);
}
.uzu-file.has-files .uzu-file__name { color: var(--uzu-file-text); font-weight: 500; }
.uzu-file__count {
  flex: none; padding: 2px 8px; border-radius: 999px; background: var(--uzu-file-hover-bg); color: var(--uzu-file-accent);
  font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap;
}
.uzu-file__count[hidden], .uzu-file__clear[hidden] { display: none !important; }
.uzu-file .uzu-file__clear {
  position: relative; z-index: 2; flex: none; min-height: 28px; margin: 0; padding: 0 10px;
  border: 0; border-radius: 6px; background: transparent; color: var(--uzu-file-muted);
  font: inherit; font-size: 13px; font-weight: 500; line-height: 1; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.uzu-file .uzu-file__clear:hover { background: var(--uzu-btn-bg); color: var(--uzu-file-text); }
.uzu-file .uzu-file__clear:focus-visible { outline: 2px solid var(--uzu-file-focus); outline-offset: 1px; }
.uzu-file:hover .uzu-file__btn { background: var(--uzu-file-hover-bg); }
.uzu-file:has(> input[type="file"]:focus-visible) { outline: 2px solid var(--uzu-file-focus); outline-offset: 1px; border-color: var(--uzu-file-focus); }
.uzu-file.is-dragover { border-style: dashed; border-color: var(--uzu-file-accent); background: var(--uzu-file-hover-bg); }
.uzu-file.is-disabled { opacity: .55; cursor: not-allowed; }
.uzu-file.is-disabled .uzu-file__btn { background: var(--uzu-file-accent-bg); }
.uzu-file:has(> input[aria-invalid="true"]), .has-error > .uzu-file, .uzu-file:has(> input:user-invalid) { border-color: var(--uzu-file-danger); }
@media (max-width: 380px) { .uzu-file { gap: 8px; } .uzu-file__btn { padding: 0 10px; } }

/* ---- 2) no-JS fallback / safety net for any remaining native file control ---- */
input[type="file"]::file-selector-button {
  margin: 0 10px 0 0; min-height: var(--uzu-file-btn-h); padding: 0 12px;
  border: 1px solid var(--uzu-file-accent-line); border-radius: var(--uzu-file-btn-radius);
  background: var(--uzu-file-accent-bg); color: var(--uzu-file-accent);
  font: inherit; font-size: calc(var(--uzu-file-fs) - 1px); font-weight: 600; cursor: pointer;
}
input[type="file"]::-webkit-file-upload-button {
  margin: 0 10px 0 0; min-height: var(--uzu-file-btn-h); padding: 0 12px;
  border: 1px solid var(--uzu-file-accent-line); border-radius: var(--uzu-file-btn-radius);
  background: var(--uzu-file-accent-bg); color: var(--uzu-file-accent);
  font: inherit; font-size: calc(var(--uzu-file-fs) - 1px); font-weight: 600; cursor: pointer;
}
input[type="file"]:hover::file-selector-button { background: var(--uzu-file-hover-bg); }

/* ---- 3) safety net: buttons that carry no design class never show the OS look ---- */
:where(button:not([class]), input[type="submit"]:not([class]), input[type="button"]:not([class]), input[type="reset"]:not([class])) {
  -webkit-appearance: none; appearance: none;
  background-color: var(--uzu-btn-bg); border: 1px solid var(--uzu-btn-line); border-radius: var(--uzu-btn-radius);
}
