/* Main Styles for Procurement Quotation Comparer */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/* Comparison Table Enhancements */
.table-responsive {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Ensure smooth horizontal scrolling on all devices */
}

.table {
    margin-bottom: 0;
    background: white;
}

.table thead th {
    background: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px 10px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody td {
    padding: 12px 10px;
    vertical-align: top;
    border-top: 1px solid #dee2e6;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* REMOVED: Conflicting column width definitions - handled in responsive sections below */

/* Term content styling */
.term-content, .remarks-content {
    width: 100%;
}

.term-text, .remarks-text {
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
    margin-bottom: 4px;
}

.expanded-content, .expanded-remarks {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
    font-size: 0.85rem;
    line-height: 1.4;
}

.expanded-remarks .alert {
    background-color: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.vendor-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.amount {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--dark-color);
}

.best-amount {
    color: var(--success-color);
}

.score-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    min-width: 45px;
}

.score-excellent {
    background: var(--success-color);
    color: white;
}

.score-good {
    background: var(--info-color);
    color: white;
}

.score-fair {
    background: var(--warning-color);
    color: var(--dark-color);
}

.score-poor {
    background: var(--danger-color);
    color: white;
}

/* Credibility badges and background check styling */
.credibility-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.credibility-excellent {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #a3cfbb;
}

.credibility-good {
    background-color: #cff4fc;
    color: #055160;
    border: 1px solid #9eeaf9;
}

.credibility-fair {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffda6a;
}

.credibility-poor {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f1aeb5;
}

.credibility-unknown {
    background-color: #e2e3e5;
    color: #41464b;
    border: 1px solid #c4c8cb;
}

.credibility-positive {
    background-color: #d1e7dd;
    color: #0f5132;
}

.credibility-neutral {
    background-color: #fff3cd;
    color: #664d03;
}

.credibility-negative {
    background-color: #f8d7da;
    color: #721c24;
}

.item-match-column {
    min-width: 100px;
    vertical-align: top;
    text-align: center;
}

.item-match-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.item-match-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.badge-secondary {
    background-color: #e2e3e5;
    color: #41464b;
    border: 1px solid #c4c8cb;
}

.credibility-column {
    min-width: 140px;
    vertical-align: top;
}

.credibility-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.credibility-details {
    font-size: 0.7rem;
    color: #6c757d;
    line-height: 1.2;
}

.credibility-score {
    font-weight: 700;
}

/* Modal enhancements for background checks */
.vendor-background-modal .modal-dialog {
    max-width: 800px;
}

.vendor-background-modal .credibility-badge {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.vendor-background-modal .badge {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Table layout improvements */
.table {
    width: 100%;
    /* table-layout: fixed moved to specific breakpoints */
}

.table th, .table td {
    word-wrap: break-word;
    vertical-align: top;
    padding: 12px 8px;
}

/* REMOVED: Conflicting column width definitions - handled in responsive sections below */

/* Text content styling */
.term-text, .remarks-text {
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.remarks-column {
    max-width: 250px;
}

.remarks-text {
    max-height: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* REMOVED: Orphaned styles without media query - handled in responsive sections below */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* Page Navigation */
.page-container {
    min-height: calc(100vh - 200px);
    padding: 20px 0;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    margin-bottom: 30px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-5px);
}

/* Form Styles */
.form-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-section h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-color);
}

.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--light-color);
    color: var(--secondary-color);
    margin: 0 10px;
    font-weight: bold;
    position: relative;
}

.step.active {
    background-color: var(--primary-color);
    color: white;
}

.step.completed {
    background-color: var(--success-color);
    color: white;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    width: 20px;
    height: 2px;
    background-color: var(--light-color);
    transform: translateY(-50%);
}

.step.completed:not(:last-child)::after {
    background-color: var(--success-color);
}

/* Item Entry */
.item-row {
    background: var(--light-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
}

.item-row:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.add-item-btn {
    border: 2px dashed var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    width: 100%;
    transition: all 0.3s ease;
}

.add-item-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Comparison Table */
.comparison-table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.comparison-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    padding: 15px 10px;
    text-align: center;
}

