:host {
  --ar-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ar-color-bg: hsl(0 0% 100%);
  --ar-color-bg-muted: hsl(210 40% 96%);
  --ar-color-border: hsl(214 32% 91%);
  --ar-color-text: hsl(222 47% 11%);
  --ar-color-muted-foreground: hsl(215 16% 47%);
  --ar-color-accent: unset;
  --ar-color-accent-hover: unset;
  --ar-radius: 8px;
  display: block;
}

/* :host([data-trigger='inline']) {
  width: 100%;
} */

:host([data-trigger='inline']) .ar-uploader-root,
:host([data-trigger='inline']) .ar-inline-upload,
:host([data-trigger='inline']) .ar-inline-panel {
  width: 100%;
  min-width: 0;
}

:host([data-theme='dark']) {
  --ar-color-bg: hsl(222 41% 6%);
  --ar-color-bg-muted: hsl(217 33% 17%);
  --ar-color-border: hsl(217 19% 27%);
  --ar-color-text: hsl(213 31% 91%);
  --ar-color-muted-foreground: hsl(215 20% 65%);
  --ar-color-accent: unset;
  --ar-color-accent-hover: unset;
}

.ar-uploader-root {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  font-family: var(--ar-font-family);
  background-color: var(--ar-color-bg);
  color: var(--ar-color-text);
  border: 1px solid var(--ar-color-border);
  border-radius: var(--ar-radius);
  padding: 0.5rem 1rem 1rem 1rem;
}

:host([data-theme='dark']) .ar-uploader-root {
  background-color: hsl(222 41% 6%);
}

.ar-uploader-root[data-trigger='button'] {
  border: none;
  padding: 0;
  box-shadow: none;
  background: transparent;
}

.ar-header {
  display: none;
}

.ar-uploader-root.has-items .ar-header {
  display: flex;
}

.ar-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.ar-description {
  margin: 0;
  color: var(--ar-color-muted-foreground);
  font-size: 0.95rem;
}

.ar-subtext {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ar-color-muted-foreground);
}

.ar-button-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.25rem;
  font-weight: 600;
  border-radius: var(--ar-radius);
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.9);
  color: var(--ar-color-text);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

:host([data-theme='dark']) .ar-button-trigger,
[data-theme='dark'] .ar-button-trigger {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.75);
  color: var(--ar-color-text);
}

.ar-button-trigger:hover {
  /* color: var(--ar-color-accent); */
  transform: translateY(-1px);
}

.ar-button-trigger:active {
  transform: translateY(0);
}

