/*!
 * ZidanForm File-only v2.4.2 — plugin-file-core.css
 * Structure for the file upload control only.
 * Pairs with zidan-file.js and plugin-file-theme.css.
 *
 * Generated by scripts/build.mjs — edit the shared stylesheets instead.
 * https://github.com/akhtar1985/zidan-select
 * MIT License © akhtar1985
 */

/* ==================================================================
   1. Scope reset
   ================================================================== */

.zs-root,
.zs-field,
.zs-radio-group {
  position: relative;
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--zs-font-family, inherit);
  font-size: var(--zs-font-size, 0.9375rem);
  line-height: var(--zs-line-height, 1.4);
  -webkit-tap-highlight-color: transparent;
}

.zs-root *,
.zs-root *::before,
.zs-root *::after,
.zs-field *,
.zs-field *::before,
.zs-field *::after,
.zs-radio-group *,
.zs-radio-group *::before,
.zs-radio-group *::after {
  box-sizing: border-box;
}

/* ==================================================================
   6. Fields — shared shell
   ================================================================== */

.zs-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--zs-field-gap, 6px);
}

.zs-field--pending::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-end: 0;
  width: 0.85em;
  height: 0.85em;
  border-width: 2px;
  border-style: solid;
  border-color: transparent;
  border-radius: 50%;
  animation: zs-field-spin 0.7s linear infinite;
  pointer-events: none;
}

@keyframes zs-field-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .zs-field--pending::after {
    animation-duration: 2s;
  }
}

.zs-field[data-zs-layout="inline"] {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.zs-field__label {
  display: block;
  font-size: var(--zs-label-size, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* The plugin renders its own label and hides the author's original one. Author
   rules such as `.field-label { display:block }` would otherwise beat the
   browser's [hidden] default and show both labels at once. */
[data-zs-hidden-label] {
  display: none !important;
}

.zs-field__hint {
  margin: 0;
  font-size: 0.75rem;
}

.zs-field__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.zs-field__error {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
}

.zs-field__error[hidden] {
  display: none;
}

.zs-counter {
  margin-inline-start: auto;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* the real control: 1×1px and transparent, never display:none — jQuery
   Validation's ":hidden" ignore and native validation must still see it */
.zs-native-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.zs-field--inline .zs-check,
.zs-field--inline .zs-radio {
  margin: 0;
}

/* ==================================================================
   9. File upload
   ================================================================== */

.zs-field--file .zs-file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 22px 16px;
  min-height: 128px;
  text-align: center;
  border-width: 1.5px;
  border-style: dashed;
  border-radius: var(--zs-radius, 10px);
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.zs-file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  border-radius: 50%;
}

.zs-file-drop-title {
  font-weight: 600;
}

.zs-file-drop-hint {
  font-size: 0.75rem;
}

.zs-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.zs-file-list[hidden] {
  display: none;
}

.zs-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-width: var(--zs-border-width, 1px);
  border-style: solid;
  border-radius: var(--zs-radius, 10px);
}

.zs-file-thumb {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.zs-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zs-file-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}

.zs-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
}

.zs-file-size {
  font-size: 0.6875rem;
}

.zs-file-remove {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.zs-file-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 20px;
}

.zs-file-status {
  font-size: 0.75rem;
}

.zs-file-clear {
  margin-inline-start: auto;
  padding: 2px 8px;
  border-width: 1px;
  border-style: solid;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
}

.zs-file-clear[hidden] {
  display: none;
}

/* upload variants (scoped to beat the base .zs-field--file .zs-file-drop rules) */
.zs-field--file .zs-file-drop--button,
.zs-field--file .zs-file-drop--compact {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 0;
  padding: 10px 14px;
  text-align: start;
  border-style: solid;
}

.zs-field--file .zs-file-drop--compact {
  padding: 6px 10px;
}

.zs-field--file .zs-file-drop--button .zs-file-icon,
.zs-field--file .zs-file-drop--compact .zs-file-icon {
  margin: 0;
  width: 24px;
  height: 24px;
}

.zs-field--file .zs-file-drop--button .zs-file-drop-hint,
.zs-field--file .zs-file-drop--compact .zs-file-drop-hint {
  margin-inline-start: auto;
}

.zs-field--file .zs-file-drop--avatar {
  flex: 0 0 auto;
  width: var(--zs-avatar-size, 96px);
  height: var(--zs-avatar-size, 96px);
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-style: solid;
  border-radius: 50%;
}

.zs-field--file .zs-file-drop--avatar .zs-file-drop-title,
.zs-field--file .zs-file-drop--avatar .zs-file-drop-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.zs-field--file .zs-file-drop--avatar .zs-file-icon {
  margin: 0;
}

.zs-file-avatar {
  position: absolute;
  inset: 0;
  display: block;
}

.zs-file-avatar[hidden] {
  display: none;
}

.zs-file-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zs-file-drop--has-preview .zs-file-icon {
  display: none;
}

.zs-field--file .zs-file-drop--gallery {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 14px;
}

.zs-field[data-zs-file-variant="gallery"] .zs-file-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.zs-field[data-zs-file-variant="gallery"] .zs-file-item {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
}

.zs-field[data-zs-file-variant="gallery"] .zs-file-thumb {
  width: 100%;
  height: 86px;
  border-radius: 6px;
}

.zs-field[data-zs-file-variant="gallery"] .zs-file-actions {
  justify-content: flex-end;
}

.zs-field[data-zs-file-variant="gallery"] .zs-file-upload-state {
  flex-wrap: wrap;
}

.zs-file-upload-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
}

.zs-file-progress {
  position: relative;
  display: inline-block;
  flex: 1 1 58px;
  height: 4px;
  min-width: 44px;
  overflow: hidden;
  border-radius: 999px;
}

.zs-file-progress-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  transition: width 120ms linear;
}

.zs-file-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.zs-file-cancel,
.zs-file-retry {
  padding: 2px 6px;
  border: 0;
  border-radius: 5px;
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==================================================================
   11. Form layout helper
   ================================================================== */

.zs-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--zs-grid-min, 230px), 1fr));
  gap: var(--zs-grid-gap, 16px);
  align-items: start;
}

.zs-form-grid > .zs-full {
  grid-column: 1 / -1;
}

/* ==================================================================
   12. Focus & motion
   ================================================================== */

.zs-check input:focus-visible + .zs-check-box,
.zs-check input:focus-visible + .zs-switch-track,
.zs-radio input:focus-visible + .zs-radio-dot {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.zs-input-native:focus-visible,
.zs-file-input:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .zs-root,
  .zs-root *,
  .zs-root *::before,
  .zs-root *::after,
  .zs-field,
  .zs-field *,
  .zs-field *::before,
  .zs-field *::after,
  .zs-radio-group,
  .zs-radio-group * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .zs-root .zs-spinner {
    animation-duration: 1.2s !important;
    animation-iteration-count: infinite !important;
  }
}
