/* ========================================
   PaperReview.com - Dashboard Styles
   Clean Maroon Theme
   ======================================== */

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-secondary);
}

/* Icon Styling */
.nav-item-icon {
    width: 18px;
    height: 18px;
}

.stat-card-icon i {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.dropzone-icon i {
    width: 28px;
    height: 28px;
    color: var(--primary);
}

.ai-detection-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.recommendation-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.empty-state-icon i {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.history-icon i {
    width: 20px;
    height: 20px;
    color: #ef4444;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center the logo */
    margin-bottom: 32px;
    padding: 0 8px;
}

.sidebar-logo .logo-icon {
    width: auto;
    height: auto;
    max-width: 180px;
    /* Limit width to fit sidebar */
    max-height: 60px;
    /* Limit height */
    background: transparent;
    /* Remove background color */
    border-radius: 0;
    /* Remove border radius */
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
}

.nav-section {
    margin-bottom: 28px;
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding: 0 12px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item-icon {
    font-size: 1.1rem;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg-secondary);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-plan {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 28px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card-icon {
    width: 42px;
    height: 42px;
    background: rgba(139, 21, 56, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Upload Section */
.upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.upload-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
}

.upload-card h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.upload-card>p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 40px 24px;
    text-align: center;
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    background: var(--bg-secondary);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(139, 21, 56, 0.02);
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    background: rgba(139, 21, 56, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: var(--primary);
}

.dropzone-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* File Preview */
.file-preview {
    display: none;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 20px;
}

.file-preview.show {
    display: flex;
}

.file-icon {
    width: 42px;
    height: 42px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    transition: color var(--transition-fast);
}

.file-remove:hover {
    color: var(--error);
}

/* Analyze Button */
.analyze-btn {
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    font-size: 0.95rem;
}

.analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Progress Section (Removed) */

/* Results Card */
.results-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    display: none;
}

.results-card.show {
    display: block;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
}

.results-title {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.results-file {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.results-score {
    text-align: right;
}

.score-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: conic-gradient(var(--success) 0deg calc(var(--score, 85) * 3.6deg),
            var(--border-color) calc(var(--score, 85) * 3.6deg) 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.score-inner {
    width: 58px;
    height: 58px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Result Metrics */
.result-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.metric-item {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 16px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.metric-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.metric-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 100px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    border-radius: 100px;
}

.metric-bar-fill.excellent {
    background: var(--success);
}

.metric-bar-fill.good {
    background: var(--primary);
}

.metric-bar-fill.warning {
    background: var(--warning);
}

.metric-bar-fill.danger {
    background: var(--error);
}

/* AI Detection Section */
.ai-detection {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.ai-detection-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.ai-detection-icon {
    font-size: 1.25rem;
}

.ai-detection-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ai-detection-result {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-percentage {
    font-size: 2rem;
    font-weight: 700;
}

.ai-percentage.low {
    color: var(--success);
}

.ai-percentage.medium {
    color: var(--warning);
}

.ai-percentage.high {
    color: var(--error);
}

.ai-status {
    flex: 1;
}

.ai-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.ai-status-badge.pass {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.ai-status-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.ai-status-badge.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.ai-status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Recommendations */
.recommendations {
    margin-top: 20px;
}

.recommendations h4 {
    font-size: 0.95rem;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.recommendation-list {
    list-style: none;
}

.recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin-bottom: 10px;
}

.recommendation-icon {
    font-size: 1.1rem;
}

.recommendation-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Action Buttons */
.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.result-actions .btn {
    flex: 1;
}

/* History Section */
.history-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.history-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.history-item:hover {
    border-color: var(--primary);
    background: white;
}

.history-icon {
    width: 40px;
    height: 40px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.history-info {
    flex: 1;
}

.history-name {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-score {
    text-align: right;
}

.history-score-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success);
}

.history-score-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-icon i {
    width: 48px;
    height: 48px;
}

/* Paper Item Meta and Status Badges */
.paper-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.paper-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.paper-status-badge.ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.paper-status-badge.processing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    animation: pulse 1.5s infinite;
}

.paper-status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.empty-state-text {
    font-size: 0.9rem;
}

/* Responsive Dashboard */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .upload-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .result-metrics {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }
}

/* ========================================
   Review Tabs Section
   ======================================== */
.review-sections {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

/* Tabs Navigation */
.review-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.review-tab {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.review-tab:hover {
    background: white;
    color: var(--text-primary);
}

.review-tab.active {
    background: var(--primary);
    color: white;
}

/* Tab Content */
.review-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.review-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Header */
.review-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.review-section-icon {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

.review-section-header.strengths .review-section-icon {
    color: var(--success);
}

.review-section-header.weaknesses .review-section-icon {
    color: var(--warning);
}

.review-section-header.detailed .review-section-icon {
    color: #3b82f6;
}

.review-section-header.questions .review-section-icon {
    color: #8b5cf6;
}

.review-section-header.assessment .review-section-icon {
    color: var(--primary);
}

.review-section-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Section Body */
.review-section-body {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.review-section-body p {
    margin-bottom: 12px;
    text-align: justify;
}

.review-section-body p:last-child {
    margin-bottom: 0;
}

.review-section-body ul,
.review-section-body ol {
    padding-left: 0;
    margin: 0;
}

.review-section-body>ul>li {
    list-style: none;
    margin-bottom: 16px;
}

.review-section-body>ul>li>strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
}

.review-section-body ul ul {
    padding-left: 20px;
    margin-top: 8px;
}

.review-section-body ul ul>li {
    list-style: disc;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.review-section-body ol {
    padding-left: 24px;
}

.review-section-body ol li {
    margin-bottom: 10px;
}

.review-section-body strong {
    color: var(--text-primary);
}

/* ========================================
   View Reviews Section
   ======================================== */
.view-reviews-section {
    padding: 0;
}

.reviews-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    min-height: calc(100vh - 140px);
}

/* Paper Selection Sidebar */
.paper-selection {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 28px;
}

.paper-selection-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.paper-selection-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.paper-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.paper-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.paper-item:hover {
    border-color: var(--primary);
    background: white;
}

.paper-item.active {
    border-color: var(--primary);
    background: rgba(139, 21, 56, 0.05);
}

.paper-item-icon {
    width: 40px;
    height: 40px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.paper-item-icon i {
    width: 20px;
    height: 20px;
    color: #ef4444;
}

.paper-item-info {
    flex: 1;
    min-width: 0;
}

.paper-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.paper-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.paper-item-score {
    text-align: center;
}

.paper-item-score-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--success);
}

.paper-item-score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Review Display */
.review-display {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    min-height: 500px;
}

.review-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.placeholder-icon i {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
}

.review-placeholder h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.review-placeholder p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Full Review Display */
.full-review {
    animation: fadeIn 0.3s ease;
}

.review-paper-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.paper-icon {
    width: 56px;
    height: 56px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paper-icon i {
    width: 28px;
    height: 28px;
    color: #ef4444;
}

.paper-details {
    flex: 1;
}

.paper-details h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.paper-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.paper-score {
    text-align: center;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.paper-score .score-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--success);
}

.paper-score .score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.review-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 992px) {

    .reviews-layout,
    .detection-layout {
        grid-template-columns: 1fr;
    }

    .paper-selection {
        position: static;
    }
}

/* ========================================
   AI Detection Section
   ======================================== */
.ai-detection-section {
    padding: 0;
    height: calc(100vh - 80px);
    /* Full viewport minus header space */
    overflow: hidden;
}

.detection-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    height: 100%;
    /* Fill full height */
    min-height: unset;
}

.ai-paper-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

.detection-display {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detection-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.detection-paper-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

/* AI Score Overview */
.ai-score-overview {
    display: flex;
    gap: 32px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.ai-score-main {
    flex-shrink: 0;
}

.ai-score-circle {
    position: relative;
    width: 140px;
    height: 140px;
}

.ai-score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ai-score-circle circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.ai-score-bg {
    stroke: #e5e7eb;
}

.ai-score-fill {
    stroke: var(--success);
    stroke-dasharray: 283;
    stroke-dashoffset: 240;
    transition: stroke-dashoffset 0.5s ease;
}

.ai-score-fill.warning {
    stroke: var(--warning);
}

.ai-score-fill.danger {
    stroke: var(--error);
}

.ai-score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ai-score-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ai-score-details {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.ai-detail-item {
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
}

.ai-detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ai-detail-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-detail-value.ai-text {
    color: var(--error);
}

.ai-detail-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}

.ai-detail-badge.pass {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.ai-detail-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.ai-detail-badge.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* Document Preview */
.document-preview {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.document-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.document-preview-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
}

.legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.human {
    background: #10b981;
}

.legend-color.ai {
    background: #ef4444;
}

.legend-color.mixed {
    background: #f59e0b;
}

.document-content {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.doc-section {
    margin-bottom: 24px;
}

.doc-section:last-child {
    margin-bottom: 0;
}

.doc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.section-ai-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 100px;
}

.section-ai-badge.human {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.section-ai-badge.ai {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.section-ai-badge.mixed {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.doc-text {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    line-height: 1.7;
    border-left: 4px solid;
}

.doc-text:last-child {
    margin-bottom: 0;
}

.doc-text.human {
    background: rgba(16, 185, 129, 0.05);
    border-left-color: #10b981;
    color: var(--text-secondary);
}

.doc-text.ai {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: #ef4444;
    color: var(--text-secondary);
}

.doc-text.mixed {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: #f59e0b;
    color: var(--text-secondary);
}

.detection-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   Manual Text AI Detection Styles
   ======================================== */

/* Mode Toggle */
.upload-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 10px;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Text Input Section */
.text-input-section {
    margin-top: 0;
}

.text-input-wrapper {
    margin-bottom: 20px;
}

.text-input-wrapper label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.text-input-wrapper textarea {
    width: 100%;
    min-height: 180px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s ease;
    background: var(--bg-secondary);
    box-sizing: border-box;
}

.text-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.text-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.text-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Text Detection Results */
.text-detection-results {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
}

.text-results-header {
    margin-bottom: 20px;
}

.text-results-header h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

/* AI Score Display */
.text-ai-score {
    display: flex;
    gap: 32px;
    align-items: center;
    padding: 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
}

.text-score-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.text-score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.text-score-circle .score-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.text-score-circle .score-fill {
    fill: none;
    stroke: var(--success);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease, stroke 0.3s ease;
}

.text-score-circle .score-fill.warning {
    stroke: var(--warning);
}

.text-score-circle .score-fill.fail {
    stroke: var(--error);
}

.text-score-circle .score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.text-score-circle .score-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.text-score-circle .score-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.text-score-details {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.score-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.score-detail-item .detail-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.score-detail-item .detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.score-detail-item .detail-value.ai-text {
    color: var(--error);
}

.score-detail-item .detail-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.score-detail-item .detail-badge.pass {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.score-detail-item .detail-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.score-detail-item .detail-badge.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* Segments Breakdown */
.segments-breakdown {
    margin-top: 20px;
}

.segments-breakdown h5 {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.segments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.segment-item {
    padding: 14px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--border-color);
}

.segment-item.human {
    border-left-color: var(--success);
}

.segment-item.ai {
    border-left-color: var(--error);
}

.segment-item.mixed {
    border-left-color: var(--warning);
}

.segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.segment-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.segment-badge.human {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.segment-badge.ai {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.segment-badge.mixed {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.segment-prob {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.segment-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading State */
.text-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.text-loading p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ========================================
   History Panel Toggle & Detection Results
   ======================================== */

.history-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.history-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 3px;
    border-radius: 8px;
}

.history-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-mode-btn:hover {
    color: var(--text-primary);
}

.history-mode-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Detection Panel in History Column */
.history-detection-panel {
    height: 100%;
}

.detection-panel-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.detection-panel-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 16px;
}

.detection-panel-loading p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.detection-panel-results {
    padding: 0;
}

/* Panel Score Section */
.panel-score-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 16px;
}

.panel-score-circle {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 12px;
}

.panel-score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.panel-score-circle .score-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.panel-score-circle .score-fill {
    fill: none;
    stroke: var(--success);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease, stroke 0.3s ease;
}

.panel-score-circle .score-fill.warning {
    stroke: var(--warning);
}

.panel-score-circle .score-fill.fail {
    stroke: var(--error);
}

.panel-score-circle .score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.panel-score-circle .score-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-score-circle .score-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
}

.panel-status-badge {
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.panel-status-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.panel-status-badge.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* Panel Stats */
.panel-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.panel-stat {
    text-align: center;
    padding: 10px 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.panel-stat .stat-label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.panel-stat .stat-value {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-stat .stat-value.ai {
    color: var(--error);
}

/* Panel Segments */
.panel-segments {
    margin-bottom: 16px;
}

.panel-segments h5 {
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.panel-segments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.panel-segment-item {
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--border-color);
}

.panel-segment-item.human {
    border-left-color: var(--success);
}

.panel-segment-item.ai {
    border-left-color: var(--error);
}

.panel-segment-item.mixed {
    border-left-color: var(--warning);
}

.panel-segment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.panel-segment-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 600;
}

.panel-segment-badge.human {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.panel-segment-badge.ai {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.panel-segment-badge.mixed {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.panel-segment-prob {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.panel-segment-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8rem;
}

/* ========================================
   PDF Viewer Styles
   ======================================== */

.pdf-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.pdf-loading-state p {
    margin-top: 16px;
    font-size: 0.9rem;
}

.pdf-viewer-container {
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.08);
}

.highlighted-pdf-viewer {
    background: white;
}

.pdf-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: 8px;
    text-align: center;
}

.pdf-placeholder .placeholder-icon {
    margin-bottom: 16px;
}

.pdf-placeholder .placeholder-icon i {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.pdf-placeholder p {
    font-size: 0.9rem;
    max-width: 300px;
    line-height: 1.5;
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Detection Actions */
.detection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

/* ========================================
   AI Detection Upload Zone
   ======================================== */

.ai-upload-zone {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.ai-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-dropzone:hover,
.ai-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(139, 21, 56, 0.05);
}

.ai-dropzone-icon {
    width: 48px;
    height: 48px;
    background: rgba(139, 21, 56, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--primary);
}

.ai-dropzone-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ai-dropzone-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ai-file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.ai-file-icon {
    width: 36px;
    height: 36px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-file-info {
    flex: 1;
    min-width: 0;
}

.ai-file-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ai-file-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.ai-file-remove:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.paper-list-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.paper-list-divider::before,
.paper-list-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.paper-list-divider span {
    padding: 0 12px;
}

.paper-selection-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========================================
   Status Badges (for paper lists and history)
   ======================================== */
.paper-status-badge,
.history-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.paper-status-badge.processing,
.history-status-badge.processing {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.paper-status-badge.ready,
.history-status-badge.ready {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.paper-status-badge.error,
.history-status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* Status badge with icon */
.history-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-status-badge i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Spinning loader icon for Under Review status */
.spin-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* History item styles */
.history-item-icon {
    width: 36px;
    height: 36px;
    background: rgba(139, 21, 56, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.history-item-icon i {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-venue {
    font-size: 0.7rem;
    color: var(--primary);
    background: rgba(139, 21, 56, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Small loading spinner for buttons */
.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 6px;
}

/* ========================================
   Detection Layout Improvements
   ======================================== */

.detection-layout-grid {
    display: flex;
    gap: 32px;
    /* Increased gap for better separation */
    align-items: flex-start;
    height: calc(100vh - 140px);
    /* Fill remaining height */
    overflow: hidden;
    /* Prevent body scroll if possible */
}

.ai-score-overview {
    flex: 0 0 240px;
    /* Reduced width */
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    /* Full height */
    overflow-y: auto;
    /* Scrollable if needed */
}

.ai-score-main {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.ai-score-details {
    width: 100%;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    /* Subtle background for details */
    border-radius: 8px;
    padding: 12px;
}

.ai-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    /* More compact */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-detail-item:last-child {
    border-bottom: none;
}

.ai-detail-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.ai-detail-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.ai-detail-value.ai-text {
    color: #ef4444;
}

.document-preview {
    flex: 1;
    min-width: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Full height */
    overflow: hidden;
}

.document-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: white;
}

.document-preview-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.pdf-viewer-container {
    flex: 1;
    background: #f3f4f6;
    /* Darker background for PDF contrast */
    padding: 0;
    overflow: hidden;
    position: relative;
    min-height: 0;
    height: 100%;
}

.highlighted-pdf-viewer {
    width: 100%;
    height: 100% !important;
    /* Force full height */
    border: none;
    display: block;
}

/* Ensure legend is visible */
.legend {
    display: flex;
    gap: 16px;
}

.pdf-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
}

/* ========================================
   New AI Detection Layout (Top Bar Override)
   ======================================== */

.detection-display {
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.full-detection {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Merged Header Styles */
.detection-paper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}

.paper-details {
    flex: 1;
    min-width: 0;
    /* truncate text */
}

/* Professional AI Score */
.ai-score-professional {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 280px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.ai-score-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: -0.2px;
}

.ai-score-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.ai-score-badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.ai-score-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.ai-score-badge.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.ai-score-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-score-bar-bg {
    flex: 1;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.ai-score-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-score-percentage {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e293b;
    min-width: 45px;
    text-align: right;
    letter-spacing: -0.5px;
}

/* Legacy styles - hide old ring */
.ai-score-compact,
.ai-score-ring,
.ai-score-val,
.ai-score-labels,
.ai-label-title {
    display: none !important;
}

/* Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Document Preview */
.document-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 20px;
    /* Space between header and PDF */
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: white;
}

/* Hide old styles */
.ai-score-overview,
.detection-layout-grid,
.detection-actions-inline {
    display: none !important;
}

/* ========================================
   Review Paper Header Styles 
   ======================================== */

.review-paper-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 24px;
}

.review-paper-header .paper-icon {
    width: 48px;
    height: 48px;
    background: rgba(139, 21, 56, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.review-paper-header .paper-details {
    flex: 1;
}

.review-paper-header .paper-details h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.review-paper-header .paper-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.paper-actions-header {
    margin-left: auto;
}

.detection-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    min-height: calc(100vh - 140px);
}

.detection-display {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    min-height: 500px;
}

.detection-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}