/* Modern CSS Reset & Variables */
:root {
    /* Colors */
    --primary: #770063;
    --primary-light: #a6008b;
    --primary-dark: #560048;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #06b6d4;

    /* Grays */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Borders */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, #ffffff 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Enhanced Navigation Header */
.nav-header {
    background: #fdfdfd;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-xl);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo-img {
    height: 100px;
    width: auto;
    object-fit: contain;
    margin-left: -50px;
}

.logo-text {
    margin-left: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
  font-size: clamp(2.1rem, 3.2vw, 2.8rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.05;
  margin: 0;

  /* nicer look */
  letter-spacing: -0.02em;
  text-shadow: 0 1px 0 rgba(0,0,0,0.06);
}


.brand-subtitle {
  font-size: 0.9rem;
  color: var(--gray-500);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-top: 4px;
}


.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-right: 10px;
}

.info-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.info-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.logout-button {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.logout-button:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Enhanced Info Modal */
.info-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    overflow-y: auto;
    padding: var(--space-xl);
}

.info-modal-content {
    background: white;
    max-width: 800px;
    margin: var(--space-xl) auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(2rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--primary);
    color: white;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin: 0;
}

.close-modal {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: var(--space-lg);
}

.info-section {
    margin-bottom: var(--space-lg);
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.intro-text {
    font-size: 1.125rem;
    color: var(--gray-600);
    line-height: 1.7;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.step-content strong {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-xs);
}

.step-content p {
    color: var(--gray-600);
    font-size: 0.875rem;
}

.format-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius-md);
    width: fit-content;
}

.tab-btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    color: var(--gray-600);
}

.tab-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.code-example {
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.code-example pre {
    padding: var(--space-lg);
    margin: 0;
    overflow-x: auto;
}

.code-example code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: #e2e8f0;
    line-height: 1.6;
}

.criteria-ellipsis {
    cursor: help;
    font-weight: 600;
    margin-left: 4px;
}

/* Tiny white capsule button for failed-criteria popover */
.criteria-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    min-width: 28px;
    height: 22px;
    border-radius: 9999px;
    background: #fff;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

.criteria-btn:hover {
    box-shadow: var(--shadow-md);
}

.criteria-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

/* Anchored popover (no page-dim) */
.criteria-popover {
    position: absolute;
    z-index: 2500;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 420px;
    /* tweak: square/rect size */
    max-width: calc(100vw - 32px);
    padding: 12px 14px;
}

.criteria-popover h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: var(--gray-800);
}

.criteria-popover ul {
    margin: 6px 0 0 18px;
    padding: 0;
}

.criteria-popover .close-popover {
    position: absolute;
    top: 6px;
    right: 8px;
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--gray-500);
}

.criteria-content {
    background: #fff;
    padding: 20px;
    margin: 80px auto;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.criteria-content h3 {
    margin-top: 0;
}

.close-btn {
    float: right;
    cursor: pointer;
    font-size: 22px;
    color: #666;
}

#downloadExcelBtn {
    margin-left: 72vw;
    margin-bottom: 15px;
    min-width: auto;
    min-height: auto;
    padding: 10px 16px;
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    position: relative;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1350px;
    padding-top: 30px;
}

/* Hero Section */
.hero-section {
    text-align: center;
}

.hero-title {
    font-size: 38px;
    font-weight: 700;
    line-height: 1.1;
    margin-top: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--gray-600);
    max-width: 700px;
    margin: 0 auto var(--space-lg);
    line-height: 1.6;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.section-header p {
    font-size: 1.125rem;
    color: var(--gray-600);
}

/* Enhanced Mode Selection */
.mode-section {
    margin-bottom: var(--space-3xl);
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
    max-width: 800px;
    margin: 0 auto;
}

.mode-card {
    position: relative;
    padding: var(--space-2xl);
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: var(--shadow-sm);
    max-height: 250px;
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.mode-card.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.mode-icon {
    width: 64px;
    height: 64px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
    transition: all 0.3s ease;
}

.mode-card.active .mode-icon {
    background: rgba(255, 255, 255, 0.2);
}

.mode-icon i {
    font-size: 1.5rem;
    color: var(--primary);
}

.mode-card.active .mode-icon i {
    color: white;
}

.mode-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.mode-card p {
    color: var(--gray-600);
    line-height: 1.2;
}

.mode-card.active p {
    color: rgba(255, 255, 255, 0.9);
}

.mode-indicator {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gray-200);
    transition: all 0.3s ease;
}

.mode-card.active .mode-indicator {
    background: var(--success);
}

