/* ============================================
   SVG File Viewer - Modern Stylesheet
   With Dark Mode Support
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    --transition-speed: 0.25s;
    
    /* Primary Colors - Orange theme for SVG */
    --primary: #f97316;
    --primary-light: #ffedd5;
    --primary-dark: #ea580c;
    --accent: #3b82f6;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --danger: #EF4444;
    --purple: #8B5CF6;
    --purple-light: #EDE9FE;
    --teal: #14B8A6;
    --pink: #EC4899;
    
    /* Background Colors */
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-secondary: #f1f5f9;
    
    /* Text Colors */
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Border Colors */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Shadows */
    --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 */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Code viewer specific */
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    --code-tag: #569cd6;
    --code-attr: #9cdcfe;
    --code-value: #ce9178;
    --code-comment: #6a9955;
    --code-highlight: rgba(249, 115, 22, 0.3);
    --code-line-number: #858585;
    
    /* SVG element colors */
    --el-path: #10B981;
    --el-rect: #3B82F6;
    --el-circle: #8B5CF6;
    --el-text: #F59E0B;
    --el-group: #EC4899;
    --el-other: #64748b;
    
    /* Upload area */
    --upload-bg: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    --upload-hover-bg: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    
    /* Scrollbar */
    --scrollbar-track: var(--bg);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
    
    /* Transparency grid */
    --grid-light: #ffffff;
    --grid-dark: #e5e5e5;
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --primary: #fb923c;
    --primary-light: rgba(251, 146, 60, 0.15);
    --primary-dark: #f97316;
    --accent: #60a5fa;
    --success: #4ade80;
    --success-light: rgba(74, 222, 128, 0.15);
    --warning: #fbbf24;
    --danger: #f87171;
    --purple: #a78bfa;
    --purple-light: rgba(167, 139, 250, 0.15);
    
    /* Background Colors */
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-secondary: #334155;
    
    /* Text Colors */
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Border Colors */
    --border: #334155;
    --border-light: #475569;
    
    /* Shadows */
    --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);
    
    /* Code viewer - dark mode */
    --code-bg: #0d1117;
    --code-text: #c9d1d9;
    --code-tag: #79c0ff;
    --code-attr: #7ee787;
    --code-value: #a5d6ff;
    --code-comment: #8b949e;
    --code-highlight: rgba(251, 146, 60, 0.3);
    --code-line-number: #484f58;
    
    /* Upload area */
    --upload-bg: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    --upload-hover-bg: linear-gradient(135deg, rgba(249, 115, 22, 0.1) 0%, rgba(249, 115, 22, 0.2) 100%);
    
    /* Scrollbar */
    --scrollbar-track: var(--bg-elevated);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
    
    /* Transparency grid */
    --grid-light: #374151;
    --grid-dark: #1f2937;
}

