@import url("./tokens.css");

.yj-icon {
  display: inline-block;
  flex: none;
  object-fit: contain;
  vertical-align: middle;
  user-select: none;
}
.yj-symbol {
  flex: none;
  vertical-align: middle;
  fill: currentColor;
  filter: drop-shadow(0 1px 0 var(--highlight)) drop-shadow(0 1px 1px #16375b25);
}
.yj-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font: 600 14px/1.4 var(--font);
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(175deg, var(--surface), var(--surfaceRaised));
  box-shadow:
    inset 0 1px 1px var(--highlight),
    inset 0 -2px 1px #2347750d,
    var(--buttonShadow);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    transform var(--feedback),
    box-shadow var(--feedback),
    background var(--feedback);
}
.yj-button.primary {
  color: var(--primaryText);
  border-color: var(--primary);
  background: linear-gradient(
    175deg,
    color-mix(in srgb, var(--primary), white 18%),
    var(--primary)
  );
  box-shadow:
    inset 0 1px 1px #ffffff99,
    inset 0 -2px 1px #004a8f40,
    0 4px 9px #125ae92a;
}
.yj-button.primary .yj-symbol {
  filter: drop-shadow(0 1px 1px #0042a980);
}
.yj-button.danger {
  color: var(--danger);
}
.yj-button.icon {
  width: 44px;
  height: 44px;
  padding: 4px;
}
.yj-button.quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.yj-button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: var(--primary);
}
@media (hover: hover) {
  .yj-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow:
      inset 0 1px 1px var(--highlight),
      0 5px 12px #2457a330;
  }
  .yj-button.quiet:hover:not(:disabled) {
    background: var(--surfaceRaised);
    box-shadow: none;
  }
}
.yj-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.yj-button:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 2px 3px #1a3c6925;
}
.yj-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}
.yj-button[aria-busy="true"] {
  cursor: progress;
}
.yj-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: yj-spin 0.75s linear infinite;
}
.yj-button .yj-theme-symbol { width:32px; height:32px; filter:drop-shadow(0 1px 1px #233f7040); }

@keyframes yj-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .yj-button {
    transition: none;
  }
  .yj-button:hover:not(:disabled),
  .yj-button:active:not(:disabled) {
    transform: none;
  }
  .yj-spinner {
    animation: none;
  }
}

.yj-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.yj-badge {
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--secondaryText);
  white-space: nowrap;
}

.yj-field {
  display: grid;
  gap: 8px;
  margin: 20px 0;
}
.yj-field label {
  font-size: 14px;
  font-weight: 600;
}
.yj-input {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: var(--surfaceRaised);
  color: var(--text);
}
.yj-field small {
  color: var(--secondaryText);
}

/* 公共文件选择器：焦点、滚动及底部操作均在同一对话框内。 */
.yj-dialog {
  box-sizing: border-box;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-family: var(--font);
}
.yj-dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.yj-dialog::backdrop {
  background: rgb(15 30 60 / 35%);
  backdrop-filter: blur(6px);
}
.yj-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.yj-dialog h2 {
  font-size: 20px;
  margin: 0;
}
.yj-dialog p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--secondaryText);
}
.yj-picker-search {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.yj-picker-list {
  min-height: 80px;
  max-height: 45dvh;
  overflow-y: auto;
}
.yj-file-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.yj-file-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--background);
}
.yj-file-option > span {
  flex: 1;
  min-width: 0;
}
.yj-file-option strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.yj-file-option small {
  display: block;
  color: var(--secondaryText);
  margin-top: 3px;
}
.yj-file-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.yj-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
.yj-picker-empty {
  text-align: center;
  padding: 16px;
}
