/* CSS Variables with Dark/Light Theme Support */
:root,
.dark-theme {
    --primary-color: #2E7D32;
    --primary-hover: #1B5E20;
    --secondary-color: #81C784;
    --accent-color: #FFD54F;

    --body-bg: #0d1117;
    --text-color: #ffffff;
    --light-text: rgba(255, 255, 255, 0.7);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-bg: rgba(255, 255, 255, 0.05);
    --header-bg: rgba(13, 17, 23, 0.95);
    --section-bg-alt: #161b22;

    --hero-bg: radial-gradient(circle at 50% 50%, #0d1117 0%, #161b22 100%);
    --glass-blur: blur(24px);

    --border-radius: 12px;
    --transition: all 0.3s ease;

    --accent-emerald: #10B981;
    --accent-indigo: #6366f1;
}

.light-theme {
    --body-bg: #F9F9F9;
    --text-color: #333333;
    --light-text: #666666;
    --card-bg: #FFFFFF;
    --card-border: rgba(0, 0, 0, 0.1);
    --card-hover-bg: #f8f9fa;
    --header-bg: rgba(255, 255, 255, 0.95);
    --section-bg-alt: #f0f7f0;

    --hero-bg: linear-gradient(135deg, #e8f5e9 0%, #ffffff 100%);
    --glass-blur: none;
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 2px solid var(--card-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    padding: 0;
    margin: 0 10px;
}

.theme-toggle:hover {
    background: var(--card-bg);
    border-color: var(--secondary-color);
    transform: rotate(20deg);
}

.theme-icon {
    display: block;
    line-height: 1;
}

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--body-bg);
    margin: 0;
    padding: 0;
    transition: background-color 0.4s ease, color 0.4s ease;
}

h1,
h2,
h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-color);
    transition: color 0.4s ease;
    margin-top: 0;
    margin-bottom: 24px;
}

.dark-theme h1,
.dark-theme h2,
.dark-theme h3 {
    color: #ffffff;
}

.light-theme h1,
.light-theme h2,
.light-theme h3 {
    color: var(--primary-color);
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--header-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: var(--glass-blur);
    transition: background 0.4s ease;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav a {
    font-weight: 500;
    color: var(--text-color);
    transition: var(--transition);
}

.nav a.active {
    color: var(--primary-color);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-color);
    position: relative;
    transition: var(--transition);
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--text-color);
    transition: var(--transition);
    left: 0;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

/* Hamburger Animation State */
.menu-toggle.active .hamburger {
    background: transparent;
}

.menu-toggle.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.menu-toggle.active .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* Theme Toggle Button Specifics */
#theme-toggle {
    margin: 0 5px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-outline {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* Hero Section */
.hero {
    background: var(--hero-bg);
    padding: 100px 0;
    text-align: center;
    transition: background 0.4s ease;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 24px;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 1.25rem;
    color: var(--light-text);
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/* Features Section */
.features {
    padding: 100px 0;
    background: var(--body-bg);
    transition: background 0.4s ease;
}

.features h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 60px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.feature-card {
    padding: 40px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    text-align: center;
    backdrop-filter: var(--glass-blur);
    transition: var(--transition);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: var(--card-hover-bg);
    border-color: var(--primary-color);
}

.feature-card .icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    display: block;
}

/* Demo Section */
.demo-section {
    padding: 100px 0;
    background: var(--section-bg-alt);
    transition: background 0.4s ease;
}

.demo-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.demo-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    backdrop-filter: var(--glass-blur);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Form Controls */
.form-control {
    width: 100%;
    padding: 12px 15px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--card-border);
    border-radius: var(--border-radius);
    padding: 40px;
    background: var(--card-bg);
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--card-hover-bg);
}

.upload-content {
    user-select: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.7;
}

.upload-content p {
    margin: 8px 0;
}

.upload-content span {
    color: var(--primary-color);
    font-weight: 700;
}

.small {
    font-size: 0.8rem;
    opacity: 0.6;
}

.subtitle {
    text-align: center;
    color: var(--light-text);
    margin: -10px 0 50px;
    font-size: 1.1rem;
}

.form-group {
    margin: 25px 0;
}

.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 12px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.form-check-label {
    font-size: 0.9rem;
    color: var(--light-text);
    cursor: pointer;
    line-height: 1.4;
}

.form-check-label a {
    color: var(--primary-color);
    text-decoration: underline;
}

.btn-block {
    width: 100%;
    display: block;
}

.spinner {
    border: 4px solid var(--card-border);
    border-top: 4px solid var(--primary-color);
    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);
    }
}

#previewContainer {
    position: relative;
    width: 100%;
    margin-top: 20px;
}

#imagePreview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Examples Section */
.examples-section {
    padding: 100px 0;
    background: var(--body-bg);
}

.examples-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.example-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    overflow: hidden;
    transition: var(--transition);
}

.example-card:hover {
    transform: translateY(-8px);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.example-image {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.example-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    position: absolute;
    bottom: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    backdrop-filter: blur(4px);
}

.badge-before {
    left: 12px;
    background: rgba(220, 38, 38, 0.8);
}

.badge-after {
    right: 12px;
    background: rgba(16, 185, 129, 0.8);
}

.example-content {
    padding: 30px;
}

.example-content h3 {
    margin: 0 0 15px 0;
    font-size: 1.25rem;
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 12px;
}

.example-content p {
    margin: 10px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.example-content .problem strong {
    color: #f87171;
}

.example-content .solution strong {
    color: #34d399;
}

.example-content .result {
    font-weight: 700;
    margin-top: 20px;
    color: var(--accent-emerald);
}

/* Result Content */
.result-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
}

/* Footer */
.footer {
    background: var(--section-bg-alt);
    color: var(--light-text);
    padding: 60px 0;
    text-align: center;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    animation: fadeIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Body scroll lock when mobile menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--header-bg);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        transition: right 0.4s ease;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        z-index: 999;
        padding-top: 80px;
        backdrop-filter: blur(10px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav.nav-open {
        right: 0;
    }

    .nav a {
        font-size: 1.2rem;
        margin: 15px 0;
    }

    /* Adjust existing updates */
    .hero h1 {
        font-size: 2.5rem;
    }
}