/* ============================================
   TIFF Analyzer - Modern Stylesheet
   Blue Color Theme for ConvertICO
   Dark Mode Support with Light Mode Default
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    --primary: #3399cc;
    --primary-light: #dbeafe;
    --primary-dark: #2980b9;
    --accent: #60a5fa;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    
    --quality: #3399cc;
    --elements: #60a5fa;
    --optimization: #93c5fd;
    
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Checkerboard */
    --checker-light: #f0f0f0;
    --checker-dark: #e0e0e0;
    
    /* Scrollbar */
    --scrollbar-track: var(--bg);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
    
    /* Accordion */
    --accordion-bg: #dbeafe;
    --accordion-bg-hover: #bfdbfe;
}

/* CSS Variables - Dark Mode */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-light: rgba(96, 165, 250, 0.15);
    --primary-dark: #3b82f6;
    --accent: #93c5fd;
    --success: #4ade80;
    --success-light: rgba(74, 222, 128, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    
    --quality: #60a5fa;
    --elements: #93c5fd;
    --optimization: #bfdbfe;
    
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-secondary: #334155;
    --bg-tertiary: #475569;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-light: #475569;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
    
    /* Checkerboard */
    --checker-light: #334155;
    --checker-dark: #475569;
    
    /* Scrollbar */
    --scrollbar-track: var(--bg-elevated);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
    
    /* Accordion */
    --accordion-bg: #1e3a5f;
    --accordion-bg-hover: #254a73;
}