.ar-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ar-button-icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.ar-inline-upload {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.ar-inline-panel {
  display: flex;
  flex-direction: column;
}

.ar-modal-header.is-inline {
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  padding-top:0.5rem;
}

.ar-modal-upload.is-inline {
  gap: 1rem;
}

.ar-modal-footer.is-inline {
  padding: 0;
  border-top: none;
}

.ar-modal-footer.is-inline .ar-modal-footer-actions {
  margin-left: auto;
}

.ar-dropzone {
  position: relative;
  border: 1.5px dashed var(--ar-dropzone-border, var(--ar-color-border));
  border-radius: var(--ar-radius);
  background: var(--ar-dropzone-bg, var(--ar-color-bg));
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  margin: 0.6rem 0rem 1rem 0rem;
}

:host([data-theme='dark']) .ar-dropzone {
  background-color: hsl(222 41% 8%);
}

.ar-dropzone:hover {
  /* border-color: var(--ar-color-accent); */
  background-color: rgba(12, 85, 249, 0.07);
  transform: translateY(-1px);
}

.ar-dropzone.is-dragover {
  border-color: var(--ar-color-accent);
  background-color: rgba(12, 85, 249, 0.1);
}

.ar-dropzone.is-dragging {
  border-color: var(--ar-color-accent);
  background: rgba(12, 85, 249, 0.08);
  color: var(--ar-color-accent);
}

.ar-dropzone-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--ar-radius);
  background: rgba(12, 85, 249, 0.08);
  color: var(--ar-color-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ar-dropzone svg {
  width: 1.75rem;
  height: 1.75rem;
  fill: currentColor;
}

.ar-dropzone-actions {
  display: none;
}

.ar-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ar-file-list.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.ar-file-item {
  border: none;
  border-radius: var(--ar-radius);
  background: rgba(148, 163, 184, 0.15);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  position: relative;
  box-sizing: border-box;
  height: 50px;
}

.ar-file-item.is-grid {
  height: auto;
  padding: 0px;
  background: none;
}

:host([data-theme='dark']) .ar-file-item {
  background: hsl(222 41% 10%);
}

.ar-file-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.ar-file-header.is-grid {
  flex-direction: column;
  align-items: stretch;
}

.ar-file-thumb {
  width: 32px;
  height: 32px;
  border-radius: calc(var(--ar-radius) * 0.5);
  background: rgba(12, 85, 249, 0.1);
  color: var(--ar-color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  position: relative;
}

.ar-file-thumb.is-grid {
  width: 100%;
  height: 140px;
  border-radius: calc(var(--ar-radius) * 0.75);
  font-size: 1rem;
}

.ar-file-item.is-completed .ar-file-thumb {
  color: #fff;
}

.ar-thumb-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #1e9f6d;
  color: #fff;
  border: 2px solid var(--ar-color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}

.ar-thumb-status svg {
  width: 10px;
  height: 10px;
  color: currentColor;
}

.ar-thumb-status.is-error {
  background: rgba(225, 29, 72, 0.85);
}

.ar-file-name {
  font-size: 0.8rem;
  margin: 0;
  color: var(--ar-color-text);
}

.ar-file-item.is-grid .ar-file-name {
  text-align: left;
  font-size: 0.78rem;
  color: var(--ar-color-muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ar-file-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--ar-color-muted-foreground);
}

.ar-file-item.is-grid .ar-file-meta {
  justify-content: center;
}

.ar-remove-button {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--ar-color-muted-foreground);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--ar-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.ar-remove-button.is-grid {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ar-color-text);
  padding: 0.35rem;
  border-radius: var(--ar-radius);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.ar-file-item.is-grid:hover .ar-remove-button.is-grid {
  opacity: 1;
  pointer-events: auto;
}

:host([data-theme='dark']) .ar-remove-button.is-grid {
  background: rgba(15, 23, 42, 0.92);
  color: var(--ar-color-text);
  box-shadow: 0 4px 18px rgba(8, 47, 73, 0.45);
}

.ar-remove-button svg {
  width: 20px;
  height: 20px;
  display: block;
}

.ar-remove-button svg path,
.ar-remove-button svg line,
.ar-remove-button svg rect,
.ar-remove-button svg circle,
.ar-remove-button svg polyline {
  stroke: currentColor;
  fill: none;
}

.ar-remove-button:hover:not([disabled]) {
  color: var(--ar-color-text);
}

.ar-progress-track {
  width: 100%;
  height: 4px;
  border-radius: var(--ar-radius);
  background-color: rgba(148, 163, 184, 0.35);
  overflow: hidden;
}

.ar-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  background-size: 200% 100%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: none;
  position: relative;
  overflow: hidden;
}

.ar-progress-border.is-active .ar-progress-fill.is-indeterminate {
  animation: ar-progress-indeterminate 1.25s ease-in-out infinite alternate;
}

.ar-progress-fill.is-indeterminate {
  transform: translateX(-40%);
}

@keyframes ar-progress-indeterminate {
  from {
    transform: translateX(-40%);
  }
  to {
    transform: translateX(40%);
  }
}

.ar-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ar-color-muted-foreground);
}

.ar-status svg {
  width: 1rem;
  height: 1rem;
}

.ar-status.is-success {
  color: #1e9f6d;
}

.ar-status.is-error {
  color: #e11d48;
}

.ar-status.is-uploading {
  color: #2563eb;
}

.ar-status.is-warning {
  color: #d97706;
}

.ar-file-error {
  font-size: 0.78rem;
  color: #e11d48;
}

.ar-error-banner {
  display: none;
  margin: 0.75rem 0;
  padding: 0.75rem;
  border-radius: var(--ar-radius);
  border: 1px solid rgba(225, 29, 72, 0.35);
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
  font-size: 0.82rem;
  line-height: 1.4;
}

.ar-error-banner:not([hidden]) {
  display: block;
}

:host([data-theme='dark']) .ar-error-banner {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.25);
  color: #fecaca;
}

