/* TDesign-inspired light theme styles */
:root {
  /* Brand & semantic */
  --td-brand-color: #0052d9;
  --td-brand-color-hover: #266fe8;
  --td-brand-color-active: #0040b5;
  --td-success-color: #2ba471;
  --td-warning-color: #ed7b2f;
  --td-error-color: #d54941;

  /* Text & bg */
  --td-text-color: #1f2329;
  --td-text-color-secondary: #8a8f99;
  --td-bg-color-page: #f3f4f6;
  --td-bg-color-container: #ffffff;
  --td-bg-color-secondarycontainer: #f7f8fa;

  /* Border & radius */
  --td-border-color: #e7e7e7;
  --td-border-color-strong: #dcdcdc;
  --td-radius-s: 6px;
  --td-radius-m: 8px;
  --td-radius-l: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif; }

/* Page */
body.td-theme { background: var(--td-bg-color-page); color: var(--td-text-color); }
.t-container { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }

.t-page-header { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; }
.t-page-title { font-size: 22px; margin: 0; font-weight: 700; }

/* Tag */
.t-tag { display: inline-block; border-radius: 999px; border: 1px solid var(--td-border-color); color: var(--td-text-color-secondary); padding: 2px 10px; }
.t-tag--primary { background: rgba(0,82,217,.08); border-color: rgba(0,82,217,.25); color: var(--td-brand-color); }
.t-tag--outline { background: #fff; border-color: var(--td-border-color-strong); color: var(--td-text-color-secondary); }
.t-size-s { font-size: 12px; }

/* Card */
.t-card { background: var(--td-bg-color-container); border: 1px solid var(--td-border-color); border-radius: var(--td-radius-l); }
.t-card--padding { padding: 16px; }
.t-card--shadow { box-shadow: 0 4px 16px rgba(0,0,0,.06); }

/* Form row */
.t-form-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
@media (max-width: 720px) { .t-form-row { grid-template-columns: 1fr; } }

/* Input */
.t-input { width: 100%; background: #fff; border: 1px solid var(--td-border-color-strong); border-radius: var(--td-radius-m); transition: all .15s ease; }
.t-input--lg .t-input__inner { padding: 12px 14px; font-size: 14px; }
.t-input__inner { width: 100%; border: 0; outline: none; background: transparent; color: var(--td-text-color); padding: 10px 12px; border-radius: inherit; }
.t-input:focus-within { border-color: var(--td-brand-color); box-shadow: 0 0 0 3px rgba(0,82,217,.12); }

/* Buttons */
.t-button { appearance: none; cursor: pointer; user-select: none; border-radius: var(--td-radius-m); border: 1px solid transparent; padding: 10px 14px; font-weight: 600; font-size: 14px; line-height: 1; transition: all .15s ease; }
.t-button:disabled { cursor: not-allowed; opacity: .6; }
.t-button--primary { background: var(--td-brand-color); color: #fff; border-color: var(--td-brand-color); }
.t-button--primary:hover { background: var(--td-brand-color-hover); border-color: var(--td-brand-color-hover); }
.t-button--default { background: #fff; color: var(--td-text-color); border-color: var(--td-border-color-strong); }
.t-button--default:hover { background: var(--td-bg-color-secondarycontainer); }

.t-actions { display: inline-flex; gap: 10px; flex-wrap: nowrap; }
.t-actions--wrap { display: flex; flex-wrap: wrap; margin-top: 12px; }
.t-actions a.t-button { text-decoration: none; }
/* Icon spacing */
.t-button i { margin-right: 6px; vertical-align: -1px; }
.t-tag i { margin-right: 6px; vertical-align: -1px; }
.t-alert i { margin-right: 6px; vertical-align: -1px; }

/* FFmpeg 状态灯样式 */
#ffStatus { display: inline-flex; align-items: center; gap: 6px; }
#ffStatus i { font-size: 10px; margin-right: 6px; }

/* Helper & alerts */
.t-helper { color: var(--td-text-color-secondary); font-size: 13px; margin-top: 8px; }
.t-alert { margin-top: 10px; padding: 10px 12px; border-radius: var(--td-radius-s); border: 1px solid var(--td-border-color); font-size: 13px; }
.t-alert--error { background: #fff1f1; border-color: #f8d2d1; color: var(--td-error-color); }
.t-note { color: var(--td-warning-color); font-size: 12px; margin-top: 4px; }

/* Result content */
.result { margin-top: 16px; display: none; }
.result.show { display: block; }

/* Meta info - compact horizontal layout */
.t-meta {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--td-border-color);
}

.t-cover {
  width: 90px;
  height: 120px;
  border-radius: var(--td-radius-m);
  object-fit: cover;
  border: 1px solid var(--td-border-color);
  background: #f2f3f5;
  flex-shrink: 0;
}

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

.t-info__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Video - compact size */
.t-video-box {
  margin-top: 12px;
  background: #000;
  border-radius: var(--td-radius-m);
  overflow: hidden;
  border: 1px solid var(--td-border-color);
  max-width: 100%;
  position: relative;
}

.t-video-box video {
  width: 100%;
  max-height: 480px;
  display: block;
  background: #000;
  object-fit: contain;
}

/* Responsive video on mobile */
@media (max-width: 720px) {
  .t-video-box video {
    max-height: 360px;
  }
  .t-meta {
    flex-direction: column;
    gap: 12px;
  }
  .t-cover {
    width: 100%;
    height: auto;
    aspect-ratio: 3/4;
    max-width: 200px;
    margin: 0 auto;
  }
}

/* Transcribe Result */
.t-transcribe-result { margin-top: 16px; padding: 14px; background: var(--td-bg-color-secondarycontainer); border: 1px solid var(--td-border-color); border-radius: var(--td-radius-m); }

.t-transcribe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--td-text-color);
  font-size: 14px;
}

.t-transcribe-header i { margin-right: 6px; vertical-align: -1px; }

.t-transcribe-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.t-button--sm {
  padding: 6px 12px;
  font-size: 13px;
}

.t-transcribe-text {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--td-text-color);
  font-size: 14px;
  padding: 10px;
  background: #fff;
  border-radius: var(--td-radius-s);
  border: 1px solid var(--td-border-color);
  max-height: 300px;
  overflow-y: auto;
}

/* Image Gallery */
.t-image-gallery {
  margin-top: 16px;
}

.t-gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--td-bg-color-secondarycontainer);
  border-radius: var(--td-radius-m);
}

