/* ============================================
   SRT File Viewer
   Prefix: sfv-
   Light mode default, dark mode support
   Blue theme (#3399cc) - viewer tools
   ============================================ */

/* CSS Variables - Light (Default) */
:root {
    --sfv-primary: #3399cc;
    --sfv-primary-light: #e0f2fe;
    --sfv-primary-dark: #2980b9;
    --sfv-primary-rgb: 51, 153, 204;

    --sfv-success: #339966;
    --sfv-success-light: #d1fae5;
    --sfv-danger: #e64e4e;
    --sfv-danger-light: #fee2e2;
    --sfv-warning: #f59e0b;
    --sfv-warning-light: #fef3c7;

    --sfv-bg: #f0f9ff;
    --sfv-bg-elevated: #ffffff;
    --sfv-bg-secondary: #e0f2fe;
    --sfv-bg-tertiary: #bae6fd;

    --sfv-text: #0c4a6e;
    --sfv-text-secondary: #075985;
    --sfv-text-muted: #6b7280;

    --sfv-border: #bae6fd;
    --sfv-border-light: #e0f2fe;

    --sfv-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --sfv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --sfv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --sfv-shadow-primary: 0 4px 14px rgba(51, 153, 204, 0.25);

    --sfv-radius-sm: 6px;
    --sfv-radius-md: 12px;
    --sfv-radius-lg: 16px;
    --sfv-radius-xl: 24px;
    --sfv-radius-full: 9999px;

    --sfv-transition: 0.25s;

    /* Raw view colors */
    --sfv-raw-bg: #1a1d23;
    --sfv-raw-text: #e4e4e7;
    --sfv-raw-index: #22d3ee;
    --sfv-raw-timestamp: #a78bfa;
    --sfv-raw-line-num: #525866;

    /* Mark / highlight */
    --sfv-mark-bg: #fef08a;
    --sfv-mark-text: #713f12;
}

/* Dark Mode */
[data-theme="dark"] {
    --sfv-primary: #60a5fa;
    --sfv-primary-light: rgba(96, 165, 250, 0.15);
    --sfv-primary-dark: #3b82f6;
    --sfv-primary-rgb: 96, 165, 250;

    --sfv-success: #34d399;
    --sfv-success-light: rgba(52, 211, 153, 0.18);
    --sfv-danger: #f87171;
    --sfv-danger-light: rgba(248, 113, 113, 0.18);
    --sfv-warning: #fbbf24;
    --sfv-warning-light: rgba(251, 191, 36, 0.18);

    --sfv-bg: #0c1929;
    --sfv-bg-elevated: #152238;
    --sfv-bg-secondary: #1e3a5f;
    --sfv-bg-tertiary: #264a6e;

    --sfv-text: #e0f2fe;
    --sfv-text-secondary: #bae6fd;
    --sfv-text-muted: #a8b8c8;

    --sfv-border: #264a6e;
    --sfv-border-light: #1e3a5f;

    --sfv-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --sfv-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --sfv-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);

    --sfv-raw-bg: #0a0d12;
    --sfv-raw-text: #e4e4e7;

    --sfv-mark-bg: rgba(252, 211, 77, 0.4);
    --sfv-mark-text: #fde68a;
}

/* Allow overlays/dropdowns */
.tool-main {
    overflow: visible !important;
}

/* Container */
.tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0 0 0.75rem;
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--sfv-primary);
}

.tool-title i {
    color: var(--sfv-primary);
}

.tool-description {
    max-width: 800px;
    margin: 0 auto;
    color: var(--sfv-text-muted);
    font-size: 0.975rem;
    line-height: 1.7;
}

.tool-description a {
    color: var(--sfv-primary);
    text-decoration: none;
    font-weight: 500;
}

.tool-description a:hover {
    text-decoration: underline;
}

/* ============================================
   UPLOAD SECTION
   ============================================ */
