:root {
    --primary: #2563eb; /* Corporate Blue */
    --primary-hover: #1d4ed8;
    --secondary: #f1f5f9; /* Light Slate */
    --bg-color: #f8fafc; /* Very Light Background */
    --surface: #ffffff; /* White Cards */
    --text-primary: #0f172a; /* Dark Slate for Headings */
    --text-secondary: #475569; /* Medium Slate for Body */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Layout */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* Hero Section */
.hero-section {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Tool Container */
.tool-container {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* Settings Area (Language) */
.settings-area {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-selector label {
    font-weight: 600;
    color: var(--text-primary);
}

.lang-select {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.3s;
}

.lang-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Upload Area */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: var(--border-radius);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-color);
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: #eff6ff; /* light blue */
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    pointer-events: none; /* Prevents inner elements from triggering drag events */
}

.upload-icon {
    color: var(--primary);
}

.file-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    outline: none;
}

.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
    pointer-events: auto; /* Re-enable clicks since parent has pointer-events: none */
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.secondary-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.secondary-btn:hover {
    background: var(--secondary);
}

.outline-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.outline-btn:hover {
    background: var(--secondary);
}

/* Preview Area */
.preview-area {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.image-wrapper {
    position: relative;
    max-width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

#image-preview {
    max-width: 100%;
    max-height: 400px;
    display: block;
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #ef4444; /* Red */
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.remove-btn:hover {
    background: #ef4444;
    color: white;
}

/* Processing State */
.processing-state {
    text-align: center;
    padding: 3rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-bar-container {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--secondary);
    border-radius: 4px;
    margin: 1.5rem auto 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Result Area */
.result-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
}

textarea {
    width: 100%;
    height: 300px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s ease;
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Content Sections (SEO) */
.content-section {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.content-section h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 0.5rem;
}

.content-section h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.content-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.content-section ul, .content-section ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

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

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

.feature-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

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

.feature-card h4 {
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem 1rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column {
    flex: 1;
    min-width: 250px;
}

.footer-column h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-column p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
}

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

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

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

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .settings-area {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .hero-section h1 {
        font-size: 2.2rem;
    }
}

/* --- Mobile Optimization (Responsive Fixes) --- */

@media (max-width: 768px) {
    /* 1. Hero Section Fix */
    .hero-section h1 {
        font-size: 1.8rem;
        padding: 0 10px;
    }

    .hero-section p {
        font-size: 1rem;
        padding: 0 15px;
    }

    /* 2. Main Container and Tool Area */
    .main-container {
        padding: 1.5rem 1rem;
        gap: 2rem;
    }

    .tool-container {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
    }

    /* 3. Settings Area (Dropdown) */
    .settings-area {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .language-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .lang-select {
        width: 100%;
    }

    /* 4. Upload Area */
    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-content p {
        font-size: 0.9rem;
    }

    /* 5. Result Area and Textbox */
    .result-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .action-buttons {
        width: 100%;
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    textarea {
        height: 200px;
    }

    /* 6. Footer Fix */
    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-column {
        min-width: 100%;
    }
}

/* For Extra Small Screens (e.g., iPhone SE) */
@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 1.5rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
}

