/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 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: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-list a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-list a:hover {
    color: #667eea;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

section {
    background: rgba(255, 255, 255, 0.95);
    margin: 2rem 0;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

section .container {
    padding: 2rem 20px;
}

section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover,
.btn-secondary.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

/* Upload Section */
.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-content p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: #666;
}

.image-preview {
    margin-top: 2rem;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.image-info {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    font-family: monospace;
}

/* Crop Section */
.crop-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.ratio-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.crop-area {
    text-align: center;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 2rem;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cropCanvas {
    max-width: 100%;
    max-height: 500px;
    border: 2px solid #667eea;
    border-radius: 10px;
    cursor: crosshair;
}

/* Convert Section */
.convert-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.format-options {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.format-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.format-options label:hover {
    background: #e9ecef;
}

.format-options input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

.format-options input[type="radio"]:checked {
    accent-color: #667eea;
}

/* Color Picker Section */
.instruction {
    text-align: center;
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.color-info {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.color-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #ddd;
    background: #fff;
}

.color-codes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-code {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-code label {
    font-weight: 600;
    min-width: 50px;
}

.color-code input {
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 5px;
    font-family: monospace;
    background: #f8f9fa;
}

#colorCanvas {
    max-width: 100%;
    max-height: 500px;
    border: 2px solid #667eea;
    border-radius: 10px;
    cursor: crosshair;
    display: block;
    margin: 0 auto;
}

/* Compress Section */
.compress-controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.quality-control {
    text-align: center;
}

.quality-control label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
}

#qualitySlider {
    width: 100%;
    max-width: 400px;
    height: 8px;
    border-radius: 5px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

#qualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

#qualitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.size-info {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 10px;
    flex-wrap: wrap;
    gap: 1rem;
}

.size-before,
.size-after {
    text-align: center;
}

.size-before span:first-child,
.size-after span:first-child {
    font-weight: 600;
    display: block;
}

#compressCanvas {
    max-width: 100%;
    max-height: 500px;
    border: 2px solid #667eea;
    border-radius: 10px;
    display: block;
    margin: 0 auto;
}

/* Download Section */
.download-section {
    text-align: center;
}

#downloadBtn {
    font-size: 1.2rem;
    padding: 1rem 2rem;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer p {
    margin-bottom: 0.5rem;
}

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

.footer-links a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-list {
        gap: 1rem;
    }
    
    .ratio-buttons {
        justify-content: center;
    }
    
    .format-options {
        justify-content: center;
    }
    
    .color-info {
        flex-direction: column;
        text-align: center;
    }
    
    .size-info {
        flex-direction: column;
    }
    
    section .container {
        padding: 1.5rem 15px;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
}

@media (max-width: 480px) {
    .nav-list {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    section h2 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeIn 0.6s ease-out;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-2 {
    margin-bottom: 1rem;
}