.sfv-upload-section {
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-xl);
    padding: 2rem;
    box-shadow: var(--sfv-shadow-md);
    border: 1px solid var(--sfv-border);
}

.sfv-upload-area {
    border: 2px dashed var(--sfv-border);
    border-radius: var(--sfv-radius-lg);
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--sfv-transition), background var(--sfv-transition);
    background: var(--sfv-bg);
}

.sfv-upload-area:hover,
.sfv-upload-area.dragover {
    border-color: var(--sfv-primary);
    background: var(--sfv-primary-light);
}

.sfv-upload-icon {
    color: var(--sfv-primary);
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.sfv-upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--sfv-text);
    margin: 0 0 0.5rem;
}

.sfv-upload-subtitle {
    color: var(--sfv-text-muted);
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
}

.sfv-file-types {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.sfv-file-badge {
    background: var(--sfv-bg-secondary);
    color: var(--sfv-primary);
    padding: 0.3rem 0.75rem;
    border-radius: var(--sfv-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.sfv-upload-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--sfv-text-muted);
    font-size: 0.8rem;
}

/* ============================================
   PROCESSING OVERLAY (stage pattern)
   ============================================ */
.sfv-processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 1rem;
    animation: sfvFadeIn 0.2s ease;
}

@keyframes sfvFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sfv-processing-card {
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-lg);
    padding: 2rem;
    min-width: 340px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--sfv-shadow-lg);
    border: 1px solid var(--sfv-border);
}

.sfv-stages {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    gap: 0;
}

.sfv-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.sfv-stage-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sfv-bg-secondary);
    color: var(--sfv-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sfv-transition);
    padding: 6px;
}

.sfv-stage.active .sfv-stage-dot {
    background: var(--sfv-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px var(--sfv-primary-light);
}

.sfv-stage.done .sfv-stage-dot {
    background: var(--sfv-success);
    color: #ffffff;
}

.sfv-stage-label {
    font-size: 0.75rem;
    color: var(--sfv-text-muted);
    font-weight: 500;
}

.sfv-stage.active .sfv-stage-label,
.sfv-stage.done .sfv-stage-label {
    color: var(--sfv-text);
}

.sfv-stage-line {
    width: 28px;
    height: 2px;
    background: var(--sfv-bg-secondary);
    align-self: flex-start;
    margin-top: 15px;
    transition: background var(--sfv-transition);
}

.sfv-stage-line.done {
    background: var(--sfv-success);
}

.sfv-progress-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--sfv-bg-secondary);
    border-radius: var(--sfv-radius-full);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.sfv-progress-bar {
    height: 100%;
    background: var(--sfv-primary);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: var(--sfv-radius-full);
}

.sfv-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.sfv-progress-percent {
    color: var(--sfv-text);
    font-weight: 700;
}

.sfv-progress-status {
    color: var(--sfv-text-muted);
}

/* ============================================
   ERROR
   ============================================ */
.sfv-error {
    background: var(--sfv-danger-light);
    border-radius: var(--sfv-radius-md);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid var(--sfv-danger);
    box-shadow: var(--sfv-shadow-sm);
}

.sfv-error-icon {
    color: var(--sfv-danger);
    flex-shrink: 0;
    margin-top: 2px;
}

.sfv-error-body {
    flex: 1;
    min-width: 0;
}

.sfv-error-message {
    color: var(--sfv-text);
    margin: 0 0 0.375rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.sfv-error-help {
    color: var(--sfv-text-muted);
    margin: 0;
    font-size: 0.825rem;
    line-height: 1.5;
}

.sfv-error-help a {
    color: var(--sfv-primary);
    text-decoration: none;
    font-weight: 500;
}

.sfv-error-help a:hover {
    text-decoration: underline;
}

.sfv-error-close {
    background: none;
    border: none;
    color: var(--sfv-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--sfv-radius-sm);
    flex-shrink: 0;
    transition: color var(--sfv-transition), background var(--sfv-transition);
}

.sfv-error-close:hover {
    color: var(--sfv-danger);
    background: rgba(var(--sfv-primary-rgb), 0.08);
}

/* ============================================
   EDITOR
   ============================================ */
.sfv-editor-section {
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-xl);
    overflow: hidden;
    box-shadow: var(--sfv-shadow-md);
    border: 1px solid var(--sfv-border);
}

