/* ============================================
   YouTube Thumbnail Maker - Modern Styling
   Dark mode support with light mode default
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    --transition-speed: 0.25s;
    
    /* Primary Colors - YouTube Theme */
    --primary: #e64e4e;
    --primary-light: #fef2f2;
    --primary-dark: #dc2626;
    --accent: #3399cc;
    --accent-light: #e0f2fe;
    --secondary: #339966;
    --secondary-light: #dcfce7;
    
    /* Status Colors */
    --success: #339966;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #e64e4e;
    --danger-light: #fef2f2;
    --info: #3399cc;
    --info-light: #e0f2fe;
    
    /* Background Colors */
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    
    /* Text Colors */
    --text: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    /* Border Colors */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --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);
    --shadow-primary: 0 4px 14px rgba(230, 78, 78, 0.25);
    --shadow-primary-hover: 0 6px 20px rgba(230, 78, 78, 0.35);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Checkerboard for transparency */
    --checker-light: #f0f0f0;
    --checker-dark: #e0e0e0;
    
    /* Input */
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    
    /* Canvas */
    --canvas-bg: #374151;
    
    /* Scrollbar */
    --scrollbar-track: var(--bg);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --primary: #f87171;
    --primary-light: rgba(248, 113, 113, 0.15);
    --primary-dark: #ef4444;
    --accent: #38bdf8;
    --accent-light: rgba(56, 189, 248, 0.15);
    --secondary: #4ade80;
    --secondary-light: rgba(74, 222, 128, 0.15);
    
    /* Status Colors */
    --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);
    --info: #38bdf8;
    --info-light: rgba(56, 189, 248, 0.15);
    
    /* Background Colors */
    --bg: #0f172a;
    --bg-elevated: #1e293b;
    --bg-secondary: #334155;
    --bg-tertiary: #475569;
    
    /* Text Colors */
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    /* 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);
    --shadow-primary: 0 4px 14px rgba(248, 113, 113, 0.2);
    --shadow-primary-hover: 0 6px 20px rgba(248, 113, 113, 0.3);
    
    /* Checkerboard for transparency */
    --checker-light: #334155;
    --checker-dark: #475569;
    
    /* Input */
    --input-bg: #334155;
    --input-border: #475569;
    
    /* Canvas */
    --canvas-bg: #1e293b;
    
    /* Scrollbar */
    --scrollbar-track: var(--bg-elevated);
    --scrollbar-thumb: var(--text-muted);
    --scrollbar-thumb-hover: var(--text-secondary);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 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: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

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

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

.tool-icon-wrapper {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
}

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

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

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

/* 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);
    margin-bottom: 2rem;
    transition: background-color var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-right {
    margin-left: auto;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 0.5rem;
}

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

.toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.toolbar-btn:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text);
}

.toolbar-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

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

/* Editor Layout */
.editor-layout {
    display: flex;
    flex-direction: column;
}

/* Canvas Area */
.canvas-area {
    background: var(--canvas-bg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed);
}

.canvas-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    max-width: 100%;
}

.canvas-container {
    position: relative;
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

#thumbnailCanvas {
    display: block;
    cursor: crosshair;
    width: 900px;
    height: auto;
}

.canvas-info {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    justify-content: center;
}

.canvas-size,
.canvas-ratio {
    background: var(--bg-elevated);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

/* Controls Row (Below Canvas) */
.controls-row {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1px;
    background: var(--border);
    border-top: 1px solid var(--border);
}

.controls-row .panel-section {
    background: var(--bg-elevated);
    padding: 1.25rem 1.5rem;
    transition: background-color var(--transition-speed);
}

.controls-row .panel-settings {
    min-height: auto;
}

.controls-row .panel-layers {
    min-height: auto;
}

.controls-row .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

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

.controls-row .panel-header h3 i,
.controls-row .panel-header h3 svg {
    color: var(--primary);
    width: 18px;
    height: 18px;
}

.panel-actions {
    display: flex;
    gap: 0.25rem;
}

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

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

.panel-btn i,
.panel-btn svg {
    width: 14px;
    height: 14px;
}

/* Drag and Drop */
.canvas-wrapper.drag-over {
    outline: 3px dashed var(--primary);
    outline-offset: -3px;
}

.canvas-wrapper.drag-over::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(230, 78, 78, 0.1);
    pointer-events: none;
    z-index: 50;
}