.ar-duplicate-banner {
  display: none;
  margin: 0.75rem 0;
  padding: 0.75rem;
  border-radius: var(--ar-radius);
  background: rgba(248, 113, 113, 0.12);
  color: #9f1239;
  font-size: 0.85rem;
  line-height: 1.3;
}

.ar-duplicate-banner[hidden] {
  display: none !important;
}

.ar-actions {
  display: flex;
  justify-content: flex-end;
}

.ar-upload-button {
  border-radius: var(--ar-radius);
  padding: 0.65rem 1.5rem;
  font-weight: 600;
  border: none;
  background: var(--ar-color-accent);
  color: white;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
  min-width: 140px;
}

.ar-upload-button:hover:not([disabled]) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.ar-upload-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.ar-footer {
  font-size: 0.78rem;
  color: var(--ar-color-muted-foreground);
  text-align: right;
}

.ar-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.ar-modal.is-portal {
  position: absolute;
}

.ar-modal.is-open {
  display: flex;
}

.ar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ar-modal-dialog {
  position: relative;
  background: var(--ar-color-bg);
  border-radius: 16px;
  border: 1px solid var(--ar-color-border);
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.25);
  width: min(343px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 1rem 1rem 1rem;
}

.ar-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ar-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.ar-modal-close {
  border: none;
  background: transparent;
  color: var(--ar-color-muted-foreground);
  cursor: pointer;
  border-radius: var(--ar-radius);
  padding: 0.3rem;
  transition: color 0.2s ease, background 0.2s ease;
}

.ar-modal-close:hover {
  background: rgba(148, 163, 184, 0.15);
  color: var(--ar-color-accent);
}

