:root {
    --bs-primary-rgb: 13, 110, 253;
}

html, body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif !important;
}

body.bg-light {
    background-color: #f8f9fa !important;
}

/* Navbar Styles */
.navbar-brand {
    letter-spacing: -0.5px;
}
.nav-link {
    transition: background-color 0.2s;
    border-radius: 0.375rem;
}
.nav-link.active {
    font-weight: 600;
}
.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Card & Form Styles */
.card {
    border-radius: 0.75rem;
}
.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
    border-color: rgba(var(--bs-primary-rgb), 0.5);
}
.form-check-input:checked {
    background-color: rgb(var(--bs-primary-rgb));
    border-color: rgb(var(--bs-primary-rgb));
}

/* Search Results Styles - Chrome-like Document List */
#resultsList .document-item {
    background-color: #fff;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s ease;
    animation: fadeInUp 0.3s ease-out forwards;
    opacity: 0;
    cursor: pointer;
    position: relative;
}

#resultsList .document-item:hover {
    background-color: #f8f9fa;
    border-color: #c0c0c0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.document-container {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

/* Document Icon */
.document-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
    font-size: 1.5rem;
}

/* Document Content */
.document-content {
    flex: 1;
    min-width: 0;
    padding-top: 0.2rem;
}

.document-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
}

.document-item:hover .document-title {
    color: #1557b0;
    text-decoration: underline;
}

.document-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #5f6368;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.document-meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.document-meta-item i {
    font-size: 0.75rem;
}

.document-snippet {
    color: #5f6368;
    font-size: 0.875rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.5rem;
}

/* Score Badge */
.document-score {
    position: absolute;
    top: 1rem;
    left: 1.25rem;
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Action Buttons */
.document-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.document-actions .btn {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-view {
    background-color: #1a73e8;
    color: white;
    border: none;
}

.btn-view:hover {
    background-color: #1557b0;
}

.btn-download {
    background-color: transparent;
    color: #5f6368;
    border: 1px solid #dadce0;
}

.btn-download:hover {
    background-color: #f1f3f4;
    border-color: #c0c0c0;
}

/* Document Viewer Modal */
.modal-document-viewer .modal-dialog {
    max-width: 900px;
}

.document-viewer-content {
    max-height: 70vh;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #fafafa;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    line-height: 1.8;
    font-size: 0.95rem;
    color: #202124;
}

/* Two-Column Layout */
#resultsColumn {
    padding-left: 1rem;
    padding-right: 1rem;
}

#documentViewerColumn {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Make results full width on small screens */
@media (max-width: 991px) {
    #resultsColumn {
        width: 100%;
    }
    #documentViewerColumn {
        width: 100%;
        margin-top: 2rem;
    }
}

/* Sticky Document Viewer */
.sticky-viewer {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
}

.sticky-viewer .card {
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

.sticky-viewer .card-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Document Viewer Content */
.viewer-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: #fafafa;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    line-height: 1.8;
    font-size: 0.95rem;
    color: #202124;
}

/* Improved Result Items - Google-like */
#resultsList .document-item {
    background-color: #fff;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 0;
    transition: background-color 0.15s ease;
    animation: fadeInUp 0.3s ease-out forwards;
    opacity: 0;
    cursor: pointer;
    position: relative;
}

#resultsList .document-item:hover {
    background-color: #f8f9fa;
}

#resultsList .document-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

#resultsList .document-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-bottom: none;
}

/* Simplified Document Container */
.document-container {
    display: block;
}

/* Remove document icon for cleaner look */
.document-icon {
    display: none;
}

/* Document Content - Full Width */
.document-content {
    width: 100%;
    padding: 0;
}

.document-title {
    font-size: 1.125rem;
    font-weight: 400;
    color: #1a0dab;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: text-decoration 0.2s;
    cursor: pointer;
}

.document-item:hover .document-title {
    text-decoration: underline;
}

.document-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #006621;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.document-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.document-meta-item i {
    font-size: 0.75rem;
}

.document-snippet {
    color: #545454;
    font-size: 0.875rem;
    line-height: 1.58;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.25rem;
}

/* Hide action buttons - clicking on item will show document */
.document-actions {
    display: none;
}

/* Score Badge - Compact */
.document-score {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Results Container */
#resultsList {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(32,33,36,.28);
    overflow: hidden;
}

/* Empty Results */
#resultsList:empty {
    box-shadow: none;
    background-color: transparent;
}

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