.comparison-table td {
    padding: 12px 10px;
    text-align: center;
    border-bottom: 1px solid var(--light-color);
}

.best-price {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
    font-weight: bold;
}

.highest-price {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Score Cards */
.score-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.score-card.winner {
    border: 3px solid var(--success-color);
    background: linear-gradient(135deg, rgba(25, 135, 84, 0.05) 0%, rgba(25, 135, 84, 0.1) 100%);
}

.score-display {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.score-breakdown {
    margin-top: 15px;
}

.score-breakdown .row {
    margin-bottom: 8px;
}

/* Export Buttons */
.export-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.export-btn {
    margin: 5px;
    min-width: 150px;
}

/* Charts */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        padding: 30px 20px !important;
    }
    
    .feature-card {
        margin-bottom: 20px;
    }
    
    .comparison-table {
        font-size: 0.875rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px 5px;
    }
    
    .score-display {
        font-size: 2rem;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility Classes */
.text-muted {
    color: var(--secondary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.bg-light-primary {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--light-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Additional Stats Cards */
.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card .stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    display: block;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Export Options */
.export-option {
    text-align: center;
    padding: 20px;
}

.export-option .export-icon {
    margin-bottom: 15px;
}

/* Upload Area Styling */
.upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    background: rgba(13, 110, 253, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--success-color);
    background: rgba(25, 135, 84, 0.05);
}

.upload-content h5 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

/* Storage Info */
.storage-stats .progress {
    height: 10px;
    margin-bottom: 5px;
}

.storage-breakdown small {
    color: var(--secondary-color);
}

/* Drag and Drop Zone */
.drop-zone {
    border: 3px dashed var(--primary-color);
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: rgba(13, 110, 253, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--success-color);
    background: rgba(25, 135, 84, 0.05);
    transform: scale(1.02);
}

.drop-zone.dragover {
    border-style: solid;
    box-shadow: 0 8px 25px rgba(25, 135, 84, 0.15);
}

.drop-zone-content h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.drop-zone-content p {
    margin-bottom: 20px;
}

/* Uploaded Files List */
.uploaded-files {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border: 1px solid var(--light-color);
    border-radius: 8px;
    margin-bottom: 10px;
    background: var(--light-color);
    transition: all 0.3s ease;
}

.file-item:hover {
    background: rgba(13, 110, 253, 0.05);
    border-color: var(--primary-color);
}

.file-info {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.file-info i {
    color: var(--danger-color);
    margin-right: 10px;
    font-size: 1.2rem;
}

.file-details {
    flex-grow: 1;
}

.file-name {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 2px;
}

.file-size {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.file-actions {
    display: flex;
    gap: 8px;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.btn-remove:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* Processing Animation */
.processing-animation {
    margin: 40px 0;
}

.processing-status {
    margin: 20px 0;
}

.processing-status h5 {
    margin-bottom: 10px;
}

/* Results Page Enhancements */
.results-summary {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.summary-card {
    text-align: center;
    padding: 20px;
    background: var(--light-color);
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.summary-card:hover {
    transform: translateY(-3px);
}

.summary-card h3 {
    margin-bottom: 5px;
    font-weight: bold;
}

.summary-card .card-text {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* File Upload Enhancements */
#fileInput {
    position: absolute;
    top: -9999px;
    left: -9999px;
}

.file-upload-feedback {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.file-upload-feedback.success {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(25, 135, 84, 0.2);
}

.file-upload-feedback.error {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* AI-Powered Interface Styles */
.upload-zone {
    border: 3px dashed var(--primary-color);
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    background: rgba(13, 110, 253, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--success-color);
    background: rgba(25, 135, 84, 0.05);
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(25, 135, 84, 0.15);
}

.upload-zone.dragover {
    border-style: solid;
}

.upload-zone h5 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 600;
}

.upload-zone .text-muted {
    margin-bottom: 20px;
}

/* File List Styling */
.file-list {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.file-list h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 15px;
}

.list-group-item {
    border: 1px solid var(--light-color);
    border-radius: 8px !important;
    margin-bottom: 8px;
    padding: 12px 15px;
    background: white;
    transition: all 0.3s ease;
}

.list-group-item:hover {
    background: rgba(13, 110, 253, 0.05);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.file-item-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.file-item-details {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.file-icon {
    color: var(--danger-color);
    margin-right: 12px;
    font-size: 1.2rem;
}

.file-name {
    font-weight: 500;
    color: var(--dark-color);
    margin-bottom: 2px;
}

.file-size {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.file-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.valid {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.status-badge.invalid {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-remove-file:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

/* Processing Section Styles */
#processingSection .card {
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#processingSection .progress {
    height: 12px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.2);
}

#processingSection .progress-bar {
    border-radius: 10px;
    background: linear-gradient(90deg, #0dcaf0, #198754);
}

#processingStatus {
    font-size: 1.1rem;
    color: white;
}

/* Results Section Styles */
#resultsSection .card {
    border: none;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

#resultsSection .card-header {
    border: none;
    padding: 20px 25px 15px;
    font-weight: 600;
}

/* Summary Cards */
.summary-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.summary-card .display-4 {
    font-weight: 700;
    margin-bottom: 10px;
}

.summary-card .text-primary {
    color: var(--primary-color) !important;
}

.summary-card .text-success {
    color: var(--success-color) !important;
}

.summary-card .text-info {
    color: var(--info-color) !important;
}

.summary-card .text-warning {
    color: var(--warning-color) !important;
}

.summary-card h6 {
    color: var(--secondary-color);
    font-weight: 500;
    margin-bottom: 0;
}

/* Recommendation Panel */
#recommendationPanel {
    padding: 25px;
}

.recommendation-content {
    margin-bottom: 20px;
}

.preferred-vendor {
    background: rgba(25, 135, 84, 0.1);
    border: 1px solid rgba(25, 135, 84, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.preferred-vendor h6 {
    color: var(--success-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.reasoning {
    background: rgba(13, 110, 253, 0.05);
    border: 1px solid rgba(13, 110, 253, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.alternatives {
    margin-top: 15px;
}

.alternatives h6 {
    color: var(--secondary-color);
    font-weight: 600;
    margin-bottom: 10px;
}

.alternative-vendor {
    display: inline-block;
    background: rgba(108, 117, 125, 0.1);
    border: 1px solid rgba(108, 117, 125, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    margin: 4px 6px 4px 0;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Comparison Table Enhancements */
#comparisonTable {
    font-size: 0.95rem;
}

#comparisonTable thead th {
    background: linear-gradient(135deg, var(--primary-color), #0a58ca);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 15px 12px;
    border: none;
}

#comparisonTable tbody td {
    padding: 12px 8px;
    text-align: center;
    vertical-align: middle;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.875rem;
}

#comparisonTable tbody tr:hover {
    background: rgba(13, 110, 253, 0.03);
}

.vendor-name {
    font-weight: 600;
    color: var(--primary-color);
}

.amount {
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.best-amount {
    background: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
    font-weight: 700;
    border-radius: 6px;
}

.score-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 50px;
}

.score-excellent {
    background: rgba(25, 135, 84, 0.15);
    color: var(--success-color);
}

.score-good {
    background: rgba(255, 193, 7, 0.15);
    color: #b8860b;
}

.score-fair {
    background: rgba(255, 108, 77, 0.15);
    color: #d63384;
}

.score-poor {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger-color);
}

/* Chart Containers */
.chart-container {
    position: relative;
    padding: 20px;
}

#priceChart, #scoreChart {
    max-height: 300px;
}

/* Error Section */
#errorSection .card {
    border: 2px solid var(--danger-color);
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.15);
}

#errorMessage {
    border: none;
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    border-radius: 8px;
    padding: 15px;
}

/* Export Section */
.export-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.export-section h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 20px;
}

.btn-group .btn {
    border-radius: 8px;
}

.btn-group .btn:not(:last-child) {
    margin-right: 8px;
}

/* Footer Styling */
footer {
    margin-top: 50px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

footer p {
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* ===== RESPONSIVE DESIGN - MOBILE FIRST ===== */

/* Base Mobile Styles (320px+) */
.container-fluid {
    padding: 0 12px;
}

.container {
    padding: 0 12px;
}

/* Navigation Responsiveness */
.navbar-brand {
    font-size: 1rem;
    line-height: 1.2;
}

.navbar-text {
    font-size: 0.8rem;
    display: none;
}

/* Upload Zone - Mobile First */
.upload-zone {
    padding: 30px 15px;
    min-height: 120px;
    border-width: 2px;
}

.upload-zone .display-1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.upload-zone h5 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.upload-zone p {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.upload-zone small {
    font-size: 0.75rem;
    line-height: 1.3;
}

/* File List Mobile Optimization */
.file-list {
    padding: 12px;
}

.list-group-item {
    padding: 10px 12px;
    font-size: 0.875rem;
}

.file-item-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.file-item-details {
    width: 100%;
}

.file-status {
    align-self: flex-end;
    width: 100%;
    justify-content: space-between;
}

.file-name {
    font-size: 0.875rem;
    line-height: 1.3;
    word-break: break-word;
}

.file-size {
    font-size: 0.75rem;
}

/* Cards and Sections - Mobile First */
.card {
    margin-bottom: 1rem;
    border-radius: 8px;
}

.card-header {
    padding: 15px;
}

.card-body {
    padding: 15px;
}

.summary-card {
    padding: 15px;
    margin-bottom: 1rem;
    text-align: center;
}

.summary-card .display-4 {
    font-size: 1.5rem;
    line-height: 1.2;
}

.summary-card h6 {
    font-size: 0.875rem;
}

/* Button Groups - Stack on Mobile */
.btn-group {
    flex-direction: column;
    width: 100%;
    gap: 8px;
}

.btn-group .btn {
    border-radius: 6px !important;
    margin: 0;
    min-height: 44px; /* Touch target size */
    font-size: 0.875rem;
}

/* Touch-friendly button sizing */
.btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.875rem;
}

.btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.8125rem;
}

/* Table Responsiveness - Mobile First Approach */
.table-responsive {
    border-radius: 8px;
    margin-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Ensure horizontal scrolling works on all mobile devices */
    width: 100%;
    /* Allow content to dictate width */
    max-width: 100vw;
}

#comparisonTable {
    font-size: 0.875rem;
    min-width: 1500px; /* Ensure enough space for 9 columns with proper content display */
    width: 100%;
    table-layout: fixed;
}

#comparisonTable thead th {
    padding: 8px 6px;
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
}

#comparisonTable tbody td {
    padding: 8px 6px;
    font-size: 0.75rem;
    line-height: 1.3;
    vertical-align: top;
}

/* Mobile table column widths - optimized for horizontal scrolling (9 columns) */
.table th:nth-child(1), .table td:nth-child(1) { width: 130px; min-width: 130px; } /* Vendor */
.table th:nth-child(2), .table td:nth-child(2) { width: 110px; min-width: 110px; } /* Amount */  
.table th:nth-child(3), .table td:nth-child(3) { width: 150px; min-width: 150px; } /* Payment */
.table th:nth-child(4), .table td:nth-child(4) { width: 170px; min-width: 170px; } /* Delivery */
.table th:nth-child(5), .table td:nth-child(5) { width: 130px; min-width: 130px; } /* Warranty */
.table th:nth-child(6), .table td:nth-child(6) { width: 80px; min-width: 80px; } /* Score */
.table th:nth-child(7), .table td:nth-child(7) { width: 100px; min-width: 100px; } /* Item Match */
.table th:nth-child(8), .table td:nth-child(8) { width: 130px; min-width: 130px; } /* Credibility */
.table th:nth-child(9), .table td:nth-child(9) { width: 200px; min-width: 200px; } /* Remarks */

/* Text content optimization for mobile */
.term-text, .remarks-text {
    font-size: 0.8rem;
    line-height: 1.4;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.vendor-name {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.amount {
    font-size: 0.75rem;
    font-weight: 600;
}

.score-badge {
    padding: 3px 6px;
    font-size: 0.65rem;
    min-width: 35px;
}

.credibility-badge {
    padding: 2px 4px;
    font-size: 0.65rem;
    line-height: 1.2;
}

/* Charts - Responsive Sizing */
.chart-container {
    padding: 12px;
    position: relative;
    height: auto;
}

#priceChart, #scoreChart {
    max-height: 250px;
    height: auto !important;
    width: 100% !important;
}

/* Recommendation Panel */
#recommendationPanel {
    padding: 15px;
}

.preferred-vendor,
.reasoning {
    padding: 12px;
    margin-bottom: 12px;
    font-size: 0.875rem;
    line-height: 1.4;
}

.alternative-vendor {
    padding: 4px 8px;
    margin: 2px 4px 2px 0;
    font-size: 0.75rem;
}

/* Processing Section */
#processingStatus {
    font-size: 0.875rem;
    text-align: center;
}

.progress {
    height: 8px;
}

/* Footer */
footer {
    padding: 20px 0 !important;
    margin-top: 30px;
}

footer p {
    font-size: 0.75rem;
    line-height: 1.4;
}

/* Error states */
#errorMessage {
    padding: 12px;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Export section */
.export-section {
    padding: 15px;
}

.export-section h6 {
    font-size: 0.875rem;
    margin-bottom: 15px;
}

/* ===== TABLET STYLES (576px+) ===== */
@media (min-width: 576px) {
    .container-fluid {
        padding: 0 16px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .navbar-text {
        display: inline;
        font-size: 0.875rem;
    }
    
    .upload-zone {
        padding: 40px 20px;
        min-height: 160px;
    }
    
    .upload-zone .display-1 {
        font-size: 3rem;
    }
    
    .upload-zone h5 {
        font-size: 1.125rem;
    }
    
    .file-list {
        padding: 16px;
    }
    
    .file-item-info {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    .file-status {
        align-self: center;
        width: auto;
        justify-content: flex-end;
    }
    
    .summary-card {
        padding: 20px;
    }
    
    .summary-card .display-4 {
        font-size: 1.75rem;
    }
    
    .card-header {
        padding: 18px;
    }
    
    .card-body {
        padding: 18px;
    }
    
    #comparisonTable {
        font-size: 0.85rem;
        min-width: 1300px;
    }
    
    #comparisonTable thead th,
    #comparisonTable tbody td {
        padding: 10px 8px;
    }
    
    .term-text, .remarks-text {
        font-size: 0.8125rem;
        max-height: 80px;
        -webkit-line-clamp: 4;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .btn-group {
        flex-direction: row;
        width: auto;
        gap: 4px;
    }
    
    .btn-group .btn {
        margin: 0 2px;
    }
    
    #priceChart, #scoreChart {
        max-height: 280px;
    }
    
    .chart-container {
        padding: 16px;
    }
    
    #recommendationPanel {
        padding: 18px;
    }
}

/* ===== SMALL DESKTOP STYLES (768px+) ===== */
@media (min-width: 768px) {
    .container-fluid {
        padding: 0 20px;
    }
    
    .container {
        padding: 0 20px;
    }
    
    .navbar-brand {
        font-size: 1.125rem;
    }
    
    .upload-zone {
        padding: 50px 30px;
        min-height: 200px;
    }
    
    .upload-zone .display-1 {
        font-size: 3.5rem;
    }
    
    .upload-zone h5 {
        font-size: 1.25rem;
    }
    
    .file-list {
        padding: 20px;
    }
    
    .summary-card {
        padding: 25px;
    }
    
    .summary-card .display-4 {
        font-size: 2rem;
    }
    
    .card-header {
        padding: 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    /* Better table layout for tablets */
    .table-responsive {
        /* Allow horizontal scrolling if needed */
        overflow-x: auto;
    }
    
    #comparisonTable {
        font-size: 0.9rem;
        min-width: 1350px;
    }
    
    #comparisonTable thead th,
    #comparisonTable tbody td {
        padding: 12px 10px;
    }
    
    /* Improved column widths for tablet (9 columns) */
    .table th:nth-child(1), .table td:nth-child(1) { width: 140px; min-width: 140px; } /* Vendor */
    .table th:nth-child(2), .table td:nth-child(2) { width: 110px; min-width: 110px; } /* Amount */
    .table th:nth-child(3), .table td:nth-child(3) { width: 160px; min-width: 160px; } /* Payment */
    .table th:nth-child(4), .table td:nth-child(4) { width: 190px; min-width: 190px; } /* Delivery */
    .table th:nth-child(5), .table td:nth-child(5) { width: 130px; min-width: 130px; } /* Warranty */
    .table th:nth-child(6), .table td:nth-child(6) { width: 80px; min-width: 80px; } /* Score */
    .table th:nth-child(7), .table td:nth-child(7) { width: 100px; min-width: 100px; } /* Item Match */
    .table th:nth-child(8), .table td:nth-child(8) { width: 120px; min-width: 120px; } /* Credibility */
    .table th:nth-child(9), .table td:nth-child(9) { width: 220px; min-width: 220px; } /* Remarks */
    
    .term-text, .remarks-text {
        font-size: 0.875rem;
        max-height: 100px;
        -webkit-line-clamp: 5;
    }
    
    .vendor-name {
        font-size: 0.875rem;
    }
    
    .amount {
        font-size: 0.875rem;
    }
    
    .score-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
        min-width: 40px;
    }
    
    .credibility-badge {
        padding: 3px 6px;
        font-size: 0.75rem;
    }
    
    #priceChart, #scoreChart {
        max-height: 320px;
    }
    
    .chart-container {
        padding: 20px;
    }
    
    #recommendationPanel {
        padding: 20px;
    }
    
    .btn-group {
        gap: 6px;
    }
}

/* ===== DESKTOP STYLES (992px+) ===== */
@media (min-width: 992px) {
    .upload-zone {
        padding: 60px 40px;
        min-height: 240px;
    }
    
    .upload-zone .display-1 {
        font-size: 4rem;
    }
    
    .summary-card .display-4 {
        font-size: 2.25rem;
    }
    
    /* Optimal table layout for desktop */
    .table-responsive {
        /* Allow horizontal scroll if content is wide */
        overflow-x: auto;
    }
    
    #comparisonTable {
        font-size: 0.95rem;
        min-width: 1450px;
    }
    
    #comparisonTable thead th,
    #comparisonTable tbody td {
        padding: 15px 12px;
    }
    
    /* Desktop column widths (9 columns) */
    .table th:nth-child(1), .table td:nth-child(1) { width: 150px; min-width: 150px; } /* Vendor */
    .table th:nth-child(2), .table td:nth-child(2) { width: 120px; min-width: 120px; } /* Amount */
    .table th:nth-child(3), .table td:nth-child(3) { width: 170px; min-width: 170px; } /* Payment */
    .table th:nth-child(4), .table td:nth-child(4) { width: 200px; min-width: 200px; } /* Delivery */
    .table th:nth-child(5), .table td:nth-child(5) { width: 140px; min-width: 140px; } /* Warranty */
    .table th:nth-child(6), .table td:nth-child(6) { width: 80px; min-width: 80px; } /* Score */
    .table th:nth-child(7), .table td:nth-child(7) { width: 100px; min-width: 100px; } /* Item Match */
    .table th:nth-child(8), .table td:nth-child(8) { width: 130px; min-width: 130px; } /* Credibility */
    .table th:nth-child(9), .table td:nth-child(9) { width: 240px; min-width: 240px; } /* Remarks */
    
    .term-text, .remarks-text {
        font-size: 0.9rem;
        max-height: 120px;
        -webkit-line-clamp: 6;
    }
    
    .vendor-name {
        font-size: 0.9rem;
    }
    
    .amount {
        font-size: 0.9rem;
    }
    
    .score-badge {
        padding: 6px 10px;
        font-size: 0.8125rem;
        min-width: 45px;
    }
    
    .credibility-badge {
        padding: 4px 8px;
        font-size: 0.8125rem;
    }
    
    #priceChart, #scoreChart {
        max-height: 350px;
    }
    
    .chart-container {
        padding: 25px;
    }
    
    #recommendationPanel {
        padding: 25px;
    }
}

