:root {
  --color-primary: #007DFF;
  --color-primary-hover: #0066CC;
  --color-primary-active: #0055AA;
  --color-primary-light: #E6F2FF;
  --color-primary-lighter: #F0F7FF;
  --color-success: #64BB5C;
  --color-success-light: #EEF8ED;
  --color-warning: #FF9800;
  --color-warning-light: #FFF3E0;
  --color-error: #E84026;
  --color-error-light: #FDEDEB;
  --color-bg: #F1F3F5;
  --color-card: #FFFFFF;
  --color-text-primary: #191919;
  --color-text-secondary: #666666;
  --color-text-tertiary: #999999;
  --color-text-placeholder: #BFBFBF;
  --color-border: #E5E5E5;
  --color-divider: #F0F0F0;
  --color-hover: #F5F5F5;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --font-family: 'HarmonyOS Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.35s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #E6F2FF 0%, #F1F3F5 50%, #F0F7FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity var(--transition-slow);
}

#loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 480px;
  width: 90%;
}

.loading-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #4DA6FF 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 125, 255, 0.3);
}

.loading-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.loading-subtitle {
  font-size: 14px;
  color: var(--color-text-tertiary);
  margin-bottom: 32px;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--color-divider);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, #4DA6FF 100%);
  border-radius: 4px;
  transition: width var(--transition-normal);
  width: 0%;
}

.loading-status {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.loading-percent {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.loading-log {
  text-align: left;
  max-height: 160px;
  overflow-y: auto;
  padding: 12px;
  background: #FAFAFA;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  color: var(--color-text-tertiary);
  line-height: 1.8;
}

.loading-log::-webkit-scrollbar {
  width: 4px;
}

.loading-log::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.log-entry {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-entry .log-prefix {
  color: var(--color-primary);
  font-weight: 600;
}

.log-entry .log-error {
  color: var(--color-error);
}

#app {
  display: none;
  width: 100%;
  min-height: 100vh;
  flex-direction: column;
}

#app.visible {
  display: flex;
}

.app-header {
  background: var(--color-card);
  border-bottom: 1px solid var(--color-divider);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #4DA6FF 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  font-weight: 700;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.header-desc {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.header-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 10px;
  font-weight: 500;
}

.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 0;
  height: calc(100vh - 69px);
}

.panel-left {
  background: var(--color-card);
  border-right: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg);
}

.panel-section {
  padding: 20px;
}

.panel-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-section-title .icon {
  font-size: 16px;
}

.drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--color-primary-lighter);
  margin-bottom: 16px;
}

.drop-zone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(0, 125, 255, 0.1);
}

