/* 取水印工具 - 样式 v2.4 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.5;
}

/* ===== 跳过导航 ===== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 8px;
    background: #667eea;
    color: #fff;
    padding: 8px 16px;
    border-radius: 0 0 8px 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    z-index: 1000;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 头部 ===== */
header {
    text-align: center;
    padding: 30px 0 20px;
    color: white;
}
header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* ===== 标签页 ===== */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.tab-btn {
    flex: 1;
    padding: 14px 12px;
    min-height: 48px;
    border: 2px solid transparent;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    color: white;
    transition: all 0.3s;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.tab-btn.active {
    background: white;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.tab-btn:hover {
    background: rgba(255,255,255,0.35);
}
.tab-btn.active:hover {
    background: white;
}
.tab-btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* ===== 卡片 ===== */
.card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    margin-bottom: 16px;
}
.card label {
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    color: #444;
}

/* ===== 输入行 ===== */
.input-row {
    display: flex;
    gap: 8px;
}
.input-row input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
    color: #333;
    background: #fff;
}
.input-row input:focus {
    border-color: #667eea;
}
.input-row input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 1px;
}
.hint {
    font-size: 0.8rem;
    color: #666;
    margin-top: 6px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    min-height: 44px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.btn:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}
.btn-primary {
    background: #667eea;
    color: white;
}
.btn-primary:hover {
    background: #5a6fd6;
}
.btn-primary:active {
    background: #4e62c2;
}
.btn-success {
    background: #27ae60;
    color: white;
}
.btn-success:hover {
    background: #219a52;
}
.btn-success:active {
    background: #1e8a48;
}
.btn-outline {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}
.btn-outline:hover {
    background: #667eea;
    color: white;
}

/* ===== 视频结果 ===== */
.result-area {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    animation: fadeIn 0.4s ease;
}
.video-info {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.video-cover {
    width: 160px;
    height: 210px;
    object-fit: cover;
    border-radius: 8px;
    background: #ddd;
}
.video-meta {
    flex: 1;
}
.video-meta h3 {
    font-size: 1rem;
    margin: 4px 0;
    line-height: 1.4;
}
.video-meta p {
    font-size: 0.85rem;
    color: #555;
    margin: 2px 0;
}
.platform-badge {
    display: inline-block;
    padding: 2px 10px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-bottom: 6px;
}
.video-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* ===== 加载 ===== */
.loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #667eea;
    font-weight: 600;
}
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 错误 ===== */
.error-msg {
    background: #fee2e2;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== 模式卡 ===== */
.mode-card {
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}
.mode-card h4 {
    margin-bottom: 4px;
}
.mode-card p {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 10px;
}

/* ===== 图片对比 ===== */
.image-compare {
    display: flex;
    gap: 12px;
}
.image-compare > div {
    flex: 1;
    text-align: center;
}
.image-compare span {
    display: block;
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 4px;
    font-weight: 600;
}
.image-compare img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

/* ===== 手动模式输入 ===== */
.manual-inputs {
    display: flex;
    gap: 16px;
}
.manual-inputs > div {
    flex: 1;
}
.manual-inputs label {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

/* ===== 平台标签（footer）===== */
.platforms {
    text-align: center;
    padding: 16px;
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
    line-height: 2;
}
.platform-tag {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    margin: 0 2px;
    font-size: 0.8rem;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Canvas 框选 ===== */
.canvas-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    overflow: hidden;
}
.canvas-container canvas {
    display: block;
    max-width: 100%;
    cursor: crosshair;
    height: auto;
}
.canvas-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #555;
    flex-wrap: wrap;
}
.btn-sm {
    padding: 8px 14px;
    min-height: 36px;
    font-size: 0.85rem;
    border-radius: 8px;
}
.select-input {
    padding: 10px 12px;
    min-height: 44px;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    background: white;
    color: #333;
}
.select-input:focus-visible {
    border-color: #667eea;
    outline: 2px solid #667eea;
    outline-offset: 1px;
}

/* ===== 时间轴 ===== */
.timeline-section {
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9ff;
    border-radius: 12px;
}
.timeline-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}
.video-info-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #555;
    margin-bottom: 8px;
}
.timeline-container {
    position: relative;
}
.timeline-thumbs {
    display: flex;
    gap: 2px;
    overflow: hidden;
    border-radius: 6px;
    margin-bottom: 4px;
    height: 45px;
}
.timeline-thumbs img {
    height: 45px;
    flex: 1;
    object-fit: cover;
    min-width: 0;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.timeline-thumbs img:hover,
.timeline-thumbs img:focus-visible {
    opacity: 1;
    outline: 2px solid #667eea;
    outline-offset: 1px;
}
.timeline-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #667eea 0%, #667eea var(--pos,0%), #ddd var(--pos,0%), #ddd 100%);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}
.timeline-slider:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 3px;
}
.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.timeline-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* ===== 水印列表面板 ===== */
.watermark-panel {
    margin-top: 12px;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #d0d0d0;
    max-height: 200px;
    overflow-y: auto;
}
.wm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    min-height: 40px;
    margin-bottom: 4px;
    border-radius: 4px;
    background: #f8f9ff;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.82rem;
}
.wm-item:hover,
.wm-item:focus-visible {
    background: #eef0ff;
    outline: 2px solid #667eea;
    outline-offset: -1px;
}
.wm-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wm-coords {
    flex: 1;
    color: #444;
    font-family: monospace;
    font-size: 0.78rem;
}
.wm-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: #ff444420;
    color: #c00;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.wm-delete:hover,
