/* Pixel Art Converter Styles */
.pixel-art-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.converter-header {
    text-align: center;
    margin-bottom: 30px;
}

.converter-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2.2em;
    font-weight: 700;
}

.converter-header p {
    color: #666;
    font-size: 1.1em;
    margin: 0;
}

/* Upload Section */
.upload-section {
    margin-bottom: 25px;
}

.file-input-wrapper {
    width: 100%;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
}

.upload-area:hover {
    border-color: #007cba;
    background: #f0f8ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #007cba;
    background: #e8f4f8;
    border-style: solid;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.upload-text strong {
    color: #007cba;
    font-size: 1.1em;
}

.upload-text small {
    color: #888;
    display: block;
    margin-top: 8px;
}

/* Image Preview */
.image-preview {
    position: relative;
    margin: 20px 0;
    text-align: center;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    font-weight: bold;
    transition: all 0.3s ease;
}

.remove-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}

/* Controls Section */
.controls-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    margin: 25px 0;
    border: 1px solid #e0e0e0;
}

.control-group {
    margin-bottom: 25px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #555;
    font-size: 1em;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    transition: background 0.3s ease;
    cursor: pointer;
}

.control-group input[type="range"]:hover {
    background: #ccc;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #007cba;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,124,186,0.3);
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #005a87;
    transform: scale(1.1);
}

.control-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0,124,186,0.1);
}

/* Convert Button */
.convert-section {
    text-align: center;
    margin: 30px 0;
}

.convert-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 35px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    max-width: 300px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.convert-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.convert-button:active:not(:disabled) {
    transform: translateY(-1px);
}

.convert-button:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-loader {
    display: inline-block;
}

/* Result Section */
.result-section {
    text-align: center;
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid #e9ecef;
}

.result-header h3 {
    color: #28a745;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 700;
}

.result-image {
    margin-bottom: 25px;
}

.result-image img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    border: 3px solid #fff;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.download-button, .share-button, .new-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 140px;
}

.download-button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.share-button {
    background: linear-gradient(135deg, #17a2b8 0%, #20c997 100%);
    color: white;
}

.share-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 162, 184, 0.4);
}

.new-button {
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
    color: white;
}

.new-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.4);
}

.result-stats {
    color: #6c757d;
    font-style: italic;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #333;
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 25px;
}

.loading-text {
    font-size: 1.2em;
    font-weight: 500;
    text-align: center;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Gallery Section */
.recent-creations {
    margin-top: 50px;
    padding: 30px 0;
    border-top: 2px solid #f0f0f0;
}

.recent-creations h3 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 1.8em;
    font-weight: 700;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .pixel-art-container {
        padding: 15px;
        margin: 10px;
    }
    
    .converter-header h2 {
        font-size: 1.8em;
    }
    
    .controls-section {
        padding: 20px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .download-button, .share-button, .new-button {
        width: 100%;
        min-width: auto;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .pixel-art-container {
        padding: 12px;
        margin: 5px;
    }
    
    .converter-header h2 {
        font-size: 1.6em;
    }
    
    .upload-area {
        padding: 25px 10px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}