* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    background: white;
    border: 3px dashed #ddd;
    border-radius: 20px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    font-size: 4rem;
    opacity: 0.7;
}

.upload-content h3 {
    font-size: 1.5rem;
    color: #333;
}

.upload-content p {
    font-size: 1.1rem;
    color: #666;
}

.browse-btn {
    background: none;
    border: none;
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
    font-size: inherit;
    padding: 5px 10px;
}

.browse-btn:hover {
    color: #5a6fd8;
}

.supported-formats {
    margin-top: 10px;
    color: #888;
}

.upload-error {
    background: #ffe6e6;
    color: #d63384;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
    display: none;
}

/* Editor Section */
.editor-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.image-container {
    display: grid;
    grid-template-columns: 1fr 300px 1fr;
    gap: 30px;
    align-items: start;
}

.original-image, .resized-image {
    text-align: center;
}

.original-image h3, .resized-image h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

.image-preview {
    border: 2px solid #eee;
    border-radius: 10px;
    padding: 20px;
    background: #f8f9fa;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.image-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
    background: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #eee;
}

/* Resize Controls */
.resize-controls {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
}

.resize-controls h3 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.resize-method {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
}

.resize-method label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.2s;
}

.resize-method label:hover {
    background: #e9ecef;
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 10px;
}

.percentage-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.percentage-buttons button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.percentage-buttons button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.size-inputs {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.input-group {
    flex: 1;
}

.input-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.aspect-ratio-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.preset-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-buttons button {
    padding: 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.preset-buttons button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.preset-buttons button small {
    display: block;
    margin-top: 5px;
    opacity: 0.7;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.secondary-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #f8f9fa;
}

/* Download Section */
.download-section {
    margin-top: 20px;
}

.download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s;
    width: 100%;
}

.download-btn:hover {
    background: #218838;
}

.download-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Processing Indicator */
.processing-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Footer */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: white;
    opacity: 0.8;
}

#visitorCounter {
    margin-top: 15px;
    font-size: 0.9rem;
    padding: 8px;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.15);
    display: inline-block;
}

#visitorCounter p {
    margin: 0;
}

#counterValue {
    font-weight: bold;
    color: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .image-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .resize-controls {
        order: -1;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .percentage-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .size-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .preset-buttons {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 30px 15px;
    }
    
    .editor-section {
        padding: 20px;
    }
    
    .resize-controls {
        padding: 20px;
    }
    
    .percentage-buttons {
        grid-template-columns: 1fr;
    }
}
