/* =============================================
   SPRITE TO GIF CONVERTER - CSS
   ============================================= */

:root {
    /* Primary Colors */
    --primary: #e64e4e;
    --primary-hover: #d43f3f;
    --primary-light: rgba(230, 78, 78, 0.1);
    
    /* Secondary Colors */
    --secondary: #3399cc;
    --secondary-hover: #2a7da8;
    
    /* Accent Colors */
    --accent: #339966;
    --accent-light: rgba(51, 153, 102, 0.1);
    
    /* Backgrounds */
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-elevated: #ffffff;
    
    /* Text */
    --text: #1a1a2e;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    
    /* Borders */
    --border: #e9ecef;
    --border-hover: #dee2e6;
    
    /* Status */
    --success: #339966;
    --success-light: rgba(51, 153, 102, 0.1);
    --error: #dc3545;
    --error-light: rgba(220, 53, 69, 0.1);
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.15);
    
    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    
    /* Checker pattern for transparency */
    --checker-light: #e9ecef;
    --checker-dark: #dee2e6;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg: #1a1a2e;
    --bg-secondary: #252540;
    --bg-elevated: #2d2d4a;
    
    --text: #f8f9fa;
    --text-secondary: #adb5bd;
    --text-muted: #6c757d;
    
    --border: #3d3d5c;
    --border-hover: #4d4d6a;
    
    --primary-light: rgba(230, 78, 78, 0.15);
    --success-light: rgba(51, 153, 102, 0.15);
    --error-light: rgba(220, 53, 69, 0.15);
    --accent-light: rgba(51, 153, 102, 0.15);
    
    --checker-light: #2d2d4a;
    --checker-dark: #252540;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.4);
}

/* =============================================
   TOOL HERO
   ============================================= */
.tool-hero {
    text-align: center;
    padding: 2rem 0 2.5rem;
}

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

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

.tool-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

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

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

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

/* =============================================
   TOOL CARD
   ============================================= */
.tool-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
    margin-bottom: 2.5rem;
}

/* =============================================
   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 var(--transition-normal);
    background: var(--bg-secondary);
}

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

.upload-icon {
    color: var(--primary);
    margin-bottom: 1rem;
}

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

.upload-area p {
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.upload-hint {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
}

/* =============================================
   EDITOR SECTION
   ============================================= */
.editor-section {
    padding: 1.5rem;
}

/* File Info Bar */
.file-info-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.file-name {
    font-weight: 600;
    color: var(--text);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size,
.image-dimensions {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}

.change-file-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.change-file-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* Preview Container */
.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .preview-container {
        grid-template-columns: 1fr;
    }
}

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

.preview-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.preview-header i {
    color: var(--primary);
}

.preview-content {
    position: relative;
    min-height: 200px;
    max-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background-image: 
        linear-gradient(45deg, var(--checker-light) 25%, transparent 25%),
        linear-gradient(-45deg, var(--checker-light) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--checker-light) 75%),
        linear-gradient(-45deg, transparent 75%, var(--checker-light) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.preview-content canvas {
    max-width: 100%;
    max-height: 340px;
    object-fit: contain;
}

#spritePreview {
    position: relative;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.preview-placeholder span {
    font-size: 0.9rem;
}

/* =============================================
   SETTINGS GRID
   ============================================= */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

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

.settings-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.settings-card-header i {
    color: var(--primary);
}

.settings-card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.settings-card-body {
    padding: 1rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-group.full-width {
    grid-column: span 2;
}

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

.input-group input,
.input-group select {
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast);
}

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

.frame-size-display,
.total-frames-display {
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    text-align: center;
}

/* Speed Presets */
.speed-presets {
    grid-column: span 2;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.speed-btn {
    flex: 1;
    min-width: 70px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.speed-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* Checkbox Group */
.checkbox-group {
    grid-column: span 2;
    margin-top: 0.25rem;
}

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

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-label input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* =============================================
   ACTION BAR
   ============================================= */
.action-bar {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding-top: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

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

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

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

/* =============================================
   RESULTS SECTION
   ============================================= */
.results-section {
    padding: 3rem;
    text-align: center;
}

.results-header {
    margin-bottom: 2rem;
}

.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--success-light);
    border-radius: 50%;
    color: var(--success);
    margin-bottom: 1rem;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.results-header p {
    color: var(--text-secondary);
    margin: 0;
}

.result-preview {
    max-width: 400px;
    margin: 0 auto 1.5rem;
    padding: 1rem;
    background-image: 
        linear-gradient(45deg, var(--checker-light) 25%, transparent 25%),
        linear-gradient(-45deg, var(--checker-light) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--checker-light) 75%),
        linear-gradient(-45deg, transparent 75%, var(--checker-light) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border-radius: var(--radius-md);
}

.result-preview img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    margin: 0 auto;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

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

.stat-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* =============================================
   PROCESSING OVERLAY
   ============================================= */
.processing-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
    border-radius: var(--radius-xl);
}

.processing-content {
    background: var(--bg-elevated);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 350px;
    width: 90%;
}

.processing-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

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

.processing-subtext {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1.25rem;
}

.progress-bar-container {
    height: 8px;
    background: var(--bg-secondary);
    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.2s ease;
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

/* =============================================
   ERROR DISPLAY
   ============================================= */
.error-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--error-light);
    color: var(--error);
    border-radius: var(--radius-md);
    margin: 1rem 1.5rem;
    font-size: 0.95rem;
}

.error-display a {
    color: var(--error);
    text-decoration: underline;
}

/* =============================================
   INFO SECTION
   ============================================= */
.info-section {
    margin-bottom: 2.5rem;
}

.info-content {
    margin-bottom: 2rem;
}

.info-content h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 1.25rem;
}

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

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

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

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

/* Steps List */
.steps-list {
    display: grid;
    gap: 1.25rem;
}

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

.step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

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

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

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

@media (max-width: 768px) {
    .use-cases-grid {
        grid-template-columns: 1fr;
    }
}

.use-case {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

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

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

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

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

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

/* =============================================
   FAQ SECTION
   ============================================= */
.faq-section {
    margin-bottom: 2.5rem;
}

.faq-section h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 1.25rem;
}

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

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

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

.faq-question:hover {
    color: var(--primary);
}

.faq-question i {
    flex-shrink: 0;
    transition: transform var(--transition-normal);
    color: var(--text-secondary);
}

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

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

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

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

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

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

/* =============================================
   RELATED TOOLS
   ============================================= */
.related-tools {
    margin-bottom: 2rem;
}

.related-tools h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 1.25rem;
}

.tools-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

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

.tool-link i,
.tool-link svg {
    flex-shrink: 0;
    color: var(--primary);
    width: 18px;
    height: 18px;
}

.tool-link span {
    line-height: 1.2;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
    .tool-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .tool-title {
        font-size: 1.5rem;
    }
    
    .tool-description {
        font-size: 0.95rem;
    }
    
    .upload-section,
    .results-section {
        padding: 1.5rem;
    }
    
    .editor-section {
        padding: 1rem;
    }
    
    .settings-card-body {
        grid-template-columns: 1fr;
    }
    
    .input-group.full-width,
    .speed-presets,
    .checkbox-group {
        grid-column: span 1;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .result-stats {
        gap: 1rem;
    }
    
    .stat-item {
        flex: 1;
        min-width: 80px;
    }
    
    .tools-grid {
        justify-content: center;
    }
}
