/* Universal Image Converter Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: #ffd700;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-top: 10px;
}

/* Main Content */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.tab-btn {
    padding: 12px 25px;
    background: none;
    border: none;
    color: #999;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-btn i {
    font-size: 1.1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Upload Section */
.upload-section,
.batch-section {
    margin-bottom: 30px;
}

.file-input-container,
.batch-upload {
    position: relative;
    margin-bottom: 30px;
}

.file-input-label,
.batch-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    border: 3px dashed #ddd;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.file-input-label:hover,
.batch-upload-label:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.file-input-label.drag-over,
.batch-upload-label.drag-over {
    border-color: #667eea;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.file-text {
    font-size: 1.1rem;
    color: #666;
    font-weight: 500;
}

.file-hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 5px;
}

#imageFile,
#batchFiles,
#heicFile {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* Preview Section */
.preview-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
}

.preview-container {
    display: flex;
    gap: 20px;
    align-items: center;
}

#previewImage {
    max-width: 150px;
    max-height: 150px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.preview-info {
    flex: 1;
}

.preview-info p {
    margin: 5px 0;
    font-size: 0.95rem;
}

.preview-info p:first-child {
    font-weight: 600;
    color: #333;
}

.preview-info p:not(:first-child) {
    color: #666;
    font-size: 0.9rem;
}

/* Options Section */
.options-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

select,
input[type="number"] {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

select:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Quality Control */
.quality-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    border: none;
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.quality-value {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: #667eea;
}

/* Resize Options */
.resize-options {
    grid-column: 1 / -1;
}

.resize-toggle {
    width: 100%;
    padding: 12px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.resize-toggle:hover {
    background: #e8ebff;
    border-color: #667eea;
}

.resize-toggle.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.resize-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    border: 1px solid #e9ecef;
}

.resize-group {
    margin-bottom: 10px;
}

.resize-group label {
    margin-bottom: 5px;
}

.resize-group input {
    width: 100%;
}

.resize-panel small {
    display: block;
    color: #999;
    font-size: 0.85rem;
    text-align: center;
}

/* Buttons */
.convert-btn,
.batch-reset-btn {
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.convert-btn:hover:not(:disabled),
.batch-reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.convert-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Progress Section */
.progress-section {
    text-align: center;
    margin: 30px 0;
}

.progress-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.progress-text {
    color: #666;
    font-weight: 500;
    font-size: 1.1rem;
}

/* Batch Progress */
.batch-progress {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
    color: #333;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

/* Batch Files List */
.batch-files-list {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.files-header {
    margin-bottom: 15px;
    font-weight: 600;
    color: #333;
}

.files-container {
    list-style: none;
    padding: 0;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-item i {
    color: #667eea;
    font-size: 1.2rem;
}

.file-item span:first-of-type {
    flex: 1;
    font-weight: 500;
    color: #333;
    word-break: break-all;
}

.file-info {
    color: #999;
    font-size: 0.9rem;
    min-width: 60px;
    text-align: right;
}

.remove-file-btn {
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.remove-file-btn:hover {
    background: #c82333;
}

/* Batch Options */
.batch-options {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Result Section */
.result-section {
    margin: 30px 0;
}

.result-card {
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.result-card.success {
    background: linear-gradient(135deg, #f0fff0 0%, #f0f2ff 100%);
    border: 2px solid #28a745;
}

.result-card.error {
    background: linear-gradient(135deg, #fff0f0 0%, #fff5f5 100%);
    border: 2px solid #dc3545;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.result-header.error-header {
    color: #dc3545;
}

.result-header:not(.error-header) {
    color: #28a745;
}

.result-header i {
    font-size: 2rem;
}

.result-header h3 {
    font-size: 1.5rem;
    margin: 0;
}

.result-details {
    margin-bottom: 25px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: #333;
}

.detail-value {
    color: #666;
    font-family: 'Courier New', monospace;
    text-align: right;
}

.result-actions {
    display: flex;
    gap: 15px;
}

.download-btn,
.convert-another-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn {
    background: #28a745;
    color: white;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.convert-another-btn {
    background: #6c757d;
    color: white;
}

.convert-another-btn:hover {
    background: #545b62;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

/* Error Message */
.error-message {
    color: #666;
    margin-bottom: 20px;
}

.retry-btn {
    padding: 12px 25px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.retry-btn:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

/* Batch Results */
.batch-results {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
}

.batch-results h3 {
    margin-bottom: 15px;
    color: #333;
}

.batch-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.summary-stat {
    flex: 1;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.summary-stat.error {
    border-left-color: #dc3545;
}

.stat-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.batch-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.batch-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.batch-item.error {
    border-left-color: #dc3545;
}

.batch-item i {
    font-size: 1.5rem;
    color: #28a745;
}

.batch-item.error i {
    color: #dc3545;
}

.item-details {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
}

.item-info {
    color: #666;
    font-size: 0.9rem;
}

.item-error {
    color: #dc3545;
    font-size: 0.9rem;
}

.mini-download-btn {
    padding: 8px 12px;
    background: #28a745;
    color: white;
    border-radius: 5px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.mini-download-btn:hover {
    background: #218838;
    transform: translateY(-2px);
}

/* Footer */
.footer {
    text-align: center;
    color: white;
    margin-top: 40px;
}

.features {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.feature i {
    color: #ffd700;
}

.copyright {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .main-content {
        padding: 25px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .tab-navigation {
        gap: 10px;
    }
    
    .tab-btn {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    
    .options-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .features {
        flex-direction: column;
        gap: 15px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .batch-summary {
        flex-direction: column;
    }
    
    .file-input-label,
    .batch-upload-label {
        height: 150px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
    
    .preview-container {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .logo i {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .tab-btn span {
        display: none;
    }
}
