/* ============================================
   Add Text to GIF - Stylesheet
   SURITD TOOLS Design System
   Dark mode support with light mode default
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    --transition-speed: 0.25s;
    --primary: #3399cc;
    --primary-light: #dbeafe;
    --primary-dark: #2980b9;
    --accent: #60a5fa;
    --success: #339966;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-secondary: #f1f5f9;
    --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;
    --checker-light: #f0f0f0;
    --checker-dark: #e0e0e0;
    --notice-bg: #ebf5fb;
    --notice-border: #3399cc;
    --notice-title: #2980b9;
    --notice-text: #3399cc;
    --upload-bg: #fafafa;
    --upload-hover-bg: #ebf5fb;
    --step-line: #b3d9ec;
}

/* 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;
    --danger: #F87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-secondary: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --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);
    --checker-light: #374151;
    --checker-dark: #4b5563;
    --notice-bg: rgba(96, 165, 250, 0.1);
    --notice-border: #60a5fa;
    --notice-title: #93c5fd;
    --notice-text: #bfdbfe;
    --upload-bg: #1e293b;
    --upload-hover-bg: rgba(96, 165, 250, 0.1);
    --step-line: rgba(96, 165, 250, 0.3);
}

/* 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;
}

/* Samples Hint */
.samples-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.samples-hint i { color: var(--warning); }
.samples-hint a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.samples-hint a:hover { text-decoration: underline; }

/* Preview Notice */
.preview-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--notice-bg);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--notice-border);
    transition: background var(--transition-speed), border-color var(--transition-speed);
}
.preview-notice i {
    color: var(--notice-border);
    flex-shrink: 0;
    margin-top: 2px;
}
.preview-notice-content { flex: 1; }
.preview-notice-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--notice-title);
    margin-bottom: 0.25rem;
}
.preview-notice-text {
    font-size: 0.8rem;
    color: var(--notice-text);
    margin: 0;
}

/* 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: #3399cc;
    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.2);
    flex-shrink: 0;
}
[data-theme="dark"] .tool-icon-wrapper {
    background: #3b82f6;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(59, 130, 246, 0.2);
}
.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: #3399cc;
    letter-spacing: -0.02em;
}
[data-theme="dark"] .tool-title { color: #60a5fa; }
.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);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

/* Error Banner */
.error-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--danger-light);
    border-bottom: 1px solid var(--danger);
    color: var(--danger);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}
.error-icon { flex-shrink: 0; }
.error-content { flex: 1; }
.error-content a { color: var(--danger); font-weight: 600; text-decoration: underline; }
.error-close {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.error-close:hover { background: rgba(239, 68, 68, 0.1); }
[data-theme="dark"] .error-close:hover { background: rgba(248, 113, 113, 0.2); }

/* 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: rgba(51, 153, 204, 0.04);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.upload-area:hover,
.upload-area.dragover {
    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 { 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;
    transition: background-color var(--transition-speed);
}

/* Editor Section */
.editor-section { padding: 0; }

/* File Info Bar */
.file-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.25rem 2rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-speed), border-color var(--transition-speed);
}
.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; }

/* Editor Grid */
.editor-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 0;
}

/* Panels */
.preview-panel { padding: 1.5rem; }
.preview-panel {
    background: var(--bg);
    border-right: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}
.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); }
.panel-hint { font-size: 0.8rem; color: var(--text-muted); }

/* Preview Container */
.preview-container { position: relative; }
.gif-canvas {
    position: relative;
    background: 
        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: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    min-height: 200px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition-speed);
}
.gif-image-wrapper {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%;
}
.gif-canvas img { max-width: 100%; max-height: 400px; display: block; }
.text-overlays {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    overflow: hidden;
}
.text-overlay {
    position: absolute;
    cursor: grab;
    pointer-events: auto;
    user-select: none;
    line-height: 1;
    padding: 0;
    transition: box-shadow 0.2s;
    white-space: nowrap;
}
.text-overlay:hover { box-shadow: 0 0 0 2px rgba(51, 153, 204, 0.5); }
.text-overlay.active { box-shadow: 0 0 0 2px var(--primary), 0 0 0 4px rgba(51, 153, 204, 0.2); }
.text-overlay.dragging { cursor: grabbing; opacity: 0.9; }