[data-theme="dark"] .canvas-wrapper.drag-over::after {
    background: rgba(248, 113, 113, 0.15);
}

.drop-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 3rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 60;
    pointer-events: none;
}

.drop-indicator i,
.drop-indicator svg {
    width: 48px;
    height: 48px;
    color: var(--primary);
}

.drop-indicator span {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.canvas-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-elevated);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.canvas-hint i,
.canvas-hint svg {
    color: var(--primary);
}

/* Element Handles */
.element-handles {
    position: absolute;
    border: 2px solid var(--primary);
    pointer-events: none;
    z-index: 100;
}

.handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 2px;
    pointer-events: auto;
    cursor: pointer;
}

.handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.handle.n { top: -5px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.handle.s { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.handle.e { right: -5px; top: 50%; transform: translateY(-50%); cursor: e-resize; }
.handle.w { left: -5px; top: 50%; transform: translateY(-50%); cursor: w-resize; }

.rotate-handle {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: grab;
    pointer-events: auto;
}

.rotate-handle svg {
    width: 14px;
    height: 14px;
}

/* Side Panel */
/* Layers List */
.layers-list {
    max-height: 300px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
}

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

.layer-item.selected {
    background: var(--primary-light);
}

.layer-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.layer-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-visibility {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 0;
}

.layer-visibility:hover {
    background: var(--bg-tertiary);
}

.layer-visibility svg {
    width: 14px;
    height: 14px;
}

.layer-visibility[data-visible="false"] {
    opacity: 0.4;
}

/* Properties Panel */
.properties-content {
    overflow-y: visible;
}

.no-selection {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem;
}

.no-selection svg,
.no-selection i {
    width: 28px;
    height: 28px;
    opacity: 0.5;
    flex-shrink: 0;
}

.no-selection p {
    font-size: 0.9rem;
    margin: 0;
}

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

.action-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.export-options {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.export-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-select:focus {
    outline: none;
    border-color: var(--primary);
}

.quality-slider {
    width: 80px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--border);
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

#qualityValue {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 35px;
}

.quality-label {
    display: none;
}

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

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary-hover);
}

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

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s ease;
    transition: background-color var(--transition-speed);
}

.modal-content.modal-sm {
    max-width: 400px;
}

.modal-content.modal-lg {
    max-width: 700px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: border-color var(--transition-speed);
}

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

.modal-header h3 svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    padding: 0;
}

.modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

