/* Handwriting OCR Converter Pro */
.hwocr-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.hwocr-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 25px;
    border-bottom: 2px solid #f0f2f5;
}

.hwocr-header h1 {
    color: #1a237e;
    font-size: 2.8em;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.hwocr-header .hwocr-subtitle {
    color: #5f6368;
    font-size: 1.2em;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

.hwocr-icon {
    font-style: normal;
}

/* Upload Area */
.hwocr-upload-area {
    border: 3px dashed #c5cae9;
    border-radius: 15px;
    padding: 60px 30px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 35px;
    position: relative;
    overflow: hidden;
}

.hwocr-upload-area:hover,
.hwocr-upload-area.dragover {
    border-color: #3f51b5;
    background: linear-gradient(135deg, #e8eaf6 0%, #e3e6ff 100%);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(63, 81, 181, 0.15);
}

.hwocr-upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3f51b5, #2196f3);
}

.upload-icon {
    font-size: 80px;
    margin-bottom: 25px;
    color: #3f51b5;
    opacity: 0.9;
}

.hwocr-upload-area h3 {
    color: #1a237e;
    font-size: 1.8em;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.hwocr-upload-area p {
    color: #5f6368;
    margin: 8px 0;
    font-size: 1.1em;
}

.hwocr-upload-area .file-size-info {
    color: #757575;
    font-size: 0.95em;
    margin-top: 15px;
}

/* Options */
.hwocr-options {
    background: #f8f9ff;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 35px;
    border: 1px solid #e8eaf6;
}

.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 25px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
    color: #1a237e;
    font-size: 1.1em;
}

.option-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #3f51b5;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-group label {
    font-weight: 500;
    color: #1a237e;
    white-space: nowrap;
}

#hwocr-format {
    padding: 10px 20px;
    border: 2px solid #c5cae9;
    border-radius: 8px;
    background: white;
    color: #1a237e;
    font-size: 1em;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#hwocr-format:focus {
    outline: none;
    border-color: #3f51b5;
    box-shadow: 0 0 0 3px rgba(63, 81, 181, 0.2);
}

/* Files Section */
.hwocr-files-section {
    margin-bottom: 35px;
}

.hwocr-files-section h3 {
    color: #1a237e;
    font-size: 1.4em;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.files-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.files-list::-webkit-scrollbar {
    width: 8px;
}

.files-list::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 4px;
}

.files-list::-webkit-scrollbar-thumb {
    background: #c5cae9;
    border-radius: 4px;
}

.files-list::-webkit-scrollbar-thumb:hover {
    background: #9fa8da;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 18px;
    background: white;
    border: 2px solid #e8eaf6;
    border-radius: 10px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.file-item:hover {
    border-color: #3f51b5;
    box-shadow: 0 5px 20px rgba(63, 81, 181, 0.1);
    transform: translateY(-2px);
}

.file-item.uploading {
    border-style: dashed;
    border-color: #ff9800;
    background: #fff8e1;
}

.file-item.uploaded {
    border-color: #4caf50;
}

.file-item.error {
    border-color: #f44336;
    background: #ffebee;
}

.file-thumb {
    width: 70px;
    height: 70px;
    margin-right: 20px;
    flex-shrink: 0;
}

.file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e8eaf6;
}

.file-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8eaf6;
    border-radius: 8px;
    font-size: 28px;
    color: #3f51b5;
}

.file-info {
    flex: 1;
    min-width: 0;
    padding-right: 20px;
}

.file-name {
    font-weight: 600;
    color: #1a237e;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.1em;
}

.file-size {
    color: #5f6368;
    font-size: 0.95em;
    margin-bottom: 5px;
}

.file-error {
    color: #f44336;
    font-size: 0.9em;
    font-style: italic;
}

.file-status {
    font-size: 24px;
    margin: 0 15px;
    min-width: 40px;
    text-align: center;
}

.file-remove {
    background: #f44336;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    opacity: 0;
}