.mode-card.active .mode-indicator::after {
    content: '✓';
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Enhanced Upload Section */
.upload-section {
    margin-bottom: var(--space-xl);
}

.upload-area {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: var(--space-xl) var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    transform: scale(1.02);
}

.upload-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--gray-800);
}

.upload-content p {
    color: var(--gray-600);
    margin-bottom: var(--space-lg);
}

.upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
}

.upload-icon i {
    font-size: 2rem;
    color: white;
}

.supported-formats {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
}

.format-badge {
    padding: var(--space-xs) var(--space-sm);
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    background: var(--success);
    color: white;
    border-radius: var(--radius-lg);
    margin-top: var(--space-lg);
}

.file-details {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.file-details i {
    font-size: 1.5rem;
}

.file-text {
    display: flex;
    flex-direction: row;
}

.file-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.file-size {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-left: 10px;
}

.remove-file {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-file:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Enhanced Action Buttons */
.actions-section {
    margin-bottom: var(--space-3xl);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    overflow: hidden;
    min-width: 200px;
    min-height: 60px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.8s ease;
}

.btn-primary:hover .btn-shine {
    left: 100%;
}

/* Enhanced Progress Section */
.progress-section {
    margin-bottom: var(--space-md);
    text-align: center;
}

.progress-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.progress-header p {
    color: var(--gray-600);
    margin-bottom: var(--space-2xl);
}

.progress-wrapper {
    max-width: 500px;
    margin: 0 auto;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: var(--space-md);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--info) 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.progress-text {
    position: absolute;
    top: 50%;
    right: var(--space-sm);
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.progress-stats {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    padding: var(--space-2xl);
}

.loading-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid var(--gray-200);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-lg);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

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

.loading-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-sm);
}

.loading-content p {
    color: var(--gray-600);
}

/* Enhanced Results Table */
.results-section {
    margin-bottom: var(--space-3xl);
}

.table-container {
    background: white;
    border-radius: var(--radius-xl);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-200);
}

/* Editable cells */

#questionsTable [contenteditable] {
    min-height: 40px;
    padding: var(--space-sm);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    line-height: 1.5;
}

#questionsTable [contenteditable]:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

#questionsTable [contenteditable]:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Status badges */
.verification-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pending {
    background: var(--warning);
    color: white;
}

.status-verified {
    background: var(--success);
    color: white;
}

.status-failed {
    background: var(--error);
    color: white;
}

.status-pending::before {
    content: '⏳ ';
}

.status-verified::before {
    content: '✅ ';
}

.status-failed::before {
    content: '❌ ';
}

.btn-add-row:hover {
    background: var(--success);
    color: white;
}

.btn-delete-row:hover {
    background: var(--error);
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        padding: var(--space-md);
    }

    .brand-subtitle {
        display: none;
    }

    .logout-button span {
        display: none;
    }

    .main-content {
        padding: 0 var(--space-md);
    }

    .hero-section {
        padding: var(--space-2xl) 0;
    }

    .mode-cards {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .table-container {
        overflow-x: auto;
    }

    #questionsTable {
        min-width: 800px;
    }
}

@media (max-width: 480px) {

    .modal-header,
    .modal-body {
        padding: var(--space-lg);
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    .upload-area {
        padding: var(--space-2xl) var(--space-md);
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results-section {
    animation: fadeInUp 0.5s ease;
}

.progress-section {
    animation: fadeInUp 0.5s ease;
}

/* Focus styles for accessibility */
button:focus-visible,
.mode-card:focus-visible,
.upload-area:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {

    .nav-header,
    .hero-section,
    .mode-section,
    .upload-section,
    .actions-section,
    .progress-section,
    .app-footer {
        display: none;
    }

    .results-section {
        margin: 0;
    }

    .table-container {
        box-shadow: none;
        border: 1px solid #000;
    }
}


/* new question table style*/
.results-section {
    margin-bottom: var(--space-3xl);
}

#questionsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.1rem;
    border: 1px solid var(--gray-300);
}

#questionsTable th {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-200) 100%);
    color: var(--gray-700);
    font-weight: 600;
    padding: var(--space-lg);
    text-align: left;
    border: 1px solid var(--gray-300);
    vertical-align: top;
    position: sticky;
    top: 0;
    z-index: 10;
}

#questionsTable td {
    padding: var(--space-md);
    border: 1px solid var(--gray-300);
    vertical-align: top;
}

#questionsTable td:last-child {
    border-bottom: none;
    border-left: none;
    border-right: none;
}

#questionsTable tr:hover {
    background: var(--gray-50);
}