/* File Bar */
.sfv-file-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: var(--sfv-bg);
    border-bottom: 1px solid var(--sfv-border);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sfv-file-bar-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    flex: 1;
}

.sfv-file-bar-left i {
    color: var(--sfv-primary);
    flex-shrink: 0;
}

.sfv-file-name {
    font-weight: 600;
    color: var(--sfv-text);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sfv-file-size {
    color: var(--sfv-text-muted);
    font-size: 0.825rem;
    flex-shrink: 0;
}

.sfv-file-bar-right {
    flex-shrink: 0;
}

.sfv-file-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--sfv-success);
    font-size: 0.825rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    background: var(--sfv-success-light);
    border-radius: var(--sfv-radius-full);
}

/* Toolbar */
.sfv-toolbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--sfv-bg-elevated);
    border-bottom: 1px solid var(--sfv-border);
}

.sfv-view-toggle {
    display: inline-flex;
    background: var(--sfv-bg);
    border-radius: var(--sfv-radius-md);
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--sfv-border);
}

.sfv-view-btn {
    padding: 0.4rem 0.875rem;
    border: none;
    background: transparent;
    color: var(--sfv-text-muted);
    cursor: pointer;
    border-radius: calc(var(--sfv-radius-md) - 3px);
    font-size: 0.825rem;
    font-weight: 500;
    transition: all var(--sfv-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.sfv-view-btn:hover {
    color: var(--sfv-text);
}

.sfv-view-btn.active {
    background: var(--sfv-primary);
    color: #ffffff;
}

/* Search */
.sfv-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.875rem;
    background: var(--sfv-bg);
    border: 1px solid var(--sfv-border);
    border-radius: var(--sfv-radius-md);
    transition: border-color var(--sfv-transition);
    min-width: 0;
}

.sfv-search-wrap:focus-within {
    border-color: var(--sfv-primary);
    box-shadow: 0 0 0 3px var(--sfv-primary-light);
}

.sfv-search-wrap i {
    color: var(--sfv-text-muted);
    flex-shrink: 0;
}

.sfv-search-input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--sfv-text);
    font-size: 0.875rem;
    flex: 1;
    min-width: 0;
    padding: 0;
}

.sfv-search-input::placeholder {
    color: var(--sfv-text-muted);
}

.sfv-search-count {
    font-size: 0.75rem;
    color: var(--sfv-primary);
    font-weight: 600;
    flex-shrink: 0;
}

.sfv-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.sfv-icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--sfv-border);
    background: var(--sfv-bg-elevated);
    color: var(--sfv-text);
    cursor: pointer;
    border-radius: var(--sfv-radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sfv-transition);
}

.sfv-icon-btn:hover:not(:disabled) {
    background: var(--sfv-primary);
    color: #ffffff;
    border-color: var(--sfv-primary);
}

.sfv-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Content Area */
.sfv-content-area {
    background: var(--sfv-bg);
    min-height: 400px;
    max-height: 70vh;
    overflow-y: auto;
}

.sfv-content-panel {
    display: none;
    width: 100%;
}

.sfv-content-panel.active {
    display: block;
}

/* Subtitle List (Timeline) */
.sfv-subtitle-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sfv-subtitle-entry {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 1rem;
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-md);
    padding: 0.875rem 1rem;
    border: 1px solid var(--sfv-border-light);
    transition: border-color var(--sfv-transition);
    min-width: 0;
}

.sfv-subtitle-entry:hover {
    border-color: var(--sfv-primary);
}