.file-item:hover .file-remove {
    opacity: 1;
}

.file-remove:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* Actions */
.hwocr-actions {
    display: flex;
    gap: 20px;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.hwocr-btn {
    padding: 16px 35px;
    border: none;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 180px;
    text-decoration: none;
}

.hwocr-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.hwocr-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.hwocr-btn-primary {
    background: linear-gradient(135deg, #3f51b5, #2196f3);
    color: white;
    flex: 1;
}

.hwocr-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #303f9f, #1976d2);
}

.hwocr-btn-secondary {
    background: #757575;
    color: white;
    flex: 1;
}

.hwocr-btn-secondary:hover {
    background: #616161;
}

.hwocr-btn-small {
    padding: 10px 20px;
    font-size: 1em;
    min-width: auto;
    border-radius: 8px;
}

/* Progress */
.hwocr-progress-section {
    margin-bottom: 35px;
    padding: 25px;
    background: #f8f9ff;
    border-radius: 10px;
    border: 1px solid #e8eaf6;
}

.hwocr-progress-section h3 {
    color: #1a237e;
    font-size: 1.3em;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-container {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.progress-bar {
    height: 12px;
    background: #e8eaf6;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3f51b5, #2196f3);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 1em;
    color: #5f6368;
    font-weight: 500;
}

/* Results */
.hwocr-results-section {
    margin-top: 40px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 20px;
}

.results-header h3 {
    color: #1a237e;
    font-size: 1.4em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.results-content {
    background: white;
    border-radius: 10px;
    border: 1px solid #e8eaf6;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.text-preview-container {
    padding: 25px;
    max-height: 500px;
    overflow-y: auto;
    background: #f8f9ff;
}

.text-preview-container::-webkit-scrollbar {
    width: 10px;
}

.text-preview-container::-webkit-scrollbar-track {
    background: #f1f3f4;
}

.text-preview-container::-webkit-scrollbar-thumb {
    background: #c5cae9;
    border-radius: 5px;
}

.text-preview-container::-webkit-scrollbar-thumb:hover {
    background: #9fa8da;
}

.text-output {
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.7;
    color: #1a237e;
    white-space: pre-wrap;
    word-break: break-word;
}

.line-number {
    color: #9e9e9e;
    user-select: none;
    margin-right: 15px;
    font-size: 0.9em;
    display: inline-block;
    min-width: 40px;
}

.preview-options {
    padding: 18px 25px;
    background: #f8f9ff;
    border-top: 1px solid #e8eaf6;
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.preview-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #5f6368;
    cursor: pointer;
    font-size: 0.95em;
    user-select: none;
}

.preview-options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3f51b5;
}

/* Error */
.hwocr-error {
    margin-top: 25px;
    padding: 20px;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 10px;
    color: #c62828;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.error-close {
    background: none;
    border: none;
    color: #c62828;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.error-close:hover {
    background: rgba(198, 40, 40, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .hwocr-container {
        padding: 20px;
    }
    
    .hwocr-header h1 {
        font-size: 2.2em;
        flex-direction: column;
        gap: 10px;
    }
    
    .option-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .option-group {
        width: 100%;
    }
    
    #hwocr-format {
        width: 100%;
    }
    
    .hwocr-actions {
        flex-direction: column;
    }
    
    .hwocr-btn {
        width: 100%;
        min-width: 0;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .results-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .file-item {
        flex-wrap: wrap;
    }
    
    .file-info {
        padding-right: 0;
        margin-bottom: 10px;
    }
    
    .file-status {
        order: 3;
        margin: 0;
    }
    
    .file-remove {
        opacity: 1;
        order: 4;
    }
}

@media (max-width: 480px) {
    .hwocr-header h1 {
        font-size: 1.8em;
    }
    
    .hwocr-upload-area {
        padding: 40px 20px;
    }
    
    .upload-icon {
        font-size: 60px;
    }
    
    .preview-options {
        flex-direction: column;
        gap: 15px;
    }
}