#questionsTable tr:last-child td {
    border-bottom: none;
}

/* Status pills */
.verification-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: .75rem;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.verification-status.status-pending {
    background: #f1f5f9;
    color: #475569;
}

.verification-status.status-verified {
    background: rgba(34, 197, 94, .12);
    color: #16a34a;
}

.verification-status.status-failed {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
}

/* Row action buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-buttons button {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}

.action-buttons button:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}

.action-buttons button:active {
    transform: translateY(1px);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification {
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 14px;
    line-height: 1.4;
    border-radius: var(--radius-lg, 8px);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    padding: 4px;
    margin-left: auto;
}

.notification-close:hover {
    opacity: 1;
}

.confirm-backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.confirm-content {
    background: white;
    border-radius: var(--radius-xl, 12px);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgb(0 0 0 / 0.1));
    max-width: 500px;
    width: 90%;
    position: relative;
    z-index: 1;
    animation: modalSlideUp 0.3s ease;
}

.confirm-header {
    padding: 24px 24px 0;
}

.confirm-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800, #1e293b);
}

.confirm-body {
    padding: 16px 24px 24px;
}

.confirm-body p {
    margin: 0;
    color: var(--gray-600, #64748b);
    line-height: 1.6;
}

.confirm-actions {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.editing {
    background-color: rgba(37, 99, 235, 0.05) !important;
    border-color: rgba(37, 99, 235, 0.3) !important;
}

.result-error {
    color: red;
    text-align: center;
    padding: 12px 20px;
    font-weight: 500;
}

.warn-text {
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 1rem 0;
}

.correct-answer-cell .ca-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.correct-answer-cell .ca-user {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ca-verdict {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
}

.ans-correct {
    background: #e6ffed;
    color: #0f7b2d;
    border: 1px solid #b7f5c6;
}

.ans-conflict {
    background: #fff2f0;
    color: #a71d2a;
    border: 1px solid #ffd4cf;
}

.ans-none {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

/* Mini chatbot */
.mini-bot-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    z-index: 2100;
    display: grid;
    place-items: center;
}

.mini-bot-toggle:hover {
    background: var(--primary-dark);
}

.mini-bot {
    position: fixed;
    right: 20px;
    bottom: 88px;
    width: 420px;
    max-height: 70vh;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    display: none;
    z-index: 2100;
    overflow: hidden;
}

.mini-bot.open {
    display: block;
}

.mini-bot__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.mini-bot__tabs {
    display: flex;
    gap: 6px;
}

.mini-bot__tab {
    border: none;
    background: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
}

.mini-bot__tab.active {
    background: var(--primary);
    color: #fff;
}

.mini-bot__close {
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
}

.mini-bot__body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-bot__hint {
    display: none;
    gap: 8px;
    align-items: center;
    font-size: .9rem;
    color: var(--gray-600);
}

.mini-bot__input {
    width: 100%;
    min-height: 112px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 10px;
    resize: vertical;
}

.mini-bot__actions {
    display: flex;
    gap: 10px;
}

.mini-bot__preview {
    border: 1px dashed var(--gray-300);
    border-radius: 10px;
    padding: 10px;
    max-height: 220px;
    overflow: auto;
    font-size: .92rem;
    background: #fff;
}

@media (max-width: 560px) {
    .mini-bot {
        right: 12px;
        left: 12px;
        width: auto;
    }
}

/* Row selection highlight in preview table */
#questionsTable tr.selected-row td {
    box-shadow: inset 0 0 0 2px var(--primary);
    background: #fff7ff;
}

/* Small badge to show selected row index in the bot (optional) */
.mini-bot__hint.show {
    display: flex;
}

/* --- Upload Page Mini Chat Styling (match Results page) --- */
.mini-chat {
    position: fixed;
    bottom: 88px;
    right: 20px;
    width: 420px;
    max-height: 70vh;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2100;
}

.mini-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    font-weight: 600;
}

.mini-chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: var(--gray-50);
}

/* --- Compact chat input & button (identical to Results page look) --- */
.mini-chat-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid var(--gray-200);
    background: #fff;
}

.mini-chat-input input {
    flex: 1;
    height: 38px;
    border: 1px solid var(--gray-300);
    border-radius: 999px;
    padding: 0 14px;
    font-size: 0.9rem;
    color: var(--gray-800);
    background: #fff;
    transition: all 0.2s ease;
}

.mini-chat-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(119, 0, 99, 0.15);
}