/* Controls Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    max-height: 680px;
    background: var(--bg-elevated);
    transition: background-color var(--transition-speed);
    padding: 1.5rem;
}
.controls-panel .panel-header { margin-bottom: 0; }

/* Control Group improvements */
.control-group { display: flex; flex-direction: column; gap: 0.375rem; }
.control-group > label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.section-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.section-label svg,
.section-label i { color: var(--primary); }

/* Layers */
.layers-section {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}
.layers-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 120px;
    overflow-y: auto;
}
.layer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.layer-item:hover { border-color: var(--border); }
.layer-item.active { border-color: var(--primary); background: var(--primary-light); }
.layer-icon { color: var(--text-muted); }
.layer-item.active .layer-icon { color: var(--primary); }
.layer-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Button Icon */
.btn-icon {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-icon:hover { background: var(--primary); border-color: var(--primary); color: white; }

/* Control Section */
.control-section { display: flex; flex-direction: column; gap: 0.5rem; }

/* Text Input */
.text-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text);
    background: var(--bg-elevated);
    transition: all 0.2s;
}
.text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(51, 153, 204, 0.1);
}
[data-theme="dark"] .text-input:focus { box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15); }
.text-input::placeholder { color: var(--text-muted); }

/* Control Row Grid */
.control-row-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.control-group { display: flex; flex-direction: column; gap: 0.5rem; }
.control-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }

/* Styled Select */
.styled-select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg-elevated);
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}
[data-theme="dark"] .styled-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
.styled-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(51, 153, 204, 0.1);
}
[data-theme="dark"] .styled-select:focus { box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15); }

/* Slider */
.slider-with-value { display: flex; align-items: center; gap: 0.75rem; }
.slider-input {
    flex: 1;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}
.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.slider-input::-webkit-slider-thumb:hover { transform: scale(1.1); }
.slider-input::-moz-range-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.slider-input.small { width: 80px; flex: none; }
.slider-value {
    min-width: 45px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-align: right;
}

/* Style Buttons */
.style-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.style-btn {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.style-btn:hover { border-color: var(--primary); color: var(--primary); }
.style-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* Color Picker */
.color-picker-group { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.color-picker-group label { font-size: 0.8rem; color: var(--text-secondary); }
.color-input {
    width: 36px; height: 36px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 2px;
    background: var(--bg-elevated);
    transition: border-color var(--transition-speed);
}
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.color-input.small { width: 30px; height: 30px; }

/* Effects Section */
.effects-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}
.effect-row { display: flex; align-items: center; gap: 0.5rem; }
.effect-label { min-width: 55px; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}
.btn-primary {
    background: #3399cc;
    color: white;
    box-shadow: 0 4px 14px rgba(51, 153, 204, 0.3);
}
.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(51, 153, 204, 0.4);
}
[data-theme="dark"] .btn-primary {
    background: #3b82f6;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}
[data-theme="dark"] .btn-primary:hover {
    background: #60a5fa;
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.4);
}
.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); color: var(--text); border-color: var(--text-muted); }
.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger);
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
}
.btn-danger-outline:hover { background: var(--danger); color: white; }
.btn-danger-outline:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger-outline:disabled:hover { background: transparent; color: var(--danger); }

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

/* Processing Overlay */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
[data-theme="dark"] .processing-overlay { background: rgba(0, 0, 0, 0.7); }
.processing-content {
    background: var(--bg-elevated);
    padding: 2rem 3rem;
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    border: 1px solid var(--border);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}
.processing-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-text { color: var(--text); font-size: 1.1rem; font-weight: 500; margin: 0 0 0.5rem; }
.processing-subtext { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1rem; }
.progress-bar-container {
    height: 8px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.3s ease;
}
.progress-text { font-size: 0.85rem; color: var(--text-secondary); margin: 0; }

