/* ============================================
   TIFF File Viewer
   Prefix: tfv-
   Dark mode support, light mode default
   Blue theme (#3399cc) for viewer tools
   ============================================ */

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

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

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

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

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

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

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

    --tfv-transition: 0.25s;
}

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

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

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

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

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

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

/* Allow overlays/fullscreen and prevent clipping */
.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(--tfv-primary);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

/* ============================================
   PROCESSING OVERLAY (compress-gif style)
   ============================================ */
.tfv-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: tfvFadeIn 0.2s ease;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Page Navigation */
.tfv-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--tfv-bg-secondary);
    border-bottom: 1px solid var(--tfv-border);
    flex-wrap: wrap;
}

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

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

.tfv-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tfv-page-indicator {
    color: var(--tfv-text);
    font-size: 0.875rem;
}

.tfv-page-indicator strong {
    color: var(--tfv-primary);
    font-weight: 700;
}

.tfv-page-thumbs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    max-width: 100%;
    padding: 0.25rem 0;
    flex-wrap: nowrap;
    width: 100%;
    justify-content: center;
    scrollbar-width: thin;
}

.tfv-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--tfv-radius-sm);
    border: 2px solid var(--tfv-border);
    background: var(--tfv-bg-elevated);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    padding: 0;
    transition: border-color var(--tfv-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tfv-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tfv-thumb.active {
    border-color: var(--tfv-primary);
    box-shadow: 0 0 0 2px var(--tfv-primary-light);
}

.tfv-thumb-num {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.625rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

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

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

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

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

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

.tfv-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

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

.tfv-zoom-level {
    color: var(--tfv-text);
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 48px;
    text-align: center;
}

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

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

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

.tfv-zoom-group .tfv-icon-btn:hover {
    background: var(--tfv-primary);
    color: #fff;
}

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

/* Content Area */
.tfv-content-area {
    background: var(--tfv-bg);
    min-height: 400px;
    position: relative;
    overflow: hidden;
}

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

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

.tfv-image-container {
    width: 100%;
    min-height: 400px;
    max-height: 70vh;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-image: 
        linear-gradient(45deg, var(--tfv-bg-secondary) 25%, transparent 25%),
        linear-gradient(-45deg, var(--tfv-bg-secondary) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--tfv-bg-secondary) 75%),
        linear-gradient(-45deg, transparent 75%, var(--tfv-bg-secondary) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

#tfvPreviewImage {
    max-width: 100%;
    height: auto;
    transition: transform 0.2s ease;
    display: block;
}

/* Metadata Panel */
.tfv-metadata-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
    min-width: 0;
}

.tfv-meta-item {
    background: var(--tfv-bg-elevated);
    border-radius: var(--tfv-radius-md);
    padding: 0.875rem 1rem;
    border: 1px solid var(--tfv-border);
    min-width: 0;
}

.tfv-meta-label {
    font-size: 0.7rem;
    color: var(--tfv-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: block;
}

.tfv-meta-value {
    color: var(--tfv-text);
    font-size: 0.875rem;
    word-break: break-word;
    font-weight: 500;
}

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

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

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

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

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

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

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

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

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

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

.tfv-btn-success {
    background: var(--tfv-success);
    color: #ffffff;
    border-color: var(--tfv-success);
}

.tfv-btn-success:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

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

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

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

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

/* ============================================
   FULLSCREEN
   ============================================ */
.tfv-fullscreen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.tfv-fs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tfv-fs-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    min-width: 0;
    flex: 1;
}

#tfvFsFileName {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#tfvFsPageInfo {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.825rem;
    flex-shrink: 0;
}

.tfv-fs-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.tfv-fs-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    border-radius: var(--tfv-radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--tfv-transition);
}

.tfv-fs-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tfv-fs-zoom {
    color: #ffffff;
    font-size: 0.825rem;
    font-weight: 600;
    min-width: 48px;
    text-align: center;
}

.tfv-fs-image-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    padding: 1rem;
}

#tfvFsImage {
    max-width: 95%;
    max-height: 95%;
    transition: transform 0.2s ease;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Format Features List */
.tfv-format-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.tfv-format-features li {
    padding: 0.75rem 1rem;
    background: var(--tfv-bg);
    border-radius: var(--tfv-radius-md);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* FAQ - matches tgd pattern using .active */
.tfv-faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.tfv-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(--tfv-text);
    text-align: left;
    transition: background-color var(--tfv-transition);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

    .tfv-toolbar {
        padding: 0.625rem;
    }

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

    .tfv-view-btn {
        flex: 1;
        justify-content: center;
    }

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

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

    .tfv-image-container {
        padding: 0.75rem;
        min-height: 280px;
    }

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

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

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

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

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

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

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

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

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

    .tfv-fs-controls {
        gap: 0.25rem;
    }

    .tfv-fs-btn {
        width: 32px;
        height: 32px;
    }

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

    .tfv-page-thumbs {
        gap: 0.375rem;
    }

    .tfv-thumb {
        width: 50px;
        height: 50px;
    }

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

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

@media (max-width: 480px) {
    .tfv-stages {
        gap: 0;
    }

    .tfv-stage-line {
        width: 18px;
    }

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

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