:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --gray-color: #6c757d;
    --success-color: #4bb543;
    --error-color: #f44336;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

header h1 i {
    margin-right: 0.5rem;
}

header p {
    color: var(--gray-color);
    font-size: 1.1rem;
}

.tool-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--gray-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.05);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.upload-area h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.upload-area p {
    color: var(--gray-color);
    margin: 0.5rem 0;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--light-color);
    color: var(--dark-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    background-color: #e9ecef;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--secondary-color);
}

.btn.secondary {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn.secondary:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

.controls {
    margin-top: 2rem;
}

.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.image-container {
    max-width: 100%;
    max-height: 300px;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.image-container img {
    max-width: 100%;
    max-height: 300px;
    display: block;
    object-fit: contain;
}

.original-size {
    color: var(--gray-color);
    font-size: 0.9rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.resize-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.option {
    margin-bottom: 1rem;
}

.option label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.option input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
}

.option input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.option select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.result {
    margin-top: 2rem;
    text-align: center;
}

.result-preview {
    margin-bottom: 2rem;
}

.result-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.result-info {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--dark-color);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.result-info div {
    display: flex;
    justify-content: center;
    gap: 0.3rem;
}

.result-info span {
    font-weight: 500;
}

#fileSize, #reductionPercent {
    color: var(--primary-color);
}

.download-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

footer {
    text-align: center;
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-top: 2rem;
}

footer i {
    color: var(--error-color);
}

/* Loading spinner */
.spinner {
    display: none;
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .resize-options {
        grid-template-columns: 1fr;
    }
    
    .actions, .download-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .original-size {
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
    }
}