.drop-zone-icon {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.drop-zone-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.drop-zone-hint {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.file-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.file-input-row input[type="text"] {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background: var(--color-bg);
  outline: none;
  transition: border-color var(--transition-fast);
}

.file-input-row input[type="text"]:focus {
  border-color: var(--color-primary);
}

.file-input-row input[type="text"]::placeholder {
  color: var(--color-text-placeholder);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-family);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-primary:disabled {
  background: #B3D9FF;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-success {
  background: var(--color-success);
  color: white;
}

.btn-success:hover {
  background: #55A84E;
}

.btn-danger {
  background: transparent;
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

.btn-danger:hover {
  background: var(--color-error-light);
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-xs);
}

.file-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

.file-list-container::-webkit-scrollbar {
  width: 4px;
}

.file-list-container::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 8px;
}

.file-count {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
  cursor: default;
}

.file-item:hover {
  background: var(--color-hover);
}

.file-item.selected {
  background: var(--color-primary-light);
}

.file-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.file-icon.docx { background: #E3F2FD; color: #1976D2; }
.file-icon.xlsx { background: #E8F5E9; color: #388E3C; }
.file-icon.pptx { background: #FFF3E0; color: #F57C00; }
.file-icon.txt { background: #F5F5F5; color: #616161; }
.file-icon.html { background: #FCE4EC; color: #C62828; }
.file-icon.pdf { background: #FBE9E7; color: #D84315; }
.file-icon.csv { background: #E0F7FA; color: #00838F; }
.file-icon.json { background: #F3E5F5; color: #7B1FA2; }
.file-icon.xml { background: #E8EAF6; color: #283593; }
.file-icon.md { background: #ECEFF1; color: #546E7A; }
.file-icon.default { background: #F5F5F5; color: #9E9E9E; }

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 11px;
  color: var(--color-text-tertiary);
  display: flex;
  gap: 8px;
}

.file-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.file-remove:hover {
  background: var(--color-error-light);
  color: var(--color-error);
}

.control-bar {
  padding: 16px 20px;
  border-top: 1px solid var(--color-divider);
  background: var(--color-card);
  display: flex;
  gap: 8px;
  align-items: center;
}

.control-bar .spacer {
  flex: 1;
}

.right-top {
  padding: 20px 24px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-divider);
}

.progress-section {
  margin-bottom: 16px;
}

.progress-overall {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-overall-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.progress-overall-bar {
  flex: 1;
  height: 6px;
  background: var(--color-divider);
  border-radius: 3px;
  overflow: hidden;
}

.progress-overall-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary) 0%, #4DA6FF 100%);
  border-radius: 3px;
  transition: width var(--transition-normal);
  width: 0%;
}

.progress-overall-text {
  font-size: 13px;
  color: var(--color-text-secondary);
  min-width: 60px;
  text-align: right;
}

.progress-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 120px;
  overflow-y: auto;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--color-bg);
  border-radius: 12px;
  font-size: 12px;
}

.progress-item .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.progress-item .status-dot.waiting { background: var(--color-text-tertiary); }
.progress-item .status-dot.converting { background: var(--color-warning); animation: pulse 1.2s infinite; }
.progress-item .status-dot.success { background: var(--color-success); }
.progress-item .status-dot.error { background: var(--color-error); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.result-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.result-tabs {
  display: flex;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.result-tab {
  padding: 6px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--color-text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.result-tab.active {
  background: var(--color-card);
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.result-file-select {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background: var(--color-card);
  outline: none;
  max-width: 200px;
}

.result-file-select:focus {
  border-color: var(--color-primary);
}

.right-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.result-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--color-text-tertiary);
}

.result-empty-icon {
  font-size: 48px;
  opacity: 0.4;
}

.result-empty-text {
  font-size: 14px;
}

.result-preview {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

.result-preview::-webkit-scrollbar {
  width: 6px;
}

.result-preview::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.result-source {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-primary);
  background: var(--color-card);
  padding: 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  min-height: 100%;
}

.result-rendered {
  background: var(--color-card);
  padding: 32px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  min-height: 100%;
}

.result-rendered h1 { font-size: 24px; font-weight: 700; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--color-divider); }
.result-rendered h2 { font-size: 20px; font-weight: 600; margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--color-divider); }
.result-rendered h3 { font-size: 17px; font-weight: 600; margin: 16px 0 8px; }
.result-rendered h4 { font-size: 15px; font-weight: 600; margin: 14px 0 6px; }
.result-rendered p { margin: 8px 0; line-height: 1.8; }
.result-rendered ul, .result-rendered ol { margin: 8px 0; padding-left: 24px; }
.result-rendered li { margin: 4px 0; line-height: 1.7; }
.result-rendered code {
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
}
.result-rendered pre {
  background: #1E1E1E;
  color: #D4D4D4;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 12px 0;
}
.result-rendered pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}
.result-rendered blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 8px 16px;
  margin: 12px 0;
  background: var(--color-primary-lighter);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--color-text-secondary);
}
.result-rendered table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.result-rendered th, .result-rendered td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
  text-align: left;
}
.result-rendered th {
  background: var(--color-bg);
  font-weight: 600;
}
.result-rendered a {
  color: var(--color-primary);
  text-decoration: none;
}
.result-rendered a:hover {
  text-decoration: underline;
}
.result-rendered img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}
.result-rendered hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 16px 0;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toastIn var(--transition-normal);
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.success { background: var(--color-success); color: white; }
.toast.error { background: var(--color-error); color: white; }
.toast.warning { background: var(--color-warning); color: white; }
.toast.info { background: var(--color-primary); color: white; }

.toast.fade-out {
  animation: toastOut var(--transition-normal) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

.hidden-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.empty-file-list {
  padding: 32px 20px;
  text-align: center;
  color: var(--color-text-tertiary);
}

.empty-file-list-icon {
  font-size: 36px;
  margin-bottom: 8px;
  opacity: 0.4;
}

.empty-file-list-text {
  font-size: 13px;
}

@media (max-width: 768px) {
  .app-main {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--color-divider);
    max-height: 50vh;
  }

  .panel-right {
    min-height: 50vh;
  }

  .app-header {
    padding: 12px 16px;
  }

  .panel-section {
    padding: 16px;
  }

  .right-top {
    padding: 16px;
  }
}