.mini-chat-input .btn {
    min-height: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.mini-chat-input .btn i {
    font-size: 0.9rem;
}

.mini-chat-input .btn:hover {
    background: #6b0060;
    transform: translateY(-1px);
}

.mini-chat-input .btn:active {
    transform: translateY(0);
}

/* Chat bubbles (same as Results page) */
.chat-row {
    display: flex;
    margin-bottom: 8px;
}

.chat-row.right {
    justify-content: flex-end;
}

/* --- Image Comment popover --- */
.image-comment-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    margin-top: 4px;
    color: #8ab4f8;
    margin-left: 6px;
    line-height: 1;
}

.image-comment-btn:hover {
    color: #c3e1ff;
}

.criteria-popover.image-comment {
    max-width: 300px;
}

.criteria-popover.image-comment h3 {
    font-size: 14px;
    margin-bottom: 6px;
}

.criteria-popover.image-comment p {
    font-size: 13px;
    line-height: 1.4;
    color: #111;
}

/* small horizontal row under the pill */
.status-actions {
    margin-top: 6px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

/* (optional) match sizing of the buttons if needed */
.status-actions .criteria-btn,
.status-actions .image-comment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-muted, #e5e7eb);
    background: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    line-height: 1.2;
    cursor: pointer;
}

.status-actions .image-comment-btn i {
    font-size: 14px;
}

/* --- AI Model selector (Upload header) --- */
.model-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--gray-200);
    background: #fff;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

.model-select i {
    color: var(--primary);
    font-size: 0.95rem;
}

.model-dropdown {
    border: none;
    outline: none;
    background: transparent;
    font-weight: 600;
    color: var(--gray-800);
    cursor: pointer;
    padding-right: 2px;
}

.model-dropdown:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 8px;
}

.mini-chat-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    width: 100%;
}

.mini-chat-input-row {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.mini-chat-input-row #miniChatText {
    flex: 1 1 auto;
    min-width: 0;
    /* IMPORTANT: allows flex item to shrink without overflow */
}

/* keep send button fixed size so textbox uses the rest */
.mini-chat-input-row #miniChatSend {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.mini-chat-file-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, .15);
    background: #fff
}

.mini-chat-file-btn:hover {
    filter: brightness(.98)
}

.mini-chat-drag-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    border-radius: 16px
}

.mini-chat-drag-overlay.hidden {
    display: none
}

/* Only show file UI when .mini-chat supports it (Results: only in new mode; Upload: always) */
.mini-chat[data-filemode="off"] .mini-chat-file-btn,
.mini-chat[data-filemode="off"] #miniChatFileContainer {
    display: none
}

/* --- MiniChat attached file chip (Results) --- */
.mini-file-chip{
  position: relative;                 /* anchor the X */
  overflow: visible;                  /* allow X to sit outside pill border */
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 8px 30px 8px 12px;         /* reserve space on right for X */
  border-radius: 14px;                /* not a full capsule; looks closer to your example */
  border: 1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.85);
  font-size: 12px;
  max-width: 100%;
}

.mini-file-chip span{
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

/* the remove X (top-right, slightly outside the border like your 3rd pic) */
.mini-file-chip .x {
  position: absolute;
  top: -7px;
  right: -7px;

  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;

  background: #ef4444;
  color: #fff;

  font-size: 14px;
  font-weight: 700;

  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;          /* NOT px-based */

  padding: 0;
  z-index: 10;
  cursor: pointer;

  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.mini-file-chip .x:hover{
  filter: brightness(0.95);
}

/* ---- File chips shown inside the chat log (sent attachments) ---- */
.mini-msg-files{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.mini-msg-file-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;

  padding:8px 12px;
  border-radius:999px;
  background:#770063;
  font-size:14px;
  max-width: 100%;
}

.mini-msg-file-chip span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 240px;
}

/* --- MiniChat header tools (expand/close buttons) --- */
.mini-chat-tools{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mini-chat-iconbtn{
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  background: rgba(255,255,255,0.18);
  transition: background .15s ease, transform .15s ease;
}

.mini-chat-iconbtn:hover{
  background: rgba(255,255,255,0.28);
  transform: translateY(-1px);
}

.mini-chat-iconbtn:active{
  transform: translateY(0);
}

/* --- Expanded MiniChat: overlays everything (Copilot-style), does NOT resize page --- */
.mini-chat.expanded{
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;

  width: 30vw;
  height: 100vh;
  max-height: none;

  border-radius: 0;
  z-index: 5000; /* above sticky header (1000) */
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}

/* Mobile: take full screen */
@media (max-width: 900px){
  .mini-chat.expanded{
    width: 100vw;
  }
}