.wm-delete:focus-visible {
    background: #ff4444;
    color: #fff;
    outline: 2px solid #ff4444;
    outline-offset: 1px;
}
.wm-empty {
    color: #888;
    font-size: 0.82rem;
    text-align: center;
    padding: 12px;
}

/* ===== Toast 通知 ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10000;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}
.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.toast-info {
    background: #333;
    color: #fff;
}
.toast-success {
    background: #27ae60;
    color: #fff;
}
.toast-error {
    background: #dc2626;
    color: #fff;
}

/* ===== 智能剪视频 ===== */
.trim-info-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 100%);
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
}
.trim-info-bar span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 智能时间轴 */
.trim-timeline-section {
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9ff;
    border-radius: 12px;
}
.trim-timeline-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}
.trim-timeline-container {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e0e0e0;
}
.trim-timeline-track {
    width: 100%;
}
.trim-timeline-track canvas {
    display: block;
    width: 100%;
    height: 60px;
    cursor: pointer;
}
.trim-timeline-legend {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: #666;
    flex-wrap: wrap;
}
.trim-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.trim-legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
}
.trim-legend-dot.scene { background: #667eea; }
.trim-legend-dot.silence { background: rgba(231, 76, 60, 0.6); }
.trim-legend-dot.selected { background: #667eea; border: 2px solid #333; }

/* 分析结果双栏布局 */
.trim-results-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.trim-results-col h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.trim-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #667eea;
    color: #fff;
    border-radius: 11px;
    font-size: 0.7rem;
    font-weight: 700;
}
.trim-empty {
    color: #888;
    font-size: 0.82rem;
    text-align: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* 场景切换列表 */
.trim-scene-list {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.trim-scene-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
}
.trim-scene-item:hover {
    background: #eef0ff;
    border-color: #c4c8f0;
}
.trim-scene-item.selected {
    background: #eef0ff;
    border-color: #667eea;
    box-shadow: 0 0 0 1px #667eea40;
}
.trim-scene-check {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.trim-scene-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    cursor: pointer;
}
.trim-scene-index {
    font-weight: 700;
    color: #667eea;
    font-size: 0.8rem;
    min-width: 24px;
}
.trim-scene-time {
    flex: 1;
    font-family: monospace;
    font-size: 0.82rem;
    color: #444;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}
.trim-scene-time:hover {
    background: #e0e4ff;
    color: #667eea;
}
.trim-scene-thumb {
    width: 60px;
    height: 34px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: transform 0.15s;
}
.trim-scene-thumb:hover {
    transform: scale(1.05);
}

/* 静音片段列表 */
.trim-silence-list {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.trim-silence-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff5f5;
    border-radius: 8px;
    border: 1px solid #fcd;
    font-size: 0.82rem;
    min-height: 40px;
}
.trim-silence-icon {
    flex-shrink: 0;
}
.trim-silence-range {
    flex: 1;
    font-family: monospace;
    color: #c0392b;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s;
}
.trim-silence-range:hover {
    background: #ffe0e0;
}
.trim-silence-dur {
    color: #999;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* 操作按钮区域 */
.trim-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #e8e8e8;
}

/* ===== 响应式：平板 (≤768px) ===== */
@media (max-width: 768px) {
    .container { padding: 16px; }
    header h1 { font-size: 1.6rem; }
    .card { padding: 18px; }
    .video-info { flex-direction: column; }
    .video-cover { width: 100%; height: 200px; }
    .video-actions { flex-direction: column; }
    .video-actions .btn { width: 100%; }
}

/* ===== 响应式：手机 (≤600px) ===== */
@media (max-width: 600px) {
    .container { padding: 10px; }
    .card { padding: 14px; }
    header h1 { font-size: 1.4rem; }
    header p { font-size: 0.85rem; }
    .image-compare { flex-direction: column; }
    .manual-inputs { flex-direction: column; }
    .tabs { flex-direction: column; }
    .btn { padding: 12px 18px; }
    .canvas-info { flex-direction: column; align-items: flex-start; }
    .trim-results-row { grid-template-columns: 1fr; }
    .trim-actions { flex-direction: column; }
    .trim-actions .btn { width: 100%; }
    .trim-info-bar { flex-direction: column; gap: 6px; }
}

/* ===== 无障碍：减少动画 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .result-area {
        animation: none;
    }
    .spinner {
        animation: none;
    }
}
