/* JPG to WebP Specific Styles */

/* Radio Button Styling */
.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    position: relative;
}

.radio-option:hover {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    border: 2px solid var(--card-border);
    border-radius: 50%;
    background: var(--card-bg);
    cursor: pointer;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked {
    border-color: #2196F3;
    background: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.radio-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.radio-option input[type="radio"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
    box-shadow: 0 2px 12px rgba(33, 150, 243, 0.2);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    flex: 1;
}

.radio-label i {
    color: #2196F3;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.radio-option:has(input[type="radio"]:checked) .radio-label {
    color: #2196F3;
    font-weight: 600;
}

/* WebP Quality Preview */
.quality-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(33, 150, 243, 0.05);
    border-radius: 6px;
    border-left: 3px solid #2196F3;
}

.quality-icon {
    width: 30px;
    height: 30px;
    border: 2px solid #2196F3;
    border-radius: 4px;
    position: relative;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #2196F3;
    font-weight: 600;
}

.quality-info {
    flex: 1;
}

.quality-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2px;
}

.quality-desc {
    font-size: 12px;
    color: var(--tool-description-color);
}

/* Background Color Picker */
.background-color-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.color-option:hover {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.05);
}

.color-option.selected {
    border-color: #2196F3;
    background: rgba(33, 150, 243, 0.1);
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--card-border);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.color-swatch.transparent {
    background: linear-gradient(45deg, #ccc 25%, transparent 25%),
                linear-gradient(-45deg, #ccc 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #ccc 75%),
                linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}

.color-option.selected .color-swatch {
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.3);
}

.color-label {
    font-size: 11px;
    color: var(--text-color);
    font-weight: 500;
    text-align: center;
}

.custom-color-section {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px dashed var(--card-border);
    border-radius: 8px;
    margin-top: 8px;
}

.custom-color-input {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--card-border);
}

.custom-color-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-color);
    font-weight: 500;
}

/* WebP Preview Modal */
.webp-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.webp-preview-modal.active {
    display: flex;
}

.webp-preview-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.webp-preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(33, 150, 243, 0.02) 100%);
}

.webp-preview-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.webp-preview-modal-title i {
    color: #2196F3;
    font-size: 22px;
}

.webp-preview-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--tool-description-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.webp-preview-modal-close:hover {
    background: var(--card-border);
    color: var(--text-color);
    transform: scale(1.1);
}

.webp-preview-modal-body {
    flex: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.webp-preview-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(33, 150, 243, 0.05);
    border-radius: 8px;
    border-left: 4px solid #2196F3;
}

.webp-preview-info span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.webp-preview-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webp-nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 36px;
}

.webp-nav-btn:hover:not(:disabled) {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
    transform: translateY(-1px);
}

.webp-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.webp-preview-canvas-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    overflow: auto;
    min-height: 400px;
    max-height: 600px;
    border: 2px dashed var(--card-border);
}

.webp-preview-canvas-container canvas {
    max-width: 100%;
    height: auto !important;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    background: white;
    display: block;
}

.webp-preview-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-top: 1px solid var(--card-border);
    background: var(--background-color);
    gap: 15px;
}

.webp-preview-modal-footer button {
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.webp-preview-modal-footer .primary-btn {
    background: #2196F3;
    color: white;
    flex: 1;
}

.webp-preview-modal-footer .primary-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.webp-preview-modal-footer .secondary-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-color);
}

.webp-preview-modal-footer .secondary-btn:hover {
    background: var(--card-border);
    transform: translateY(-1px);
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--card-border);
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* WebP Quality Indicator */
.webp-quality-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.quality-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
}

.quality-dot.active {
    background: #2196F3;
}

.quality-label {
    font-size: 11px;
    color: var(--tool-description-color);
    margin-left: 5px;
}

/* File Size Comparison */
.size-comparison {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(33, 150, 243, 0.05);
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid rgba(33, 150, 243, 0.2);
}

.size-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.size-label {
    font-size: 12px;
    color: var(--tool-description-color);
    font-weight: 500;
}

.size-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

.size-arrow {
    color: #2196F3;
    font-size: 16px;
    font-weight: bold;
}

/* Compression Ratio Display */
.compression-ratio {
    text-align: center;
    padding: 8px 12px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 6px;
    margin-top: 8px;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.compression-ratio .ratio-text {
    font-size: 12px;
    color: #2196F3;
    font-weight: 600;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .webp-preview-modal-content {
        width: 95vw;
        max-height: 95vh;
        margin: 20px;
    }

    .webp-preview-modal-header,
    .webp-preview-modal-body,
    .webp-preview-modal-footer {
        padding: 15px 20px;
    }

    .webp-preview-modal-title {
        font-size: 18px;
    }

    .webp-preview-canvas-container {
        min-height: 300px;
        padding: 15px;
    }

    .webp-preview-modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    .webp-preview-modal-footer button {
        width: 100%;
        justify-content: center;
    }

    .color-options {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 6px;
    }

    .color-swatch {
        width: 30px;
        height: 30px;
    }

    .custom-color-input {
        width: 30px;
        height: 30px;
    }

    .size-comparison {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .size-arrow {
        transform: rotate(90deg);
    }
}

@media (max-width: 480px) {
    .webp-preview-modal-content {
        width: 98vw;
        margin: 10px;
    }

    .webp-preview-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .webp-preview-controls {
        justify-content: center;
    }

    .color-options {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 4px;
    }

    .color-swatch {
        width: 25px;
        height: 25px;
    }

    .custom-color-section {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .custom-color-input {
        width: 25px;
        height: 25px;
    }
}