/* ---- Digital Avatar - Polished Minimalist Redesign ---- */

.dav-mode .tool-hero {
  display: none;
}

.dav-mode .tool-detail-head {
  display: none;
}

.dav-mode {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  backdrop-filter: none;
}

.dav-root {
  width: 100%;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: hidden;
}

.dav-root,
.dav-root * {
  box-sizing: border-box;
}

.dav-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dav-back-link:hover {
  background: #f1f5f9;
  color: #334155;
}

.dav-back-link:active {
  background: #e2e8f0;
}

.dav-back-link svg {
  width: 18px;
  height: 18px;
  color: #6366f1;
}

.dav-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.dav-view.hidden,
.dav-dialog.hidden,
.dav-card.hidden {
  display: none;
}

.dav-gen-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dav-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.dav-card--header {
  gap: 12px;
}

.dav-card--action {
  gap: 12px;
}

.dav-header,
.dav-panel-head,
.dav-result-head,
.dav-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dav-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #ede9fe;
  color: #6366f1;
  flex-shrink: 0;
}

.dav-header-icon svg,
.dav-avatar-placeholder {
  width: 16px;
  height: 16px;
}

.dav-header-copy {
  flex: 1;
  min-width: 0;
}

.dav-header-eyebrow,
.dav-section-tag {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.dav-header-title,
.dav-card-title,
.dav-result-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.dav-section-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748b;
  white-space: nowrap;
}

.dav-tabs {
  display: flex;
  gap: 8px;
}

.dav-tab,
.dav-ratio-btn,
.dav-inline-btn,
.dav-modal-btn,
.dav-role-add,
.dav-btn-generate,
.dav-upload-area {
  font: inherit;
}

.dav-tab {
  flex: 1;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dav-tab.is-active {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.dav-role-list,
.dav-record-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dav-role-item,
.dav-record-item,
.dav-result-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.dav-role-item.is-selected {
  border-color: #6366f1;
  background: #eef2ff;
}

.dav-role-main,
.dav-record-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dav-role-avatar,
.dav-record-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.dav-role-avatar img,
.dav-record-avatar img,
.dav-role-chip-avatar img,
.dav-upload-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dav-role-avatar .dav-avatar-placeholder,
.dav-record-avatar .dav-avatar-placeholder,
.dav-role-chip-avatar .dav-avatar-placeholder {
  width: 22px;
  height: 22px;
}

.dav-role-copy,
.dav-record-copy {
  flex: 1;
  min-width: 0;
}

.dav-role-copy strong,
.dav-record-top strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
}

.dav-role-copy span,
.dav-record-meta,
.dav-result-meta,
.dav-upload-hint,
.dav-polling-status {
  font-size: 0.76rem;
  line-height: 1.6;
  color: #64748b;
}

.dav-role-actions,
.dav-record-actions,
.dav-result-actions,
.dav-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dav-inline-btn,
.dav-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dav-inline-btn:hover,
.dav-modal-btn:hover {
  background: #f8fafc;
  color: #334155;
}

.dav-inline-btn--danger {
  border-color: #fecaca;
  color: #dc2626;
}

.dav-inline-btn--danger:hover {
  background: #fef2f2;
}

.dav-role-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.dav-role-add small {
  font-size: 0.7rem;
  font-weight: 600;
  color: #94a3b8;
}

.dav-role-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.dav-role-scroll::-webkit-scrollbar {
  display: none;
}

.dav-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.dav-role-chip.is-selected {
  border-color: #6366f1;
  background: #eef2ff;
  color: #4f46e5;
}

.dav-role-chip-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.dav-role-chip-name {
  font-size: 0.78rem;
  font-weight: 700;
}

.dav-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dav-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.dav-input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font: inherit;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.dav-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  background: #fff;
}

.dav-upload-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 118px;
  padding: 16px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.dav-upload-area:hover {
  border-color: #6366f1;
  background: #eef2ff;
}

.dav-upload-area.has-file {
  border-style: solid;
  border-color: #6366f1;
}

.dav-upload-preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: 12px;
}

.dav-audio-player {
  width: 100%;
}

.dav-ratio-selector {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dav-ratio-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dav-ratio-btn.is-active {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
}

.dav-btn-generate {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: #6366f1;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dav-btn-generate:hover {
  opacity: 0.92;
}

.dav-btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.dav-polling-status {
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.dav-polling-status--card {
  margin-top: 4px;
}

.dav-record-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dav-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.dav-status.pending,
.dav-status.processing {
  background: #eef2ff;
  color: #4f46e5;
}

.dav-status.completed {
  background: #ecfdf3;
  color: #15803d;
}

.dav-status.failed {
  background: #fef2f2;
  color: #dc2626;
}

.dav-card--result {
  gap: 12px;
}

.dav-result-video-wrap {
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #0f172a;
}

.dav-video-player {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #020617;
}

.dav-record-error {
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fef2f2;
  font-size: 0.78rem;
  line-height: 1.65;
  color: #b91c1c;
}

.dav-empty {
  padding: 18px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.6;
  color: #94a3b8;
}

.dav-dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
}

.dav-modal-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(2px);
}

.dav-modal {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
}

.dav-modal-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #1e293b;
}

.dav-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dav-modal-btn {
  min-height: 40px;
}

.dav-modal-btn-primary {
  border-color: #6366f1;
  background: #6366f1;
  color: #fff;
}

.dav-modal-btn-secondary {
  background: #f8fafc;
}

@media (max-width: 640px) {
  .dav-card {
    padding: 14px;
  }

  .dav-header,
  .dav-panel-head,
  .dav-record-main,
  .dav-record-top,
  .dav-result-head,
  .dav-result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dav-role-main {
    align-items: flex-start;
  }

  .dav-role-actions,
  .dav-record-actions,
  .dav-result-actions {
    width: 100%;
  }

  .dav-role-actions .dav-inline-btn,
  .dav-record-actions .dav-inline-btn,
  .dav-result-actions .dav-inline-btn {
    flex: 1;
  }

  .dav-tabs,
  .dav-ratio-selector {
    flex-direction: column;
  }

  .dav-modal-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}
