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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --error: #ef4444;
    --success: #10b981;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.lang-switcher {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--background);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
}

.lang-btn:hover {
    background: var(--surface);
    transform: translateY(-1px);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.converter-section {
    background: var(--background);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.mode-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.mode-btn {
    flex: 1;
    max-width: 200px;
    padding: 1rem;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 600;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.input-output-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 968px) {
    .input-output-container {
        grid-template-columns: 1fr;
    }
    
    .convert-button-container {
        display: flex;
        justify-content: center;
    }
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-actions,
.output-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--background);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
}

.action-btn:hover {
    background: var(--surface);
    transform: translateY(-1px);
}

.file-upload-label {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--background);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
}

.file-upload-label:hover {
    background: var(--surface);
    transform: translateY(-1px);
}

.file-upload-label input[type="file"] {
    display: none;
}

.text-area {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.875rem;
    resize: vertical;
    transition: var(--transition);
    background: var(--surface);
}

.text-area:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--background);
}

.text-area[readonly] {
    background: var(--surface);
    cursor: default;
}

.convert-button-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.convert-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.convert-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-lg);
}

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn svg {
    width: 24px;
    height: 24px;
}

.error-message {
    color: var(--error);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.success-message {
    color: var(--success);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.options-panel {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
}

.options-panel h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    cursor: pointer;
}

.option-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-label select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    cursor: pointer;
    font-size: 0.875rem;
}

.features {
    margin-top: 3rem;
}

.features h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-primary);
}

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

.feature-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    transition: var(--transition);
}

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

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .converter-section {
        padding: 1.5rem;
    }
    
    .text-area {
        min-height: 300px;
    }
    
    .mode-selector {
        flex-direction: column;
    }
    
    .mode-btn {
        max-width: none;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --border: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
    }
    
    body {
        background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 100%);
    }
    
    .text-area {
        color: var(--text-primary);
    }
    
    .lang-btn.active,
    .mode-btn.active {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-color: transparent;
    }
}