* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    color: white;
    text-align: center;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.header p {
    opacity: 0.9;
    font-size: 16px;
    line-height: 1.5;
}

.content {
    padding: 36px 40px;
}

.input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    background: none;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.tab-btn:hover:not(.active) {
    background: #f0f2ff;
}

.paste-section {
    display: none;
}

.paste-section.active {
    display: block;
}

#pasteInput {
    width: 100%;
    min-height: 200px;
    padding: 14px;
    border: 3px dashed #667eea;
    border-radius: 12px;
    background: #f8f9ff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#pasteInput:focus {
    border-color: #764ba2;
    background: #eef1ff;
}

.upload-section {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    background: #f8f9ff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-section:hover {
    background: #eef1ff;
    border-color: #764ba2;
}

.upload-section.dragover {
    background: #e0e7ff;
    border-color: #4f46e5;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

input[type="file"] {
    display: none;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
    margin: 10px 5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
}

.controls {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 8px;
    display: none;
}

.controls.active {
    display: block;
}

.slider-group {
    margin: 15px 0;
}

.slider-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.value-display {
    display: inline-block;
    margin-left: 10px;
    font-weight: bold;
    color: #667eea;
}

select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    font-size: 14px;
}

#output {
    margin-top: 30px;
    padding: 40px 48px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    min-height: 200px;
    line-height: 2.0;
    font-size: 22px;
    word-spacing: 0.1em;
    max-width: 68ch;
    margin-left: auto;
    margin-right: auto;
    display: none;
}

#output.active {
    display: block;
}

.formatted-text {
    letter-spacing: 0.05em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.preview-image {
    max-width: 100%;
    margin: 20px 0;
    border-radius: 8px;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.preview-image.active {
    display: block;
}

.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    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); }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
}

.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
}

.error-message.active {
    display: block;
}

.info-box {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    color: #004085;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    display: none;
}

.info-box.active {
    display: block;
}

.info-box h4 {
    margin-bottom: 10px;
}

.info-box ul {
    margin-left: 20px;
    margin-top: 10px;
}

.info-box li {
    margin: 5px 0;
}

.extracted-text {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    max-height: 240px;
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    display: none;
}

.extracted-text.active {
    display: block;
}

.extracted-text h4 {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
    color: #444;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
}

.toggle-label input[type="checkbox"] {
    display: inline-block;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

#output.dyslexic-font {
    font-family: 'Open Dyslexic', sans-serif;
    line-height: 2.2;
    letter-spacing: 0.07em;
    word-spacing: 0.18em;
}

.upload-hint {
    margin-top: 12px;
    color: #666;
    font-size: 14px;
}

.controls-heading {
    margin-bottom: 15px;
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

.confidence-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
}

.confidence-badge.high   { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.confidence-badge.medium { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.confidence-badge.low    { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

.confidence-warning {
    margin-top: 8px;
    font-size: 13px;
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    padding: 6px 10px;
}
