/* Image Convert Specific Styles */

.image-convert-tool {
    margin-bottom: 40px;
}

.convert-card {
    background: var(--bg-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.convert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: left var(--transition-normal);
}

.convert-card:hover::before {
    left: 0;
}

.convert-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.convert-header {
    padding: 32px 24px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
}

.convert-icon {
    font-size: 48px;
    margin-bottom: 16px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.convert-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.convert-header p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.convert-body {
    padding: 24px;
}

.upload-area {
    border: 3px dashed var(--border-medium);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-secondary);
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(245, 57, 57, 0.05), transparent);
    transition: left var(--transition-slow);
}

.upload-area:hover::before {
    left: 100%;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(245, 57, 57, 0.02);
    transform: scale(1.02);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(245, 57, 57, 0.05);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.upload-area p {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 16px;
}

.file-types {
    color: var(--text-secondary);
    font-size: 14px;
    background: var(--bg-primary);
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 8px;
}

.preview-area {
    margin: 20px 0;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.preview-content {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.image-preview {
    flex: 1;
    text-align: center;
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 12px;
    border: 1px solid var(--border-light);
    min-width: 0;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 4px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: var(--bg-secondary);
}

.image-info {
    flex: 0 0 200px;
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 12px;
    border: 1px solid var(--border-light);
    min-width: 0;
}

/* Accessibility improvements */
.image-preview img[alt] {
    border: 2px solid transparent;
}

.image-preview img[alt]:focus {
    border-color: var(--primary-color);
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .image-preview {
        border: 3px solid var(--text-primary);
    }
    
    .image-preview img {
        border: 2px solid var(--text-primary);
    }
}

.image-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.info-item {
    background: var(--bg-primary);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    text-align: center;
}

.info-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 2px;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 700;
}

.convert-options {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin: 16px 0;
    border: 1px solid var(--border-light);
    position: relative;
    z-index: 10;
}

.option-group {
    margin-bottom: 20px;
}

.option-group:last-child {
    margin-bottom: 16px;
}

.option-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.format-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    transition: all var(--transition-normal);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    z-index: 20;
}

.format-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(245, 57, 57, 0.1);
}

.quality-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.quality-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    justify-content: center;
}

.preset-quality-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-light);
    background: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 80px;
    text-align: center;
}

.preset-quality-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 57, 57, 0.3);
}

.preset-quality-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(245, 57, 57, 0.2);
}

.convert-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}

.convert-btn {
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    min-width: 200px;
}

.quality-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-fast);
}

.quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.quality-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-fast);
}

.quality-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    position: relative;
}

.checkbox-label input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    cursor: pointer;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: var(--bg-primary);
    border: 2px solid var(--border-light);
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-color);
}

.progress-area {
    text-align: center;
    padding: 32px 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
}

.result-area {
    text-align: center;
    padding: 24px 20px;
}

.result-preview {
    margin-bottom: 24px;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.result-preview img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
    object-fit: contain;
    display: block;
    margin-left: auto;
    margin-right: auto;
    transition: all var(--transition-normal);
    background: var(--bg-secondary);
    cursor: pointer;
}

.result-preview img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.result-preview img:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 4px;
}

.result-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.result-actions .btn {
    min-width: 120px;
}

.error-area {
    text-align: center;
    padding: 32px 20px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    margin: 16px 0;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--danger-color);
}

.error-message {
    color: var(--danger-color);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 24px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--text-white);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn.processing {
    position: relative;
    overflow: hidden;
}

.btn.processing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: button-shimmer 1.5s infinite;
}

@keyframes button-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@media (max-width: 768px) {
    .convert-card {
        margin: 0 16px;
    }
    
    .convert-header {
        padding: 24px 20px 16px;
    }
    
    .convert-icon {
        font-size: 40px;
        height: 60px;
    }
    
    .convert-header h3 {
        font-size: 20px;
    }
    
    .convert-body {
        padding: 20px;
    }
    
    .upload-area {
        padding: 32px 16px;
    }
    
    .upload-icon {
        font-size: 28px;
    }
    
    .upload-area p {
        font-size: 14px;
    }
    
    .image-info {
        grid-template-columns: 1fr;
    }
    
    .result-info {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .result-actions .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .preview-area {
        padding: 12px;
        margin: 16px 0;
    }
    
    .preview-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .image-info {
        flex: none;
        width: 100%;
    }
    
    .image-preview img {
        max-height: 250px;
    }
}

@media (max-width: 600px) {
    .preview-area {
        padding: 8px;
        margin: 12px 0;
    }
    
    .preview-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .image-info {
        flex: none;
        width: 100%;
    }
    
    .image-preview img {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .convert-header {
        padding: 20px 16px 12px;
    }
    
    .convert-icon {
        font-size: 32px;
        height: 50px;
    }
    
    .convert-header h3 {
        font-size: 18px;
    }
    
    .convert-header p {
        font-size: 13px;
    }
    
    .convert-body {
        padding: 16px;
    }
    
    .upload-area {
        padding: 24px 12px;
    }
    
    .upload-area p {
        font-size: 13px;
    }
    
    .file-types {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .preview-area {
        padding: 6px;
        margin: 8px 0;
    }
    
    .preview-content {
        flex-direction: column;
        gap: 8px;
    }
    
    .image-info {
        flex: none;
        width: 100%;
    }
    
    .image-preview img {
        max-height: 150px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .progress-fill::after,
    .btn.processing::after {
        animation: none;
    }
}