.sfv-subtitle-index {
    font-size: 0.75rem;
    color: var(--sfv-primary);
    font-weight: 700;
    text-align: center;
    background: var(--sfv-primary-light);
    border-radius: var(--sfv-radius-sm);
    padding: 0.25rem 0.5rem;
    align-self: flex-start;
    flex-shrink: 0;
}

.sfv-subtitle-content {
    min-width: 0;
}

.sfv-subtitle-timestamps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--sfv-text-muted);
    font-family: 'Courier New', monospace;
}

.sfv-timestamp-start,
.sfv-timestamp-end {
    color: var(--sfv-text-secondary);
    font-weight: 600;
}

.sfv-timestamp-arrow {
    color: var(--sfv-text-muted);
}

.sfv-timestamp-duration {
    color: var(--sfv-primary);
    font-weight: 600;
    margin-left: auto;
    padding: 0.125rem 0.5rem;
    background: var(--sfv-primary-light);
    border-radius: var(--sfv-radius-full);
    font-size: 0.7rem;
}

.sfv-subtitle-text {
    color: var(--sfv-text);
    font-size: 0.95rem;
    line-height: 1.55;
    word-break: break-word;
    margin-bottom: 0.5rem;
}

.sfv-subtitle-text b { font-weight: 700; }
.sfv-subtitle-text i { font-style: italic; }
.sfv-subtitle-text u { text-decoration: underline; }

.sfv-subtitle-text mark {
    background: var(--sfv-mark-bg);
    color: var(--sfv-mark-text);
    padding: 0 2px;
    border-radius: 3px;
}

.sfv-duration-bar {
    width: 100%;
    height: 3px;
    background: var(--sfv-bg-secondary);
    border-radius: var(--sfv-radius-full);
    overflow: hidden;
}

.sfv-duration-fill {
    height: 100%;
    background: var(--sfv-primary);
    border-radius: var(--sfv-radius-full);
    transition: width 0.3s ease;
}

/* Raw Panel */
.sfv-raw-content {
    background: var(--sfv-raw-bg);
    color: var(--sfv-raw-text);
    padding: 1.25rem 1.5rem;
    margin: 0;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 400px;
    overflow-x: auto;
}

/* Analysis Panel */
.sfv-analysis-content {
    padding: 1.25rem;
}

.sfv-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.sfv-analysis-card {
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-md);
    padding: 1.125rem;
    border: 1px solid var(--sfv-border);
    min-width: 0;
}

.sfv-analysis-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.925rem;
    font-weight: 700;
    color: var(--sfv-text);
    margin: 0 0 0.875rem;
}

.sfv-analysis-card h3 i {
    color: var(--sfv-primary);
}

.sfv-analysis-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--sfv-border-light);
    gap: 0.5rem;
}

.sfv-analysis-stat:last-child {
    border-bottom: none;
}

.sfv-analysis-stat-label {
    color: var(--sfv-text-muted);
    font-size: 0.8rem;
    min-width: 0;
}

.sfv-analysis-stat-value {
    color: var(--sfv-text);
    font-weight: 700;
    font-size: 0.875rem;
    text-align: right;
    flex-shrink: 0;
}

/* Speed Chart */
.sfv-speed-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sfv-speed-bar {
    display: grid;
    grid-template-columns: 100px 1fr 30px;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.sfv-speed-label {
    color: var(--sfv-text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sfv-speed-track {
    background: var(--sfv-bg-secondary);
    height: 8px;
    border-radius: var(--sfv-radius-full);
    overflow: hidden;
    min-width: 0;
}

.sfv-speed-fill {
    height: 100%;
    background: var(--sfv-primary);
    transition: width 0.3s ease;
}

.sfv-speed-count {
    color: var(--sfv-text);
    font-weight: 700;
    text-align: right;
}

/* Empty State */
.sfv-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1rem;
    color: var(--sfv-text-muted);
    text-align: center;
}

.sfv-empty-state i {
    color: var(--sfv-text-muted);
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.sfv-empty-state h3 {
    margin: 0 0 0.375rem;
    color: var(--sfv-text);
    font-size: 1rem;
}

.sfv-empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

/* Stats Bar */
.sfv-stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--sfv-bg);
    border-top: 1px solid var(--sfv-border);
    border-bottom: 1px solid var(--sfv-border);
}

.sfv-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-sm);
    border: 1px solid var(--sfv-border-light);
    min-width: 0;
}

