/* ============================================
   JXL to JPG Converter - Dark Mode Compatible
   Uses CSS variables from custom_styles.css
   ============================================ */

/* Tool Container */
.tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 15px 40px;
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

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

.tool-icon-wrapper {
    width: 56px;
    height: 56px;
    background: #e67e22;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

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

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

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

/* Upload Section */
.upload-section {
    margin-bottom: 25px;
}

.upload-area {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(230, 126, 34, 0.03);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover {
    border-color: #e67e22;
    box-shadow: 0 8px 25px rgba(230, 126, 34, 0.15);
}

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

.upload-area.dragover {
    border-color: #e67e22;
    background: var(--card-secondary);
    transform: scale(1.01);
}

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

.upload-icon {
    color: #e67e22;
    margin-bottom: 20px;
}

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

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

.upload-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-light);
    background: var(--card-secondary);
    padding: 8px 16px;
    border-radius: 20px;
}

/* Editor Section */
.editor-section {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Files Header */
.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--card-secondary);
    border-bottom: 1px solid var(--border-color);
}

.files-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.files-header-left svg {
    color: #e67e22;
}

.file-size-badge {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--card-tertiary);
    padding: 4px 10px;
    border-radius: 12px;
}

.btn-text {
    background: none;
    border: none;
    color: #e67e22;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-text:hover {
    background: rgba(230, 126, 34, 0.1);
}

/* Settings Panel */
.settings-panel {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.panel-header {
    margin-bottom: 20px;
}

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

.panel-header h3 svg {
    color: #e67e22;
}

/* Quality Section */
.quality-section {
    margin-bottom: 20px;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.section-label svg {
    color: #e67e22;
}

.quality-slider-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-input {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(to right, #2ecc71, #f1c40f, #e74c3c);
    border-radius: 4px;
    outline: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e67e22;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.4);
    transition: transform 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e67e22;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(230, 126, 34, 0.4);
}

.quality-value-display {
    min-width: 60px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #e67e22;
    background: rgba(230, 126, 34, 0.1);
    padding: 6px 12px;
    border-radius: 8px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 8px;
}

.quality-presets {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

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

.preset-btn {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    border-color: #e67e22;
    color: #e67e22;
}

.preset-btn.active {
    background: #e67e22;
    border-color: #e67e22;
    color: white;
}

/* Quality Info */
.quality-info {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: rgba(230, 126, 34, 0.08);
    border-radius: 10px;
    margin-top: 15px;
}

[data-theme="dark"] .quality-info {
    background: rgba(230, 126, 34, 0.15);
}

.quality-info .info-icon {
    color: #e67e22;
    flex-shrink: 0;
}

.quality-info .info-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--card-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: #e67e22;
    color: white;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
}

.btn-primary:hover {
    background: #d35400;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.4);
}

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

.btn-secondary:hover {
    background: var(--card-secondary);
    color: var(--text-primary);
}

.btn-success {
    background: #2ecc71;
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-success:hover {
    background: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 30px;
    text-align: center;
}

.results-header {
    margin-bottom: 30px;
}

.results-icon {
    width: 70px;
    height: 70px;
    background: #2ecc71;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.results-icon.error {
    background: #e74c3c;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.results-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
}

.results-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: 0;
}

/* Comparison Section */
.comparison-container {
    margin-bottom: 25px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

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

.comparison-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding: 4px 12px;
    background: var(--card-secondary);
    border-radius: 15px;
}

.comparison-item.result .comparison-label {
    background: rgba(230, 126, 34, 0.1);
    color: #e67e22;
}

.comparison-preview {
    width: 160px;
    height: 120px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    background: 
        linear-gradient(45deg, var(--card-secondary) 25%, transparent 25%),
        linear-gradient(-45deg, var(--card-secondary) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--card-secondary) 75%),
        linear-gradient(-45deg, transparent 75%, var(--card-secondary) 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.comparison-stats {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.comparison-arrow {
    color: var(--text-light);
}

.comparison-arrow svg {
    width: 24px;
    height: 24px;
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: var(--card-secondary);
    border-radius: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

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

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

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

.stat-value.highlight {
    color: #2ecc71;
}

.stat-value.primary {
    color: #e67e22;
}

/* Results Actions */
.results-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Error Message */
.error-message {
    background: var(--error-bg);
    color: var(--error-color);
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
    font-weight: 500;
}

/* Related Tools */
.related-tools {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

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

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--card-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-link:hover {
    background: #e67e22;
    color: white;
}

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

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

.info-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 25px 30px;
    box-shadow: var(--shadow-sm);
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 20px;
}

.info-card h2 svg {
    color: #e67e22;
}

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

.steps-list li {
    position: relative;
    padding-left: 50px;
    margin-bottom: 18px;
    line-height: 1.6;
    color: var(--text-secondary);
    counter-increment: step;
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 32px;
    height: 32px;
    background: #e67e22;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

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

/* Format Explanations */
.format-explanations {
    display: grid;
    gap: 15px;
}

.format-explain {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--card-secondary);
    border-radius: 10px;
}

.format-tag {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    height: fit-content;
}

.format-tag.jxl {
    background: rgba(230, 126, 34, 0.15);
    color: #e67e22;
}

.format-tag.jpg {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

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

/* FAQ Section */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    background: var(--card-secondary);
    border-radius: 10px;
    overflow: hidden;
}

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

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

.faq-question svg {
    color: #e67e22;
    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 20px 20px;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-answer a {
    color: #e67e22;
    text-decoration: none;
}

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

/* Processing Overlay */
.processing-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.processing-content {
    background: var(--card-bg);
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
}

.processing-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: #e67e22;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 25px;
}

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

.processing-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
}

.processing-subtitle {
    color: var(--text-muted);
    margin: 0 0 25px;
}

.progress-bar {
    height: 8px;
    background: var(--card-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #e67e22;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-weight: 600;
    color: #e67e22;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .tool-container {
        padding: 15px 10px 30px;
    }
    
    .tool-title {
        font-size: 1.6rem;
    }
    
    .tool-description {
        font-size: 1rem;
    }
    
    .upload-area {
        padding: 35px 20px;
    }
    
    .upload-title {
        font-size: 1.2rem;
    }
    
    .files-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .action-bar {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .comparison-arrow {
        transform: rotate(90deg);
    }
    
    .stats-row {
        gap: 20px;
    }
    
    .related-tools {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .related-links {
        width: 100%;
    }
    
    .related-link {
        flex: 1;
        min-width: calc(50% - 5px);
        justify-content: center;
    }
    
    .info-card {
        padding: 20px;
    }
    
    .info-card h2 {
        font-size: 1.15rem;
    }
    
    .format-explain {
        flex-direction: column;
        gap: 10px;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .results-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .tool-title-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .quality-presets {
        justify-content: center;
    }
    
    .preset-label {
        width: 100%;
        text-align: center;
    }
    
    .steps-list li {
        padding-left: 42px;
    }
    
    .steps-list li::before {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion) {
    .processing-spinner {
        animation: none;
    }
    
    .upload-area::before,
    .btn,
    .related-link,
    .faq-question svg {
        transition: none;
    }
}
