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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #8898aa;
    font-size: 0.85em;
}

.checkbox-group {
    display: flex;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f3f4ff;
}

.upload-area.drag-over {
    border-color: #667eea;
    background: #f3f4ff;
    transform: scale(1.02);
}

.upload-content svg {
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content p {
    color: #8898aa;
    margin: 10px 0;
}

.file-info {
    color: #667eea !important;
    font-weight: 500;
}

.translate-btn {
    width: 100%;
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.translate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.translate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    animation: rotate 1s linear infinite;
}

.spinner circle {
    stroke-dasharray: 90;
    stroke-dashoffset: 70;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dashoffset: 70;
    }
    50% {
        stroke-dashoffset: 20;
    }
    100% {
        stroke-dashoffset: 70;
    }
}

.progress-area {
    margin-top: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
}

.progress-label {
    color: #667eea;
    font-weight: 600;
}

.progress-status {
    color: #667eea;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #e1e8ed;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: attr(data-percent);
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.progress-text {
    text-align: center;
    color: #8898aa;
    font-size: 14px;
}

.result-area {
    margin-top: 30px;
    padding: 30px;
    background: #f0f4ff;
    border-radius: 12px;
    text-align: center;
}

.result-area h3 {
    color: #667eea;
    margin-bottom: 20px;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.download-btn,
.preview-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn {
    background: #667eea;
    color: white;
}

.download-btn:hover {
    background: #5a67d8;
}

.preview-btn {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.preview-btn:hover {
    background: #667eea;
    color: white;
}

.preview-content {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 20px;
    text-align: left;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
}

.error-area {
    margin-top: 20px;
    padding: 20px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c00;
}

footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px;
    color: #8898aa;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

.advanced-settings {
    padding-top: 10px;
}

/* Language selector styles */
.language-selector {
    position: relative;
}

#languageSearch {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#languageSearch:focus {
    outline: none;
    border-color: #667eea;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e1e8ed;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.language-option {
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background-color: #f3f4ff;
}

.language-option.selected {
    background-color: #667eea;
    color: white;
}

.language-native {
    font-weight: 600;
}

.language-english {
    font-size: 0.9em;
    color: #666;
    margin-left: 8px;
}

.language-option.selected .language-english {
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 2em;
    }
}