.sfv-stat i {
    color: var(--sfv-primary);
    flex-shrink: 0;
}

.sfv-stat-label {
    font-size: 0.75rem;
    color: var(--sfv-text-muted);
    flex-shrink: 0;
}

.sfv-stat-value {
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--sfv-text);
    margin-left: auto;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Action Bar */
.sfv-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--sfv-bg-elevated);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sfv-export-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Buttons */
.sfv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.1rem;
    border-radius: var(--sfv-radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--sfv-transition);
    text-decoration: none;
}

.sfv-btn-primary {
    background: var(--sfv-primary);
    color: #ffffff;
    border-color: var(--sfv-primary);
    box-shadow: var(--sfv-shadow-primary);
}

.sfv-btn-primary:hover {
    background: var(--sfv-primary-dark);
    border-color: var(--sfv-primary-dark);
    transform: translateY(-1px);
}

.sfv-btn-secondary {
    background: var(--sfv-bg-secondary);
    color: var(--sfv-text);
    border-color: var(--sfv-border);
}

.sfv-btn-secondary:hover {
    background: var(--sfv-bg-tertiary);
}

.sfv-btn-outline {
    background: var(--sfv-bg-elevated);
    color: var(--sfv-text);
    border-color: var(--sfv-border);
}

.sfv-btn-outline:hover {
    background: var(--sfv-primary-light);
    color: var(--sfv-primary);
    border-color: var(--sfv-primary);
}

/* ============================================
   FULLSCREEN
   ============================================ */
.sfv-fullscreen {
    position: fixed;
    inset: 0;
    background: var(--sfv-bg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.sfv-fs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: var(--sfv-bg-elevated);
    border-bottom: 1px solid var(--sfv-border);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sfv-fs-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--sfv-text);
    min-width: 0;
    flex: 1;
}

.sfv-fs-info i {
    color: var(--sfv-primary);
    flex-shrink: 0;
}

#sfvFsFileName {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sfv-fs-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sfv-fs-zoom-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--sfv-bg);
    border-radius: var(--sfv-radius-md);
    padding: 2px;
    border: 1px solid var(--sfv-border);
}

.sfv-fs-zoom {
    color: var(--sfv-text);
    font-size: 0.825rem;
    font-weight: 600;
    min-width: 48px;
    text-align: center;
}

.sfv-fs-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--sfv-border);
    background: var(--sfv-bg-elevated);
    color: var(--sfv-text);
    cursor: pointer;
    border-radius: var(--sfv-radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--sfv-transition);
}

.sfv-fs-zoom-group .sfv-fs-btn {
    border: none;
    background: transparent;
    border-radius: calc(var(--sfv-radius-md) - 2px);
}

.sfv-fs-btn:hover {
    background: var(--sfv-primary);
    color: #ffffff;
    border-color: var(--sfv-primary);
}

.sfv-fs-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    background: var(--sfv-bg);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.sfv-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.sfv-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--sfv-bg-elevated);
    color: var(--sfv-text);
    padding: 0.75rem 1rem;
    border-radius: var(--sfv-radius-md);
    box-shadow: var(--sfv-shadow-lg);
    border: 1px solid var(--sfv-border);
    min-width: 240px;
    max-width: 380px;
    pointer-events: auto;
    animation: sfvSlideIn 0.3s ease;
}