/* Color Input */
.color-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-hex {
    flex: 1;
    text-transform: uppercase;
    font-family: monospace;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Align Buttons */
.align-buttons,
.style-buttons {
    display: flex;
    gap: 0.25rem;
}

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

.align-btn svg,
.style-btn svg {
    width: 16px;
    height: 16px;
}

.align-btn:hover,
.style-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.align-btn.active,
.style-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Outline & Shadow Options */
.outline-options,
.shadow-options {
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-top: 0.75rem;
    transition: background-color var(--transition-speed);
}

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

.shape-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.shape-option svg {
    width: 28px;
    height: 28px;
    color: var(--text-secondary);
}

.shape-option span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.shape-option:hover {
    border-color: var(--primary);
}

.shape-option.selected {
    background: var(--primary-light);
    border-color: var(--primary);
}

.shape-option.selected svg {
    color: var(--primary);
}

/* Color Presets */
.color-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.color-preset {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-preset:hover {
    transform: scale(1.1);
}

.color-preset.selected {
    box-shadow: 0 0 0 3px var(--primary);
}

/* Gradient Presets */
.gradient-section {
    margin-bottom: 1.5rem;
}

.gradient-section label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.gradient-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.gradient-preset {
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gradient-preset:hover {
    border-color: var(--primary);
}

.gradient-preset[data-gradient="linear-gradient(135deg, #667eea 0%, #764ba2 100%)"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.gradient-preset[data-gradient="linear-gradient(135deg, #f093fb 0%, #f5576c 100%)"] {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
.gradient-preset[data-gradient="linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)"] {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}
.gradient-preset[data-gradient="linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)"] {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}
.gradient-preset[data-gradient="linear-gradient(135deg, #fa709a 0%, #fee140 100%)"] {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}
.gradient-preset[data-gradient="linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)"] {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

/* Template Modal */
.template-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.template-cat {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-cat:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.template-cat.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.template-item {
    aspect-ratio: 16/9;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

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

.template-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-item canvas {
    width: 100%;
    height: 100%;
}

.template-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.75rem;
    text-align: center;
}

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

.related-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
}

.related-label svg {
    color: var(--primary);
    width: 16px;
    height: 16px;
}

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

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    text-decoration: none;
    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 {
    width: 16px;
    height: 16px;
}

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

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

.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 {
    color: var(--primary);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

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

.steps-list li {
    position: relative;
    padding-left: 3.25rem;
    margin-bottom: 1rem;
    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: 600;
    font-size: 0.875rem;
    z-index: 1;
}

.steps-list li:last-child {
    margin-bottom: 0;
}

.steps-list li a {
    color: var(--primary);
    text-decoration: none;
}

.steps-list li a:hover {
    text-decoration: underline;
}

/* Tips Grid */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.tip-item {
    display: flex;
    gap: 1rem;
}

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

.tip-icon svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

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

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

.tip-content a {
    color: var(--primary);
    text-decoration: none;
}

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

/* Specs Table */
.specs-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-speed);
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: border-color var(--transition-speed);
}

.spec-row:last-child {
    border-bottom: none;
}

.spec-row:nth-child(odd) {
    background: var(--bg-secondary);
}

.spec-label {
    font-weight: 600;
    color: var(--text);
}

.spec-value {
    color: var(--text-secondary);
}

.spec-value a {
    color: var(--primary);
    text-decoration: none;
}

.spec-value a:hover {
    text-decoration: underline;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    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%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    transition: all 0.2s ease;
}

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

.faq-question svg {
    flex-shrink: 0;
    color: var(--primary);
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

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

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

.faq-item.active .faq-answer {
    max-height: 300px;
}

.faq-answer p {
    padding: 1rem 1.25rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

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

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

/* Responsive */
@media (max-width: 1000px) {
    #thumbnailCanvas {
        width: 100%;
        max-width: 700px;
    }
}

@media (max-width: 900px) {
    .controls-row {
        grid-template-columns: 1fr;
    }
    
    .controls-row .panel-section {
        min-height: auto;
    }
    
    .layers-list {
        max-height: 150px;
    }
}

@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .tool-title-row {
        gap: 0.75rem;
    }
    
    .tool-icon-wrapper {
        width: 48px;
        height: 48px;
    }
    
    .tool-icon-wrapper svg {
        width: 22px;
        height: 22px;
    }
    
    .editor-toolbar {
        padding: 0.5rem;
    }
    
    .toolbar-divider {
        display: none;
    }
    
    .toolbar-right {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
        margin-left: 0;
    }
    
    #thumbnailCanvas {
        width: 100%;
        max-width: 500px;
    }
    
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-right {
        flex-direction: column;
    }
    
    .export-options {
        justify-content: center;
    }
    
    .quality-label {
        display: inline;
    }
    
    .btn {
        width: 100%;
    }
    
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .related-tools {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .info-card {
        padding: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tool-title-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .shape-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tip-item {
        flex-direction: column;
    }
    
    .tip-icon {
        width: 40px;
        height: 40px;
    }
}

/* 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(230, 78, 78, 0.2);
    color: var(--text);
}

[data-theme="dark"] ::selection {
    background: rgba(248, 113, 113, 0.3);
}

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

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