/* Results Section */
.results-section { padding: 3rem; text-align: center; }
.results-header { margin-bottom: 2rem; }
.success-icon {
    width: 80px; height: 80px;
    margin: 0 auto 1rem;
    background: var(--success-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
}
.results-header h2 { font-size: 1.75rem; color: var(--success); margin: 0 0 0.5rem; }
.results-header p { color: var(--text-secondary); margin: 0; }

/* Comparison */
.results-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.comparison-item { text-align: center; }
.comparison-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.comparison-preview {
    width: 220px; height: 165px;
    background: 
        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;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: border-color var(--transition-speed);
}
.comparison-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.comparison-stats { font-size: 0.85rem; color: var(--text-secondary); }
.comparison-stats.highlight { color: var(--primary); font-weight: 600; }
.comparison-arrow { color: var(--text-muted); }
.results-actions { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

/* Error Message */
.error-message {
    margin: 1rem 2rem;
    padding: 1rem 1.5rem;
    background: var(--danger-light);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    color: var(--danger);
    font-weight: 500;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}
.error-message a { color: var(--danger); font-weight: 600; text-decoration: underline; }

/* 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 var(--transition-speed), border-color var(--transition-speed);
}
.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 - Clean, no background/shadow/border */
.info-sections { display: grid; gap: 2rem; margin-top: 3rem; }
.info-card { padding: 2rem 0; }
.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 a { color: var(--primary); text-decoration: none; font-weight: 500; }
.info-card a:hover { text-decoration: underline; }

/* 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(--step-line);
}
.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0; top: 0;
    width: 2rem; height: 2rem;
    background: #3399cc;
    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;
}
[data-theme="dark"] .steps-list li::before { background: #3b82f6; }

/* Tips Grid */
.tips-grid { display: grid; gap: 1.25rem; }
.tip-item { display: flex; gap: 1rem; align-items: flex-start; }
.tip-icon {
    flex-shrink: 0;
    width: 40px; height: 40px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: background-color var(--transition-speed);
}
.tip-item strong { display: block; color: var(--text); margin-bottom: 0.25rem; }
.tip-item p { margin: 0; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }

/* FAQ */
.faq-list { display: grid; gap: 0.75rem; }
.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-speed);
}
.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);
    transition: background-color var(--transition-speed);
}
.faq-item.open .faq-answer { display: block; }
.faq-answer p { margin: 0; color: var(--text-secondary); line-height: 1.7; }
.faq-answer a { color: var(--primary); text-decoration: none; font-weight: 500; }
.faq-answer a:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Selection */
::selection { background: rgba(51, 153, 204, 0.2); color: var(--text); }
[data-theme="dark"] ::selection { background: rgba(96, 165, 250, 0.3); }

/* Responsive */
@media (max-width: 900px) {
    .editor-grid { grid-template-columns: 1fr; }
    .preview-panel { border-right: none; border-bottom: 1px solid var(--border); }
    .file-info-bar { justify-content: center; }
    .controls-panel { max-height: none; }
}

@media (max-width: 768px) {
    .tool-container { padding: 1rem; }
    .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,
    .results-section { padding: 2rem 1.5rem; }
    .preview-panel,
    .controls-panel { padding: 1.25rem; }
    .control-row-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; padding: 1.25rem; }
    .btn { width: 100%; }
    .results-comparison { flex-direction: column; }
    .comparison-arrow { transform: rotate(90deg); }
    .related-tools { flex-direction: column; text-align: center; }
    .related-links { justify-content: center; }
    .panel-header { flex-wrap: wrap; gap: 0.5rem; }
    .style-buttons { flex-wrap: wrap; }
    .effect-row { flex-wrap: wrap; }
    .slider-input.small { width: 60px; }
}

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

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.editor-section,
.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;
    }
}
