/* Reset và biến CSS */
:root {
    --primary-color: #4a6bff;
    --primary-dark: #3a56d4;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-light: #e9ecef;
    --gray: #adb5bd;
    --border-radius: 10px;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    --box-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.header h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.header .subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
    max-width: 700px;
    margin: 0 auto;
}

/* Main content layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Tool section */
.tool-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    height: fit-content;
}

.tool-section h2 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Upload area */
.upload-area {
    border: 3px dashed var(--gray);
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 25px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(74, 107, 255, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.upload-area p {
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.browse-link {
    color: var(--primary-color);
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}

.upload-note {
    font-size: 0.9rem;
    color: var(--gray);
}

/* Image preview */
.image-preview, .logo-preview {
    width: 100%;
    height: 200px;
    border-radius: var(--border-radius);
    border: 2px solid var(--gray-light);
    overflow: hidden;
    position: relative;
    margin-top: 15px;
}

.image-preview img, .logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.preview-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--gray);
    background-color: #f9f9f9;
}

.preview-placeholder i {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Tabs */
.controls-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--gray-light);
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: var(--secondary-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.tab-btn:hover:not(.active) {
    color: var(--dark-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Control groups */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--dark-color);
}

.control-group input[type="text"],
.control-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-family: 'Roboto', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

.control-group input[type="text"]:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 107, 255, 0.2);
}

.color-input-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.color-input-group input[type="text"] {
    flex: 1;
}

.upload-logo-area {
    border: 2px dashed var(--gray);
    border-radius: var(--border-radius);
    padding: 25px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 15px;
}

.upload-logo-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(74, 107, 255, 0.05);
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    background: var(--gray-light);
    border-radius: 4px;
    outline: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.slider-container span {
    min-width: 50px;
    text-align: right;
    font-weight: 500;
    color: var(--dark-color);
}

/* Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
}

.btn-primary, .btn-secondary, .btn-outline {
    padding: 14px 24px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    min-width: 180px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 5px 15px rgba(74, 107, 255, 0.3);
}

.btn-secondary {
    background-color: var(--success-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #218838;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.btn-secondary:disabled {
    background-color: var(--gray);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-outline {
    background-color: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--gray-light);
}

.btn-outline:hover {
    border-color: var(--secondary-color);
    color: var(--dark-color);
}

/* Result section */
.result-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    height: fit-content;
}

.result-container {
    width: 100%;
    height: 400px;
    border-radius: var(--border-radius);
    border: 2px solid var(--gray-light);
    overflow: hidden;
    position: relative;
    margin-bottom: 20px;
}

#resultCanvas {
    width: 100%;
    height: 100%;
    display: none;
}

.result-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--gray);
    background-color: #f9f9f9;
}

.result-placeholder i {
    font-size: 4rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.image-info {
    display: flex;
    justify-content: space-between;
    background-color: var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

/* Features section */
.features-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 40px 30px;
    margin-bottom: 40px;
}

.features-section h2 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 40px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.feature-card {
    background-color: var(--light-color);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-hover);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background-color: rgba(74, 107, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.feature-icon i {
    font-size: 2rem;
    color: var(--primary-color);
}

.feature-card h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.feature-card p {
    color: var(--secondary-color);
    line-height: 1.5;
}

/* Footer */
.footer {
    text-align: center;
    padding: 25px;
    color: var(--secondary-color);
    font-size: 0.95rem;
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.footer i {
    color: #e25555;
    margin: 0 5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content, .features-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary, .btn-outline {
        min-width: 100%;
    }
    
    .color-input-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .color-input-group input[type="color"] {
        width: 60px;
        height: 60px;
    }
}