/* Base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tool-icon-wrapper {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(51, 153, 204, 0.25);
    flex-shrink: 0;
}

.tool-icon-wrapper svg,
.tool-icon-wrapper i {
    width: 28px;
    height: 28px;
}

.tool-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0;
    color: var(--primary);
    letter-spacing: -0.02em;
}

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

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

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

/* Main Tool Area */
.tool-main {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Upload Section */
.upload-section {
    padding: 3rem;
    position: relative;
}

.upload-form {
    width: 100%;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-light);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover,
.upload-area.highlight {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-area:hover::before,
.upload-area.dragover::before {
    opacity: 1;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-5px);
}

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

.upload-subtitle {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    font-size: 1rem;
}

.upload-hint {
    display: inline-block;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
}

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

.file-type-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Processing Overlay */
.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

[data-theme="dark"] .processing-overlay {
    background: rgba(15, 23, 42, 0.95);
}

.processing-content {
    text-align: center;
    padding: 3rem;
}

.processing-spinner {
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.processing-spinner .spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.processing-status {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

/* Results Section */
.results-section {
    padding: 0;
}

/* File Info Bar */
.file-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.file-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.file-info-item svg,
.file-info-item i {
    color: var(--primary);
    flex-shrink: 0;
}

/* Analysis Grid - Single Column Layout */
.analysis-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Compact Preview Section */
.preview-section-compact {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.preview-thumbnail {
    width: 200px;
    height: 150px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.preview-thumbnail.checkerboard-bg {
    background-image: linear-gradient(45deg, var(--checker-light) 25%, transparent 25%), 
                      linear-gradient(-45deg, var(--checker-light) 25%, transparent 25%), 
                      linear-gradient(45deg, transparent 75%, var(--checker-light) 75%), 
                      linear-gradient(-45deg, transparent 75%, var(--checker-light) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: var(--bg-elevated);
}

.preview-thumbnail img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.preview-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.25rem 0;
    transition: color 0.3s ease;
}

.preview-title i,
.preview-title svg {
    color: var(--primary);
    width: 20px;
    height: 20px;
}

.preview-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 1rem 0;
    transition: color 0.3s ease;
}

.preview-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-view-full {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-full:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 153, 204, 0.3);
}

.btn-view-full i,
.btn-view-full svg {
    width: 16px;
    height: 16px;
}

.btn-convert {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

[data-theme="dark"] .btn-convert {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text);
}

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

[data-theme="dark"] .btn-convert:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-convert i,
.btn-convert svg {
    width: 16px;
    height: 16px;
}

.bg-toggle-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

/* Panels */
.analysis-panel {
    padding: 2rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.panel-header h3 svg,
.panel-header h3 i {
    color: var(--primary);
}

/* Background Toggle */
.bg-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bg-toggle-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border);
    transition: 0.3s;
    border-radius: var(--radius-full);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .toggle-slider {
    background: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Small toggle variant */
.toggle-switch.small {
    width: 36px;
    height: 20px;
}

.toggle-switch.small .toggle-slider:before {
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
}

.toggle-switch.small input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

/* Quality Score Card */
.quality-score-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.quality-score-card.score-high {
    background: var(--success-light);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.quality-score-card.score-medium {
    background: var(--warning-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.quality-score-card.score-low {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.score-ring {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-high .score-ring {
    background: var(--success);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.score-medium .score-ring {
    background: var(--warning);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.score-low .score-ring {
    background: var(--danger);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.score-ring .score-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
}

.score-details {
    display: flex;
    flex-direction: column;
}

.score-details .score-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}

.score-details .score-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.stat-card.opt-high {
    background: var(--danger-light);
    border-color: rgba(239, 68, 68, 0.2);
}

.stat-card.opt-medium {
    background: var(--warning-light);
    border-color: rgba(245, 158, 11, 0.2);
}

.stat-card.opt-low {
    background: var(--success-light);
    border-color: rgba(16, 185, 129, 0.2);
}

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

.stat-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Accordion Sections */
.accordion-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.accordion-trigger {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--accordion-bg);
    border: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.accordion-trigger:hover {
    background: var(--accordion-bg-hover);
}

.accordion-trigger span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accordion-trigger span svg,
.accordion-trigger span i {
    color: var(--primary);
}

.accordion-icon {
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.accordion-section.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 0 1.25rem 1.25rem;
    background: var(--bg-elevated);
}

.accordion-section.open .accordion-content {
    display: block;
}

/* Elements List / IFD Entries */
.elements-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.element-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.element-name {
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--primary);
    flex: 1;
}

.element-count {
    font-weight: 600;
    color: var(--text);
    margin: 0 1rem;
    min-width: 30px;
    text-align: center;
}

.element-impact {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.impact-high {
    background: var(--danger-light);
    color: var(--danger);
}

.impact-medium {
    background: var(--warning-light);
    color: #92400E;
}

.impact-low {
    background: var(--success-light);
    color: #065F46;
}

/* Attributes List / Metadata */
.attributes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attribute-item {
    display: flex;
    gap: 1rem;
    padding: 0.625rem 0.875rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.attribute-name {
    font-weight: 600;
    color: var(--primary);
    min-width: 120px;
    flex-shrink: 0;
}

.attribute-value {
    color: var(--text-secondary);
    word-break: break-all;
    flex: 1;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 1rem;
    font-style: italic;
}

/* Recommendations Section */
.recommendations-section {
    padding: 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

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

.recommendation-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.recommendation-item a:hover {
    text-decoration: underline;
}

/* Recommended Tools */
.recommended-tools h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 1rem;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.tool-card-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.tool-card-link:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.tool-info {
    display: flex;
    flex-direction: column;
}

.tool-info .tool-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.tool-info .tool-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn svg,
.btn i {
    flex-shrink: 0;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(51, 153, 204, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(51, 153, 204, 0.4);
}

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

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

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem;
    padding: 1rem 1.5rem;
    background: var(--danger-light);
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    color: var(--danger);
    font-weight: 500;
}

.error-message svg,
.error-message i {
    flex-shrink: 0;
}

/* Related Tools */
.related-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.related-label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

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

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--bg);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.related-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.related-link svg,
.related-link i {
    flex-shrink: 0;
}

/* Info Sections */
.info-sections {
    display: grid;
    gap: 2rem;
    margin-top: 3rem;
}

.info-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.35rem;
    color: var(--text);
    margin: 0 0 1.5rem;
}

.info-card h2 svg,
.info-card h2 i {
    color: var(--primary);
    flex-shrink: 0;
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0 0 1rem;
}

.info-card p:last-child {
    margin-bottom: 0;
}

.info-card p a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted var(--primary);
    transition: all 0.2s ease;
}

.info-card p a:hover {
    border-bottom-style: solid;
}

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

.steps-list li {
    position: relative;
    padding-left: 3.5rem;
    padding-bottom: 1.25rem;
    counter-increment: step;
    color: var(--text-secondary);
    line-height: 1.6;
}

.steps-list li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(1rem - 1px);
    top: 2rem;
    bottom: 0;
    width: 2px;
    background: var(--primary-light);
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    z-index: 1;
}

/* Mode Explanations */
.mode-explanations {
    display: grid;
    gap: 1rem;
}

.mode-explain {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.mode-tag {
    flex-shrink: 0;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.mode-tag.quality {
    background: var(--quality);
}

.mode-tag.elements {
    background: var(--elements);
}

.mode-tag.optimization {
    background: var(--optimization);
}

.mode-explain p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Use Cases Grid */
.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.use-case {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.use-case:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.use-case-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.use-case-content h4 {
    margin: 0 0 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.use-case-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.use-cases-tip {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--primary);
    margin-top: 0;
    transition: background-color 0.3s ease;
}

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

.use-cases-tip span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.use-cases-tip a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.use-cases-tip a:hover {
    text-decoration: underline;
}

/* FAQ */
.faq-list {
    display: grid;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

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

.faq-question svg,
.faq-question i {
    color: var(--primary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.faq-item.open .faq-question svg,
.faq-item.open .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    display: none;
    padding: 0 1.25rem 1rem;
    background: var(--bg-elevated);
}

.faq-item.open .faq-answer {
    display: block;
}

.faq-answer p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Responsive */
@media (max-width: 900px) {
    .preview-section-compact {
        grid-template-columns: 150px 1fr;
        gap: 1rem;
    }
    
    .preview-thumbnail {
        width: 150px;
        height: 120px;
    }
    
    .file-info-bar {
        justify-content: center;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .preview-section-compact {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 1.5rem;
    }
    
    .preview-thumbnail {
        width: 100%;
        max-width: 200px;
        height: 150px;
        margin: 0 auto;
    }
    
    .preview-actions {
        align-items: center;
    }
    
    .preview-buttons {
        justify-content: center;
    }
    
    .tool-title-row {
        flex-direction: row;
        gap: 0.75rem;
    }
    
    .tool-icon-wrapper {
        width: 48px;
        height: 48px;
    }
    
    .tool-icon-wrapper svg,
    .tool-icon-wrapper i {
        width: 24px;
        height: 24px;
    }
    
    .upload-section {
        padding: 2rem 1.5rem;
    }
    
    .analysis-panel {
        padding: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .action-bar {
        flex-direction: column;
        padding: 1.5rem;
    }
    
    .btn {
        width: 100%;
    }
    
    .related-tools {
        flex-direction: column;
        text-align: center;
    }
    
    .related-links {
        justify-content: center;
    }
    
    .mode-explain {
        flex-direction: column;
    }
    
    .use-cases-grid {
        grid-template-columns: 1fr;
    }
    
    .use-case {
        padding: 1rem;
    }
    
    .quality-score-card {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .tool-title {
        font-size: 1.5rem;
    }
    
    .file-info-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .steps-list li {
        padding-left: 3rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-section {
    animation: fadeIn 0.4s ease;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