/* ===== LARGE DESKTOP STYLES (1200px+) ===== */
@media (min-width: 1200px) {
    .upload-zone .display-1 {
        font-size: 4.5rem;
    }
    
    .summary-card .display-4 {
        font-size: 2.5rem;
    }
    
    /* Full desktop table layout */
    .table-responsive {
        /* Allow horizontal scroll if content is wide */
        overflow-x: auto;
    }
    
    #comparisonTable {
        font-size: 1rem;
        min-width: 1500px;
    }
    
    /* Large desktop column widths (9 columns) */
    .table th:nth-child(1), .table td:nth-child(1) { width: 12%; min-width: 160px; } /* Vendor */
    .table th:nth-child(2), .table td:nth-child(2) { width: 9%; min-width: 130px; } /* Amount */
    .table th:nth-child(3), .table td:nth-child(3) { width: 14%; min-width: 180px; } /* Payment */
    .table th:nth-child(4), .table td:nth-child(4) { width: 16%; min-width: 220px; } /* Delivery */
    .table th:nth-child(5), .table td:nth-child(5) { width: 11%; min-width: 150px; } /* Warranty */
    .table th:nth-child(6), .table td:nth-child(6) { width: 6%; min-width: 80px; } /* Score */
    .table th:nth-child(7), .table td:nth-child(7) { width: 7%; min-width: 100px; } /* Item Match */
    .table th:nth-child(8), .table td:nth-child(8) { width: 10%; min-width: 140px; } /* Credibility */
    .table th:nth-child(9), .table td:nth-child(9) { width: 15%; min-width: 260px; } /* Remarks */
    
    .term-text, .remarks-text {
        font-size: 0.95rem;
        max-height: 150px;
        -webkit-line-clamp: 8;
    }
    
    .vendor-name {
        font-size: 0.95rem;
    }
    
    .amount {
        font-size: 0.95rem;
    }
    
    .score-badge {
        padding: 6px 12px;
        font-size: 0.875rem;
        min-width: 50px;
    }
    
    .credibility-badge {
        padding: 4px 8px;
        font-size: 0.875rem;
    }
    
    #priceChart, #scoreChart {
        max-height: 400px;
    }
}