.ar-modal-close-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.ar-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.ar-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.ar-modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ar-modal-add-more,
.ar-modal-clear {
  border-radius: var(--ar-radius);
  padding: 0.55rem 1.25rem;
  font-weight: 600;
  border: 1px solid var(--ar-color-border);
  background: var(--ar-color-bg);
  color: var(--ar-color-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ar-modal-add-more:hover {
  border-color: var(--ar-color-accent);
  color: var(--ar-color-accent);
}

.ar-modal-clear {
  background: rgba(148, 163, 184, 0.12);
}

.ar-modal-clear[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.ar-modal-clear:hover {
  border-color: var(--ar-color-accent);
  color: var(--ar-color-accent);
}

.ar-modal-upload-button,
.ar-modal-done {
  border-radius: var(--ar-radius);
  padding: 0.55rem 1.25rem;
  font-weight: 600;
  border: none;
  background: var(--ar-color-accent);
  color: var(--ar-color-text);
  cursor: pointer;
  transition: filter 0.2s ease;
}

.ar-modal-upload-button:hover,
.ar-modal-done:hover {
  filter: brightness(1.05);
}

.ar-uploaded-summary {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-top: 1px solid var(--ar-color-border);
  padding-top: 1rem;
}

.ar-uploader-root[data-trigger='button'] .ar-uploaded-summary {
  border: 1px solid var(--ar-color-border);
  border-radius: var(--ar-radius);
  padding: 1rem;
  background: var(--ar-color-bg-muted);
}

.ar-summary-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.ar-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ar-summary-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ar-summary-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--ar-radius);
  background: rgba(12, 85, 249, 0.12);
  color: var(--ar-color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.ar-summary-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ar-summary-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.ar-summary-meta {
  font-size: 0.8rem;
  color: var(--ar-color-muted-foreground);
}

@media (max-width: 640px) {
  .ar-uploader-root {
    padding: 1rem;
  }

  .ar-dropzone {
    padding: 2.25rem 1.25rem;
  }

  .ar-modal-dialog {
    width: min(90vw, 343px);
    padding: 1.25rem;
  }
}

.ar-uploader-root.is-uploading .ar-dropzone {
  display: none;
}

.ar-uploader-root.has-items .ar-file-list {
  display: flex;
}

.ar-file-list:empty {
  display: none;
}

.ar-modal-upload {
  display: flex;
  flex-direction: column;
}

.ar-modal-body .ar-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
  border: none;
  background: transparent;
  padding: 0;
}

.ar-button-trigger,
.ar-dropzone-button,
.ar-upload-button,
.ar-modal-footer button,
.ar-actions button,
.ar-remove-button,
.ar-modal-header button {
  font-size: 1rem;
  font-weight: 400;
}

.ar-file-item.is-uploading {
  border-color: var(--ar-color-accent);
}

.ar-file-item.is-completed {
  border-color: rgba(30, 159, 109, 0.6);
}

.ar-file-item.is-error {
  border: 1px solid rgba(225, 29, 72, 0.4);
  background: rgba(248, 113, 113, 0.12);
}

.ar-progress-border {
  opacity: 0;
  height: 2px;
  width: 96%;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  overflow: hidden;
  margin-top: 0.35rem;
  position: absolute;
  bottom: 0;
  left: 6px;
  right: 6px;
}

.ar-progress-border.is-active,
.ar-progress-border.is-complete {
  opacity: 1;
}

.ar-progress-border.is-train {
  background: rgba(59, 130, 246, 0.18);
}

.ar-progress-fill-bar {
  display: none;
}

.ar-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  transition: width 0.25s ease;
  transform-origin: left center;
  animation: none;
}

.ar-progress-fill.is-train {
  background-image: linear-gradient(
    90deg,
    rgba(245, 250, 241, 0.93) 0%,
    rgba(240, 242, 247, 0.85) 80%,
    rgb(30, 101, 212) 100%
  );
  background-size: 220% 100%;
  animation: ar-progress-train 2.4s linear infinite;
}

.ar-progress-border.is-complete {
  background: rgba(34, 197, 94, 0.25);
}

.ar-progress-border.is-complete .ar-progress-fill {
  background-image: linear-gradient(
    90deg,
    rgba(52, 211, 153, 0.3) 0%,
    rgba(16, 185, 129, 0.85) 50%,
    rgba(52, 211, 153, 0.3) 100%
  );
  animation: none;
}

@keyframes ar-progress-train {
  0% {
    background-position: 240% 0;
  }
  100% {
    background-position: -240% 0;
  }
}

.ar-actions-sources,
.ar-modal-sources {
  display: none;
}

.ar-actions-sources.is-visible,
.ar-modal-sources.is-visible {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ar-source-list {
  display: none;
  flex-direction: column;
  margin: 1rem 0rem;
}

.ar-source-list--choices {
  display: flex;
}

.ar-source-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  border: none;
  border-radius: var(--ar-radius);
  background: transparent;
  padding: 0.55rem 0.75rem;
  text-align: left;
  color: var(--ar-color-text);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ar-source-option.is-primary {
  background: rgba(12, 85, 249, 0.12);
  color: var(--ar-color-accent);
}

.ar-source-option:hover:not([disabled]),
.ar-source-option:focus-visible {
  background: rgba(12, 85, 249, 0.08);
  /* color: var(--ar-color-accent); */
}

.ar-source-option[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.ar-source-option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--ar-color-muted-foreground);
}

.ar-source-option-label {
  flex: 1;
  font-size: 0.95rem;
}

.ar-source-inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ar-source-inline-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--ar-color-border);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ar-color-text);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ar-source-inline-button:hover:not([disabled]) {
  background: rgba(12, 85, 249, 0.12);
  color: var(--ar-color-accent);
  border-color: rgba(12, 85, 249, 0.2);
}

.ar-source-inline-button svg {
  width: 18px;
  height: 18px;
  display: block;
}

.ar-modal-cancel.is-fullwidth {
  width: 100%;
  justify-content: center;
  cursor: pointer;
}

.ar-modal-powered,
.ar-inline-powered {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--ar-color-muted-foreground);
  text-align: center;
}

.ar-modal-cancel {
  background: rgba(148, 163, 184, 0.15);
  border: none;
  color: var(--ar-color-text);
  padding:0.5rem 1rem;
}

.ar-modal-cancel:hover:not([disabled]) {
  background: rgba(148, 163, 184, 0.25);
}

/* .ar-modal-title.is-dynamic {
  color: var(--ar-color-accent);
} */

/* .ar-modal-title.is-success {
  color: #047857;
} */

/* ARVideo (React) — fills its box; import @autorender/sdk-react/styles.
   Do not set height:auto on the .video-js element: it is the <video> and breaks Video.js fill layout. */
.ar-video {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 0;
}

.ar-video .video-js {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