@keyframes sfvSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes sfvSlideOut {
    to { transform: translateX(100%); opacity: 0; }
}

.sfv-toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sfv-toast-icon.success { color: var(--sfv-success); }
.sfv-toast-icon.error { color: var(--sfv-danger); }
.sfv-toast-icon.info { color: var(--sfv-primary); }

.sfv-toast-message {
    flex: 1;
    font-size: 0.875rem;
    min-width: 0;
}

.sfv-toast-close {
    background: none;
    border: none;
    color: var(--sfv-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--sfv-radius-sm);
    flex-shrink: 0;
}

.sfv-toast-close:hover {
    color: var(--sfv-text);
    background: var(--sfv-bg-secondary);
}

/* ============================================
   RELATED TOOLS (pills)
   ============================================ */
.sfv-related-tools {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.sfv-related-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-lg);
    border: 1px solid var(--sfv-border);
}

.sfv-related-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--sfv-text-muted);
    white-space: nowrap;
    font-size: 0.875rem;
}

.sfv-related-label i {
    color: var(--sfv-primary);
}

.sfv-related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sfv-related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4rem 0.875rem;
    background: var(--sfv-bg-secondary);
    border-radius: var(--sfv-radius-full);
    color: var(--sfv-text);
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 500;
    transition: all var(--sfv-transition);
}

.sfv-related-link:hover {
    background: var(--sfv-primary-light);
    color: var(--sfv-primary);
}

.sfv-related-link i {
    width: 14px;
    height: 14px;
}

/* ============================================
   INFO SECTIONS
   ============================================ */
.sfv-info-sections {
    margin: 0;
}

.sfv-info-card {
    background: var(--sfv-bg-elevated);
    border-radius: var(--sfv-radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--sfv-border);
}

.sfv-info-card h2 {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sfv-text);
    margin: 0 0 1.25rem;
}

.sfv-info-card h2 i {
    color: var(--sfv-primary);
}

.sfv-info-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sfv-text);
    margin: 1.25rem 0 0.625rem;
}

.sfv-info-card p,
.sfv-info-card li {
    color: var(--sfv-text-muted);
    line-height: 1.7;
    margin: 0 0 0.75rem;
    font-size: 0.925rem;
}

.sfv-info-card a {
    color: var(--sfv-primary);
    text-decoration: none;
    font-weight: 500;
}

.sfv-info-card a:hover {
    text-decoration: underline;
}

/* Features Grid */
.sfv-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.sfv-feature {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}

.sfv-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--sfv-radius-md);
    background: var(--sfv-primary-light);
    color: var(--sfv-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sfv-feature-body h4 {
    color: var(--sfv-text);
    font-size: 0.975rem;
    font-weight: 600;
    margin: 0 0 0.375rem;
}

.sfv-feature-body p {
    color: var(--sfv-text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
}

/* Steps */
.sfv-steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.sfv-steps li {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 0.875rem;
    counter-increment: step;
    color: var(--sfv-text-muted);
}

.sfv-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: var(--sfv-primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.825rem;
}

.sfv-steps li strong {
    color: var(--sfv-text);
}

.sfv-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    background: var(--sfv-primary-light);
    border-radius: var(--sfv-radius-md);
    font-size: 0.875rem;
    color: var(--sfv-text);
    line-height: 1.6;
}

.sfv-tip i {
    color: var(--sfv-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.sfv-tip strong {
    color: var(--sfv-text);
    font-weight: 600;
}

/* Syntax Badges */
.sfv-syntax-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.sfv-syntax-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--sfv-bg-secondary);
    border-radius: var(--sfv-radius-full);
    color: var(--sfv-text);
    font-size: 0.8rem;
    font-weight: 500;
}

.sfv-syntax-badge i {
    color: var(--sfv-primary);
}

/* FAQ */
.sfv-faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sfv-faq-item {
    background: var(--sfv-bg-secondary);
    border-radius: var(--sfv-radius-md);
    overflow: hidden;
}

.sfv-faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.125rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.925rem;
    font-weight: 600;
    color: var(--sfv-text);
    text-align: left;
    transition: background-color var(--sfv-transition);
}