/* ===== ACCESSIBILITY AND TOUCH IMPROVEMENTS ===== */

/* Ensure minimum touch target sizes (44px minimum) */
.btn, button, [role="button"], [type="button"] {
    min-height: 44px;
    min-width: 44px;
}

.btn-sm {
    min-height: 36px;
    min-width: 36px;
}

/* Improve focus states for keyboard navigation */
.btn:focus,
.form-control:focus,
.upload-zone:focus,
[tabindex]:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .table {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid currentColor;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    .slide-in,
    .pulse,
    .loading-spinner,
    .upload-zone,
    .summary-card,
    .feature-card {
        animation: none !important;
        transition: none !important;
    }
    
    .upload-zone:hover {
        transform: none !important;
    }
    
    .summary-card:hover {
        transform: none !important;
    }
}

/* Loading and Animation States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(13, 110, 253, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Success States */
.success-checkmark {
    color: var(--success-color);
    font-size: 1.2rem;
    animation: checkmark 0.5s ease-in-out;
}

@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulse Animation for Processing */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Chart Container Styling */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-container canvas {
    max-height: 280px !important;
    width: 100% !important;
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
    .chart-container {
        height: 250px;
        padding: 5px;
    }
    
    .chart-container canvas {
        max-height: 230px !important;
    }
}

@media (max-width: 576px) {
    .chart-container {
        height: 200px;
        margin-bottom: 15px;
    }
    
    .chart-container canvas {
        max-height: 180px !important;
    }
}