:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1a202c;
    --light-bg: #1a202c;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --card-hover-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Navigation */
.navbar {
    background: #1a202c;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.navbar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.navbar-brand i {
    font-size: 1.6rem;
}

/* Main Content */
.main-content {
    position: relative;
    z-index: 1;
    padding: 2rem 0;
    min-height: calc(100vh - 156px);
}

/* Cards */
.card {
    background: white;
    border-radius: 16px;
    border: none;
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Make the form card keep white background */
.form-card {
    background: white !important;
    box-shadow: var(--card-shadow) !important;
}

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


.card-header {
    background: #1a202c;
    color: white;
    border: none;
    padding: 1.5rem;
    font-weight: 600;
    font-size: 1.2rem;
}

.card-body {
    padding: 2rem;
}

#resultsSection {
    background: transparent;
}

#resultsSection .card {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
}

#resultsSection .card-body {
    background: transparent !important;
    padding: 1.5rem;
    padding-top: 3rem;
}

#resultsSection .card:hover {
    box-shadow: none !important;
    transform: none !important;
}

/* Projects container spacing */
#projectsContainer {
    padding-top: 2rem;
}

/* Form Styling */
.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
    display: block;
}

.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    transition: all 0.2s;
    width: 100%;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.form-group {
    margin-bottom: 1.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.form-group:last-of-type {
    border-bottom: none;
}

/* Limit form width for better readability */
#similarityForm {
    max-width: 700px;
    margin: 0 auto;
}

/* Buttons */
.btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #5a67d8 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #4c51bf 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #1a202c;
    color: white;
}

.btn-secondary:hover {
    background: #1a202c;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: white;
}

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

/* Project Results Card */
.project-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 2rem;
    overflow: hidden;
}

.project-card:last-child {
    margin-bottom: 0;
}

.project-header {
    background: #1a202c;
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #1a202c;
}

.project-id {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.similarity-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.similarity-badge i {
    font-size: 0.8rem;
}

/* PDF Preview Section */
.pdf-preview-section {
    padding: 1.5rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.pdf-previews {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.pdf-preview-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.pdf-preview-card:hover {
    /* Removed hover effect */
}

.pdf-preview-header {
    background: #1a202c;
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-preview-image {
    width: 100%;
    height: 400px;
    object-fit: contain;
    background: #f3f4f6;
    transition: opacity 0.2s;
}

.clickable-image {
    cursor: pointer;
}

.pdf-preview-image:hover {
    opacity: 0.95;
}

.pdf-placeholder {
    width: 100%;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a202c;
    color: white;
    font-size: 3rem;
}

/* Load More Button */
.load-more-section {
    text-align: center;
    padding: 2rem 0;
}

.btn-load-more {
    background: white !important;
    color: var(--primary-color) !important;
    border: 2px solid var(--primary-color) !important;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    font-weight: 600;
    transition: none !important;
    cursor: pointer;
}

.btn-load-more:hover,
.btn-load-more:focus,
.btn-load-more:active {
    background: white !important;
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    transform: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Loading Spinner */
.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3rem;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1rem 0;
}

.comparison-table th {
    background: #1a202c;
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid #1a202c;
    color: white;
}

.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:hover {
    background: #fafafa;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #1a202c;
}

.empty-state i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-brand span {
        display: none;
    }
    
    .pdf-previews {
        grid-template-columns: 1fr;
    }
    
    .project-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .comparison-table {
        font-size: 0.9rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.75rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
    
    .pdf-preview-image,
    .pdf-placeholder {
        height: 300px;
    }
}

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

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

/* Image Modal Styles */
#imageModal .modal-dialog {
    max-width: 90vw;
    z-index: 1055;
}

#imageModal .modal-content {
    z-index: 1056;
}

#imageModal .modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    position: relative;
    background: #f0f0f0;
}

#modalImage {
    transition: transform 0.3s ease;
    transform-origin: center center;
    display: block;
    margin: auto;
    max-width: 100%;
    height: auto;
}

#imageModal .modal-footer {
    justify-content: space-between;
}

/* Ensure modal backdrop doesn't block */
.modal-backdrop {
    z-index: 1050;
}

.modal {
    z-index: 1055;
}

/* Zoom cursor states */
#modalImage[style*="zoom-in"] {
    cursor: zoom-in !important;
}

#modalImage[style*="zoom-out"] {
    cursor: zoom-out !important;
}

/* Mobile adjustments for modal */
@media (max-width: 768px) {
    #imageModal .modal-dialog {
        max-width: 100%;
        margin: 0;
    }
    
    #imageModal .modal-body {
        max-height: 70vh;
    }
    
    #imageModal .modal-footer {
        flex-wrap: wrap;
    }
    
    #imageModal .modal-footer .btn {
        margin: 0.25rem;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1050;
}

/* Form Validation */
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
    border-color: var(--danger-color);
}

.was-validated .form-control:valid,
.was-validated .form-select:valid {
    border-color: var(--secondary-color);
}

/* Progress Bar */
.progress {
    height: 6px;
    border-radius: 3px;
    background: #1a202c;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}