/* 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 var(--transition-speed), color var(--transition-speed);
}

/* Container */
.tool-container {
    max-width: 1000px;
    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-inline {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    color: var(--primary);
}

.tool-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

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

/* 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);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

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

.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(--upload-bg);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.05), rgba(234, 88, 12, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.upload-area:hover::before,
.upload-area.dragover::before,
.upload-area.active::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-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    transition: background-color var(--transition-speed);
}

.file-types {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    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;
}

/* Progress Container */
.progress-container {
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.progress-bar-wrapper {
    height: 8px;
    background: var(--bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    display: block;
}

/* Error Container */
.error-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    margin: 1rem 2rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
}

.error-container svg {
    flex-shrink: 0;
}

.error-container span {
    flex: 1;
}

.error-close {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.error-close:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Editor Section */
.editor-section {
    padding: 0;
    animation: fadeIn 0.4s ease;
}

/* 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 var(--transition-speed), border-color var(--transition-speed);
}

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

.file-info-item svg {
    color: var(--primary);
}

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

/* Viewer Toolbar */
.viewer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    padding: 0.25rem;
    gap: 0.25rem;
}

.view-toggle button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle button:hover {
    color: var(--text);
    background: var(--bg);
}

.view-toggle button.active {
    background: var(--bg-elevated);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 1.25rem 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.stat-icon.elements { background: linear-gradient(135deg, var(--success), #059669); }
.stat-icon.dimensions { background: linear-gradient(135deg, var(--accent), #2563eb); }
.stat-icon.viewbox { background: linear-gradient(135deg, var(--purple), #7c3aed); }
.stat-icon.size { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Preview Panel */
.preview-panel {
    padding: 2rem;
    min-height: 300px;
    transition: background-color var(--transition-speed);
}

.preview-panel:not(.active) {
    display: none;
}

/* SVG Preview */
.svg-preview-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.svg-canvas-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--grid-light);
    background-image: 
        linear-gradient(45deg, var(--grid-dark) 25%, transparent 25%),
        linear-gradient(-45deg, var(--grid-dark) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--grid-dark) 75%),
        linear-gradient(-45deg, transparent 75%, var(--grid-dark) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border: 1px solid var(--border);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.svg-canvas-wrapper svg {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
}

.svg-zoom-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.zoom-level {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* SVG Elements Summary */
.elements-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

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

.element-badge:hover {
    background: var(--bg);
    box-shadow: var(--shadow-sm);
}

.element-count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
}

.element-count.path { background: var(--el-path); }
.element-count.rect { background: var(--el-rect); }
.element-count.circle { background: var(--el-circle); }
.element-count.ellipse { background: var(--purple); }
.element-count.line { background: var(--teal); }
.element-count.polygon { background: var(--pink); }
.element-count.polyline { background: var(--warning); }
.element-count.text { background: var(--el-text); }
.element-count.g { background: var(--el-group); }
.element-count.defs { background: var(--el-other); }
.element-count.use { background: var(--accent); }
.element-count.image { background: var(--danger); }
.element-count.other { background: var(--el-other); }

.element-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Info Panel */
.info-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.info-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text);
}

.info-section-header svg {
    color: var(--primary);
}

.info-section-content {
    padding: 1rem 1.25rem;
}

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

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
}

.info-value.mono {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    background: var(--bg);
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* Code Panel */
.code-viewer {
    background: var(--code-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 500px;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.code-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--code-text);
    font-size: 0.85rem;
    font-weight: 500;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
}

.code-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--code-text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.code-content {
    overflow: auto;
    max-height: 450px;
    padding: 1rem;
}

.code-content pre {
    margin: 0;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--code-text);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Syntax highlighting */
.code-tag { color: var(--code-tag); }
.code-attr { color: var(--code-attr); }
.code-value { color: var(--code-value); }
.code-comment { color: var(--code-comment); font-style: italic; }

/* Structure Panel */
.structure-tree {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
}

.tree-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.tree-item:last-child {
    border-bottom: none;
}

.tree-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s ease;
}

.tree-row:hover {
    background: var(--bg-secondary);
}

.tree-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.tree-toggle.expanded {
    transform: rotate(90deg);
}

.tree-tag {
    font-weight: 600;
    color: var(--primary);
}

.tree-attr {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.tree-children {
    padding-left: 1.5rem;
    display: none;
}

.tree-item.open > .tree-children {
    display: block;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.action-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.35);
}

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

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

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: var(--bg);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Related Tools */
.related-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-top: 2rem;
    flex-wrap: wrap;
    transition: background-color var(--transition-speed);
}

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

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

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

.tool-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.tool-link svg {
    width: 16px;
    height: 16px;
}

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

.info-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

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

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

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

.feature-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.feature-item:hover {
    background: var(--bg);
    box-shadow: var(--shadow-sm);
}

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

.feature-icon.orange { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.feature-icon.blue { background: linear-gradient(135deg, var(--accent), #2563eb); }
.feature-icon.green { background: linear-gradient(135deg, var(--success), #059669); }
.feature-icon.purple { background: linear-gradient(135deg, var(--purple), #7c3aed); }

.feature-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    color: var(--text);
}

.feature-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Format Grid */
.format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

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

.format-card:hover {
    background: var(--bg);
    box-shadow: var(--shadow-sm);
}

.format-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    background: var(--primary);
}

.format-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.format-ext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.faq-item {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

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

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

.faq-question span {
    flex: 1;
    padding-right: 1rem;
}

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

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

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 1.25rem 1.25rem;
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

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

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

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.success svg {
    color: var(--success);
}

.toast-notification.error svg {
    color: var(--danger);
}

/* Fullscreen Overlay */
.fullpage-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-elevated);
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.fullpage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
    flex-shrink: 0;
}

.fullpage-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.fullpage-title svg {
    color: var(--primary);
}

.fullpage-controls {
    display: flex;
    gap: 0.75rem;
}

.fullpage-content {
    flex: 1;
    overflow: auto;
    padding: 2rem;
    background: var(--bg);
}

.close-fullpage {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.close-fullpage:hover {
    background: #DC2626;
}

/* Responsive */
@media (max-width: 900px) {
    .viewer-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        justify-content: center;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .action-group {
        width: 100%;
        justify-content: center;
    }
    
    .elements-summary {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .upload-section {
        padding: 2rem 1.5rem;
    }
    
    .upload-area {
        padding: 3rem 1.5rem;
    }
    
    .viewer-toolbar {
        padding: 1rem;
    }
    
    .stats-bar {
        gap: 1rem;
        padding: 1rem;
    }
    
    .action-bar {
        padding: 1.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .file-info-bar {
        justify-content: center;
    }
    
    .related-tools {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .related-links {
        width: 100%;
    }
    
    .tool-link {
        flex: 1;
        min-width: calc(50% - 0.375rem);
        justify-content: center;
    }
    
    .format-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .tool-title {
        font-size: 1.75rem;
    }
    
    .tool-title-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .file-info-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .view-toggle {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .view-toggle button {
        flex: 1;
        justify-content: center;
    }
    
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .feature-item {
        flex-direction: column;
    }
    
    .format-grid {
        grid-template-columns: 1fr;
    }
    
    .fullpage-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .fullpage-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .toast-notification {
        left: 1rem;
        right: 1rem;
        transform: translateX(0) translateY(100px);
    }
    
    .toast-notification.show {
        transform: translateX(0) translateY(0);
    }
    
    .elements-summary {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}

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

/* Print Styles */
@media print {
    .upload-section,
    .viewer-toolbar,
    .action-bar,
    .stats-bar,
    .info-sections,
    .related-tools {
        display: none !important;
    }
    
    .tool-main {
        box-shadow: none;
        border: none;
    }
    
    .editor-section {
        display: block !important;
    }
    
    .preview-panel {
        display: block !important;
        max-height: none !important;
    }
}

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

/* Scrollbar styling */
::-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);
}

/* Selection */
::selection {
    background: rgba(249, 115, 22, 0.2);
    color: var(--text);
}

[data-theme="dark"] ::selection {
    background: rgba(251, 146, 60, 0.3);
}
