/* Modern Gradient Design */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --danger-gradient: linear-gradient(135deg, #f83600 0%, #f9d423 100%);
    --dark-gradient: linear-gradient(135deg, #2c3e50 0%, #4ca1af 100%);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-light: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.jpg2webp-public-converter {
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--glass-border);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    overflow: hidden;
}

.jpg2webp-public-converter::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--primary-gradient);
    border-radius: 25px 25px 0 0;
}

.converter-header {
    text-align: center;
    margin-bottom: 40px;
}

.converter-header h2 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 15px 0;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.converter-header p {
    color: #64748b;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Upload Zone */
.upload-zone {
    border: 3px dashed rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    padding: 60px 30px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: transparent;
    transform: translateY(-5px);
    box-shadow: var(--shadow-light);
}

.upload-zone:hover::before,
.upload-zone.dragover::before {
    opacity: 0.1;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 20px;
    width: 80px;
    height: 80px;
    animation: float 3s ease-in-out infinite;
}

.upload-content h3 {
    margin: 0 0 10px;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 700;
}

.upload-content p {
    color: #64748b;
    margin: 0 0 20px;
    font-size: 1.1rem;
}

.upload-limits {
    font-size: 0.95rem;
    color: #94a3b8 !important;
    margin-bottom: 30px !important;
}

.upload-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.upload-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.upload-btn:hover::before {
    left: 100%;
}

.upload-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.3);
}

/* File Preview */
.file-preview {
    margin-top: 30px;
}

.preview-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    margin-bottom: 15px;
    border-left: 6px solid;
    border-image: var(--primary-gradient) 1;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    animation: slideIn 0.4s ease-out;
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.preview-item:hover {
    transform: translateX(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.preview-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    color: white;
}

.preview-icon svg {
    width: 30px;
    height: 30px;
}

.preview-info {
    flex: 1;
}

.preview-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1rem;
    word-break: break-word;
}

.preview-size {
    font-size: 0.95rem;
    color: #64748b;
}

.preview-remove {
    background: var(--danger-gradient);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preview-remove:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 8px 20px rgba(248, 54, 0, 0.3);
}

/* Settings Section */
.settings-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 30px;
    border-radius: 20px;
    margin: 30px 0;
    backdrop-filter: blur(10px);
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.1rem;
}

#publicQualityValue {
    font-weight: 800;
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 10px;
    -webkit-appearance: none;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 5px;
    outline: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    background: var(--primary-gradient);
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid white;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.setting-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

.action-buttons {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.convert-btn,
.clear-btn {
    flex: 1;
    padding: 20px;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.convert-btn::before,
.clear-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
    z-index: -1;
}

.convert-btn:hover::before,
.clear-btn:hover::before {
    left: 100%;
}

.convert-btn {
    background: var(--success-gradient);
    color: white;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(79, 172, 254, 0.3);
}

.convert-btn:disabled {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.clear-btn {
    background: var(--danger-gradient);
    color: white;
}

.clear-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(248, 54, 0, 0.3);
}

/* Progress Section */
.progress-section {
    margin: 30px 0;
}

.progress-container {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 25px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.progress-bar {
    height: 14px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--success-gradient);
    width: 0%;
    border-radius: 7px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    color: #64748b;
    font-size: 1rem;
    font-weight: 600;
}

/* Results Section */
.results-section {
    margin-top: 40px;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 25px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    margin-bottom: 20px;
    border-left: 8px solid;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    animation: fadeInUp 0.5s ease-out;
    transition: all 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item:hover {
    transform: translateX(10px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

.result-success {
    border-left-color: #10b981;
}

.result-error {
    border-left-color: #ef4444;
}

.result-icon {
    font-size: 32px;
    margin-right: 20px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-success .result-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    color: #10b981;
}

.result-error .result-icon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(245, 158, 11, 0.2) 100%);
    color: #ef4444;
}

.result-content {
    flex: 1;
}

.result-title {
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.result-details {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.6;
}

.result-actions {
    display: flex;
    gap: 15px;
}

.download-btn,
.view-btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.download-btn {
    background: var(--primary-gradient);
    color: white;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.view-btn {
    background: var(--secondary-gradient);
    color: white;
}

.view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(245, 87, 108, 0.3);
}

/* Footer */
.converter-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(203, 213, 225, 0.3);
    text-align: center;
}

.help-text {
    color: #64748b;
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
}

.help-text small {
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .jpg2webp-public-converter {
        padding: 25px;
        margin: 20px auto;
    }
    
    .converter-header h2 {
        font-size: 2rem;
    }
    
    .upload-zone {
        padding: 40px 20px;
    }
    
    .upload-content svg {
        width: 60px;
        height: 60px;
    }
    
    .upload-content h3 {
        font-size: 1.5rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .result-item {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .result-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .result-actions {
        margin-top: 20px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .preview-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 25px;
    }
    
    .preview-icon {
        margin-right: 0;
    }
}

/* Floating Animation */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Shimmer Animation */
@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Pulse Animation for Convert Button */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(79, 172, 254, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(79, 172, 254, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(79, 172, 254, 0);
    }
}

.convert-btn:not(:disabled) {
    animation: pulse 2s infinite;
}