.t-gallery-info {
  font-size: 14px;
  color: var(--td-text-color);
  font-weight: 500;
}

.t-gallery-info i {
  margin-right: 6px;
  color: var(--td-brand-color);
}

.t-gallery-actions {
  display: flex;
  gap: 8px;
}

.t-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.t-image-item {
  position: relative;
  border-radius: var(--td-radius-m);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--td-bg-color-container);
}

.t-image-item:hover {
  border-color: var(--td-brand-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.t-image-item.selected {
  border-color: var(--td-brand-color);
  box-shadow: 0 0 0 2px var(--td-brand-color-light);
}

.t-image-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.t-image-checkbox {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--td-border-color);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.t-image-item.selected .t-image-checkbox {
  background: var(--td-brand-color);
  border-color: var(--td-brand-color);
}

.t-image-checkbox i {
  color: white;
  font-size: 14px;
  display: none;
}

.t-image-item.selected .t-image-checkbox i {
  display: block;
}

.t-image-index {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.t-livephoto-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 82, 217, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.t-livephoto-badge i {
  font-size: 14px;
  margin: 0;
}

/* Modal */
.t-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.t-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.t-modal-content {
  position: relative;
  background: white;
  border-radius: var(--td-radius-l);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.t-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--td-border-color);
}

.t-modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--td-text-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.t-modal-header h3 i {
  color: var(--td-brand-color);
}

.t-modal-close {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--td-text-color-secondary);
  transition: all 0.2s ease;
}

.t-modal-close:hover {
  background: var(--td-bg-color-container);
  color: var(--td-text-color);
}

.t-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.t-gif-preview {
  text-align: center;
}

.t-gif-preview img {
  max-width: 100%;
  border-radius: var(--td-radius-m);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #f5f5f5;
  display: inline-block;
}

.t-gif-info {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--td-text-color-secondary);
}

.t-modal-tips {
  margin-top: 16px;
  padding: 12px;
  background: var(--td-bg-color-secondarycontainer);
  border-radius: var(--td-radius-m);
  font-size: 13px;
  color: var(--td-text-color-secondary);
  text-align: center;
}

.t-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--td-border-color);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.t-modal-footer .t-button {
  min-width: 100px;
}

/* Footer */
.t-footer { margin-top: 28px; color: var(--td-text-color-secondary); font-size: 12px; text-align: center; }
