﻿/* TextRead Page Styles */
.textreader-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.textreader-content {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.textreader-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

    .textreader-header h1 {
        margin: 0;
        font-size: 2.5rem;
        font-weight: 600;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .textreader-header p {
        margin: 0.5rem 0 0 0;
        font-size: 1.1rem;
        opacity: 0.9;
    }

/* Pop-out Button */
.popout-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    color: lightgray;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    backdrop-filter: blur(10px);
}

    .popout-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(255, 255, 255, 0.6);
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

.popout-icon {
    font-size: 1.5rem;
    line-height: 1;
    font-weight: bold;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    /*overflow-x: auto;*/
}

.tab-button {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 150px;
}

    .tab-button:hover {
        background: #f1f5f9;
        color: #475569;
    }

    .tab-button.active {
        color: #4f46e5;
        background: white;
    }

        .tab-button.active::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            right: 0;
            height: 2px;
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }

.tab-icon {
    font-size: 1.2rem;
}

.textreader-body {
    padding: 2rem;
}

/* Loading and Error States */
.state-message {
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
    color: #6b7280;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Text Analysis Section */
.text-analysis-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

.input-section, .output-section {
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.stat-item {
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.text-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.text-input {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    resize: vertical;
    transition: all 0.3s ease;
    flex: 1;
}

    .text-input:focus {
        outline: none;
        border-color: #4f46e5;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .text-input::placeholder {
        color: #9ca3af;
    }

.input-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.analysis-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-summarize {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

    .btn-summarize:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
    }

.btn-analyze {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
}

    .btn-analyze:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
    }

.btn-clear {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

    .btn-clear:hover {
        background: #e2e8f0;
        transform: translateY(-1px);
    }

.analysis-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Results Section */
.results-container {
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.results-tabs {
    display: flex;
    background: #e2e8f0;
    overflow-x: auto;
}

.result-tab {
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

    .result-tab:hover {
        background: #cbd5e1;
        color: #475569;
    }

    .result-tab.active {
        background: #f8fafc;
        color: #4f46e5;
        font-weight: 600;
    }

.result-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

.summary-text {
    line-height: 1.6;
    color: #334155;
    font-size: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.sentiment-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sentiment-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sentiment-icon {
    font-size: 3rem;
}

.sentiment-details {
    flex: 1;
}

.sentiment-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.sentiment-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Entities Display */
.entities-grid {
    display: grid;
    gap: 1rem;
}

.entity-card {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: start;
    gap: 0.75rem;
}

.entity-icon {
    font-size: 1.5rem;
    min-width: 2rem;
    text-align: center;
}

.entity-info {
    flex: 1;
}

.entity-text {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
}

.entity-category {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.entity-subcategory {
    font-size: 0.75rem;
    color: #9ca3af;
}

.confidence-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* PII Entities */
.pii-warning {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pii-entity-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

/* Extractive Summary */
.extractive-sentences {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sentence-item {
    background: white;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    line-height: 1.6;
    color: #334155;
    position: relative;
    padding-left: 2.5rem;
}

.sentence-number {
    position: absolute;
    left: 0.75rem;
    top: 1rem;
    width: 1.5rem;
    height: 1.5rem;
    background: #4f46e5;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* No Results State */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #6b7280;
    text-align: center;
    min-height: 300px;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-results-text {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.no-results-hint {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Processing State */
.processing-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    min-height: 400px;
}

.processing-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.processing-text {
    font-size: 1.1rem;
    color: #6b7280;
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

    .copy-btn:hover {
        background: #f1f5f9;
        color: #4f46e5;
        transform: scale(1.1);
    }

/* Drag and Drop Canvas (keeping original styles) */
.tab-content,
.image-canvas-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.image-canvas {
    width: 100%;
    min-height: 400px;
    border: 3px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    outline: none;
    z-index: 10;
    pointer-events: auto !important;
}

    .image-canvas:hover {
        border-color: #4f46e5;
        background: #f0f4ff;
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(79, 70, 229, 0.1);
    }

    .image-canvas:focus {
        border-color: #4f46e5;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    }

    .image-canvas.dragover {
        border-color: #10b981;
        background: #ecfdf5;
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    }

    .image-canvas.paste-ready {
        border-color: #f59e0b;
        background: #fffbeb;
        box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
    }

    .image-canvas.has-image {
        min-height: auto;
        border-style: solid;
        border-color: #e5e7eb;
    }

.canvas-placeholder {
    text-align: center;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

    .canvas-placeholder .icon {
        width: 64px;
        height: 64px;
        margin: 0 auto 1rem;
        background: #e5e7eb;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        color: #6b7280;
    }

    .canvas-placeholder h3 {
        margin: 0 0 0.5rem 0;
        color: #374151;
        font-size: 1.5rem;
        font-weight: 600;
    }

    .canvas-placeholder p {
        margin: 0;
        color: #6b7280;
        font-size: 1rem;
    }

    .canvas-placeholder .file-types {
        margin-top: 1rem;
        font-size: 0.875rem;
        color: #9ca3af;
    }

    .canvas-placeholder .paste-hint {
        margin-top: 0.5rem;
        font-size: 0.875rem;
        color: #7c3aed;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .canvas-placeholder .browse-btn {
        margin: 1rem 0;
        padding: 0.75rem 1.5rem;
        background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        align-self: center;
    }

        .canvas-placeholder .browse-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
        }

/* Image Preview */
.image-preview {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    border-radius: 8px;
}

.image-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.overlay-btn {
    background: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    transition: all 0.2s ease;
}

    .overlay-btn:hover {
        background: #f3f4f6;
        transform: scale(1.1);
    }

    .overlay-btn.remove:hover {
        background: #fee2e2;
        color: #dc2626;
    }

/* Hidden File Input */
.file-input {
    display: none;
}

/* Image Info Panel */
.image-info {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    border: 1px solid #e2e8f0;
}

    .image-info h4 {
        margin: 0 0 1rem 0;
        color: #334155;
        font-size: 1.1rem;
        font-weight: 600;
    }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

    .info-item:last-child {
        border-bottom: none;
    }

.info-label {
    font-weight: 500;
    color: #475569;
}

.info-value {
    color: #64748b;
    font-family: 'Courier New', monospace;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.textread-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.textread-btn-primary {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
}

    .textread-btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
    }

.textread-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

    .textread-btn-secondary:hover {
        background: #e2e8f0;
        transform: translateY(-1px);
    }

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading Spinner */
.textread-loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Paste Animation */
@keyframes pasteFlash {
    0% {
        background: #fffbeb;
        border-color: #f59e0b;
    }

    50% {
        background: #fef3c7;
        border-color: #d97706;
    }

    100% {
        background: #f9fafb;
        border-color: #d1d5db;
    }
}

.paste-flash {
    animation: pasteFlash 0.8s ease-out;
}


/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fed7aa;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.browse-btn-label {
    display: inline-block;
    padding: 10px 20px;
    background: #8b5cf6;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

    .browse-btn-label:hover {
        background: #7c3aed;
        transform: translateY(-2px);
    }

.file-input-ios {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* PDF Upload Styles */
.pdf-upload-section {
    margin-bottom: 1rem;
}

.pdf-upload-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdf-upload-label {
    flex: 1;
    display: block;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pdf-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.pdf-upload-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px dashed #3b82f6;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #3b82f6;
}

.pdf-upload-label:hover .pdf-upload-content {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.pdf-upload-content span:first-child {
    font-size: 1.5rem;
}

.pdf-remove-btn {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

    .pdf-remove-btn:hover {
        background: #fecaca;
        transform: scale(1.1);
    }

.upload-divider {
    text-align: center;
    margin: 1rem 0;
    position: relative;
    color: #9ca3af;
}

    .upload-divider::before,
    .upload-divider::after {
        content: '';
        position: absolute;
        top: 50%;
        width: 45%;
        height: 1px;
        background: #e5e7eb;
    }

    .upload-divider::before {
        left: 0;
    }

    .upload-divider::after {
        right: 0;
    }

    .upload-divider span {
        background: white;
        padding: 0 1rem;
        position: relative;
        font-size: 0.875rem;
        font-weight: 500;
    }

.pdf-indicator {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white !important;
    font-weight: 600;
}

/* Disabled state for textarea when PDF is loaded */
.text-input:disabled {
    background: #f9fafb;
    cursor: not-allowed;
    opacity: 0.7;
}


/* Input Section */

/* Responsive Design */
@media (max-width: 1024px) {
    .text-analysis-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .textreader-container {
        padding: 1rem;
    }

    .textreader-header {
        padding: 1.5rem;
    }

        .textreader-header h1 {
            font-size: 2rem;
        }

    .textreader-body {
        padding: 1rem;
    }

    .image-canvas {
        min-height: 300px;
    }

    .canvas-placeholder {
        padding: 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .textread-btn {
        justify-content: center;
    }

    .tab-navigation {
        flex-direction: column;
    }

    .tab-button {
        text-align: left;
        justify-content: flex-start;
    }

    .input-actions {
        flex-direction: column;
    }

    .results-tabs {
        flex-wrap: wrap;
    }
}

/* Success Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* Progress Bar Styles */
.progress-bar-container {
    width: 80%;
    max-width: 400px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 1rem auto 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

.processing-overlay .processing-text {
    margin-top: 1rem;
    min-height: 1.5rem;
}