:root {
    --primary-color: #4a90e2;
    --secondary-color: #5c6ac4;
    --success-color: #27ae60;
    --background-color: #f8f9fa;
    --text-color: #2d3436;
    --border-radius: 12px;
    --box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 1.2rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.nav-brand:hover {
    transform: translateY(-1px);
}

.nav-brand span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-logo {
    width: 38px;
    height: 38px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: var(--transition);
}

.nav-brand:hover .nav-logo {
    transform: scale(1.1) rotate(-5deg);
}

.nav-links {
    display: flex;
    gap: 3rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Tool Section */
.tool-section {
    padding: 8rem 0 4rem;
    background: linear-gradient(180deg, #fff 0%, var(--background-color) 100%);
    position: relative;
}

.tool-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tool-header h1 {
    font-size: 3rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    text-shadow: 0 4px 15px rgba(74, 144, 226, 0.2);
}

.upload-area {
    border: 3px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 4rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    transition: var(--transition);
    cursor: pointer;
    background-color: rgba(74, 144, 226, 0.05);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: var(--gradient-primary);
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg);
    transition: opacity 0.3s ease;
    z-index: 0;
}

.upload-area > * {
    position: relative;
    z-index: 1;
}

.upload-area:hover::before {
    opacity: 0.03;
}

.upload-area:hover {
    border-style: solid;
    transform: translateY(-2px);
}

.upload-area i {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 6px rgba(74, 144, 226, 0.2));
    transition: var(--transition);
}

.upload-area:hover i {
    transform: scale(1.1);
}

.upload-button {
    display: inline-block;
    background: var(--gradient-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    margin-top: 1.5rem;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.upload-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

input[type="file"] {
    display: none;
}

/* Options Panel */
.options {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.options::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.option-group {
    background: rgba(74, 144, 226, 0.02);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(74, 144, 226, 0.1);
    transition: var(--transition);
}

.option-group:hover {
    background: rgba(74, 144, 226, 0.05);
    transform: translateY(-2px);
}

.option-group {
    margin-bottom: 1.5rem;
}

.option-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-color);
}

label i {
    color: var(--primary-color);
    margin-right: 0.8rem;
    font-size: 1.2rem;
    transition: var(--transition);
    filter: drop-shadow(0 2px 4px rgba(74, 144, 226, 0.2));
}

.option-group:hover label i {
    transform: translateY(-1px) scale(1.1);
}

input[type="number"],
select {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e1e1e1;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

input[type="number"]:hover,
select:hover {
    border-color: #d0d0d0;
}

input[type="number"]:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
    transform: translateY(-1px);
}

.quality-control {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #fff;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#qualityValue {
    min-width: 3rem;
    font-weight: 600;
    color: var(--primary-color);
}

input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Preview Section */
.preview {
    margin-top: 3rem;
}

.preview h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
    padding-bottom: 1rem;
}

.preview h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50%;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.preview-box {
    background: #fff;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.preview-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.preview-box:hover::before {
    transform: scaleX(1);
}

.preview-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.preview-box h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.preview-box h3 i {
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(74, 144, 226, 0.2));
}

.preview-box img {
    max-width: 100%;
    height: auto;
    border: 2px solid #eee;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.preview-box:hover img {
    border-color: rgba(74, 144, 226, 0.2);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.image-info {
    padding: 1rem;
    background: rgba(74, 144, 226, 0.03);
    border: 1px solid rgba(74, 144, 226, 0.1);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    color: var(--text-color);
    transition: var(--transition);
}

.preview-box:hover .image-info {
    background: rgba(74, 144, 226, 0.05);
    border-color: rgba(74, 144, 226, 0.2);
}

.image-info p {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.image-info i {
    color: var(--primary-color);
    font-size: 1rem;
    transition: var(--transition);
}

.preview-box:hover .image-info i {
    transform: translateY(-1px);
}

.image-info span {
    font-weight: 600;
    color: var(--primary-color);
}

/* Buttons */
.primary-button,
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.primary-button {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    position: relative;
    overflow: hidden;
}

.primary-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

.primary-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.download-button {
    background: linear-gradient(135deg, var(--success-color), #2ecc71);
    color: white;
    margin-top: 1.5rem;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    position: relative;
    overflow: hidden;
}

.download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.primary-button::after,
.download-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.3s ease;
}

.primary-button:hover::after,
.download-button:hover::after {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* Features Section */
.features-section {
    padding: 6rem 0;
    background: linear-gradient(180deg, var(--background-color) 0%, #fff 50%, var(--background-color) 100%);
}

.features-section h2,
.how-it-works-section h2,
.faq-section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: 1rem;
}

.features-section h2::after,
.how-it-works-section h2::after,
.faq-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 50%;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* How It Works Section */
.how-it-works-section {
    padding: 6rem 0;
    background: linear-gradient(180deg, var(--background-color) 0%, #fff 100%);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.step-card {
    text-align: center;
    padding: 3rem 2rem;
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.step-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.step-card:hover::before {
    transform: scaleX(1);
}

.step-number {
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

/* FAQ Section */
.faq-section {
    padding: 6rem 0;
    background: linear-gradient(180deg, #fff 0%, var(--background-color) 100%);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.faq-item {
    padding: 2.5rem;
    background-color: #fff;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.faq-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.faq-item:hover::before {
    transform: scaleX(1);
}

.faq-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.faq-item h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Footer */
footer {
    background: linear-gradient(180deg, var(--background-color) 0%, #1a252f 100%);
    color: #fff;
    padding: 6rem 0 3rem;
    position: relative;
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1.5rem;
    color: #fff;
    font-size: 1.4rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #fff;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    opacity: 0.9;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
}

.footer-section a:hover {
    opacity: 1;
    transform: translateY(-1px);
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    background-color: rgba(255, 255, 255, 0.1);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Loading Overlay */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .nav-links {
        display: none;
    }

    .tool-header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .preview-container {
        grid-template-columns: 1fr;
    }

    .features-grid,
    .steps-grid,
    .faq-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .tool-header h1 {
        font-size: 1.8rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}