.sfv-faq-question:hover {
    background: var(--sfv-bg-tertiary);
}

.sfv-faq-question i {
    color: var(--sfv-text-muted);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.sfv-faq-item.active .sfv-faq-question i {
    transform: rotate(180deg);
}

.sfv-faq-answer {
    display: none;
    padding: 0 1.125rem 1rem;
}

.sfv-faq-item.active .sfv-faq-answer {
    display: block;
}

.sfv-faq-answer p {
    font-size: 0.875rem;
    margin: 0;
    color: var(--sfv-text-muted);
    line-height: 1.65;
}

.sfv-faq-answer a {
    color: var(--sfv-primary);
    text-decoration: none;
    font-weight: 500;
}

.sfv-faq-answer a:hover {
    text-decoration: underline;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .tool-header,
    .sfv-upload-section,
    .sfv-processing-overlay,
    .sfv-error,
    .sfv-file-bar,
    .sfv-toolbar,
    .sfv-action-bar,
    .sfv-related-tools,
    .sfv-info-sections,
    .sfv-fullscreen,
    .sfv-toast-container {
        display: none !important;
    }

    .tool-main,
    .sfv-editor-section,
    .sfv-content-area {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
        border: none !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .sfv-subtitle-entry {
        page-break-inside: avoid;
        border: 1px solid #ddd !important;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }

    .tool-title {
        font-size: 1.5rem;
    }

    .tool-description {
        font-size: 0.875rem;
    }

    .sfv-upload-section {
        padding: 1.25rem;
    }

    .sfv-upload-area {
        padding: 2rem 1rem;
    }

    .sfv-toolbar {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .sfv-view-toggle {
        width: 100%;
        justify-content: center;
    }

    .sfv-view-btn {
        flex: 1;
        justify-content: center;
        padding: 0.4rem 0.5rem;
    }

    .sfv-view-btn span {
        display: none;
    }

    .sfv-search-wrap {
        width: 100%;
    }

    .sfv-toolbar-actions {
        width: 100%;
        justify-content: center;
    }

    .sfv-subtitle-entry {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .sfv-subtitle-index {
        justify-self: flex-start;
    }

    .sfv-stats-bar {
        grid-template-columns: 1fr 1fr;
    }

    .sfv-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .sfv-export-buttons {
        width: 100%;
    }

    .sfv-export-buttons .sfv-btn {
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.5rem;
        font-size: 0.8rem;
    }

    .sfv-btn-secondary {
        width: 100%;
    }

    .sfv-related-box {
        padding: 0.875rem 1rem;
    }

    .sfv-info-card {
        padding: 1.25rem;
    }

    .sfv-info-card h2 {
        font-size: 1.05rem;
    }

    .sfv-features-grid {
        grid-template-columns: 1fr;
    }

    .sfv-analysis-grid {
        grid-template-columns: 1fr;
    }

    .sfv-speed-bar {
        grid-template-columns: 80px 1fr 25px;
        font-size: 0.7rem;
    }

    .sfv-fs-toolbar {
        padding: 0.625rem 0.875rem;
    }

    .sfv-fs-content {
        padding: 1rem;
    }

    .sfv-toast-container {
        top: auto;
        bottom: 1rem;
        right: 0.75rem;
        left: 0.75rem;
    }

    .sfv-toast {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .sfv-stage-line {
        width: 18px;
    }

    .sfv-stage-label {
        font-size: 0.65rem;
    }

    .sfv-stats-bar {
        grid-template-columns: 1fr;
    }

    .sfv-subtitle-timestamps {
        font-size: 0.7rem;
    }

    .sfv-timestamp-duration {
        margin-left: 0;
    }
}
