html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* Search Results Styling */
.search-stats {
    color: #5f6368;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e8eaed;
}

.search-results-container {
    max-width: 800px;
    margin: 0 auto;
}

.result-card {
    background: white;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s ease;
}

.result-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-card-content {
    display: flex;
    padding: 0.75rem;
    gap: 1rem;
}

.result-thumbnail-container {
    flex-shrink: 0;
}

.result-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #e8eaed;
}

.result-details {
    flex: 1;
    min-width: 0;
}

.result-title-link {
    text-decoration: none;
    color: inherit;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 400;
    margin: 0 0 0.25rem 0;
    color: #1a0dab;
    line-height: 1.3;
}

.result-title:hover {
    text-decoration: underline;
}

.result-title mark {
    background-color: #fff3cd;
    padding: 0 2px;
    font-weight: 500;
}

.result-url {
    display: block;
    font-size: 0.875rem;
    color: #006621;
    text-decoration: none;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-url:hover {
    text-decoration: underline;
}

.result-snippet {
    font-size: 0.875rem;
    color: #4d5156;
    line-height: 1.5;
    margin: 0 0 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-snippet mark {
    background-color: #fff3cd;
    padding: 0 2px;
    font-weight: 500;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #70757a;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.meta-item svg {
    flex-shrink: 0;
}

/* No Results Styling */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #70757a;
}

.no-results svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    font-weight: 400;
    color: #202124;
    margin-bottom: 0.5rem;
}

.no-results p {
    font-size: 0.875rem;
    color: #70757a;
}

/* Search Tabs Styling */
.search-tabs {
    max-width: 800px;
    margin: 0 auto;
    border-bottom: 1px solid #e8eaed;
}

.search-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #5f6368;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.search-tabs .nav-link:hover {
    border-bottom-color: #dadce0;
    background: transparent;
}

.search-tabs .nav-link.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    background: transparent;
}

.search-tabs .badge {
    font-size: 0.75rem;
}

/* Image Results Grid */
.image-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.image-result-card {
    background: white;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.image-result-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Clickable image container with aspect ratio */
.image-card-inner {
    display: block;
    position: relative;
    padding-bottom: 75%; /* 4:3 aspect ratio */
    background: #f8f9fa;
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
}

.image-result-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.image-result-card:hover .image-result-thumbnail {
    transform: scale(1.05);
}

.image-result-details {
    padding: 0.75rem;
}

.image-alt-text {
    font-size: 0.875rem;
    color: #202124;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 500;
}

.image-source-link {
    display: block;
    font-size: 0.75rem;
    color: #5f6368;
    text-decoration: none;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-source-link:hover {
    color: #1a73e8;
    text-decoration: underline;
}

.image-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.image-dimensions {
    font-size: 0.7rem;
    color: #70757a;
}

.image-score {
    font-size: 0.7rem;
    color: #70757a;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.image-score svg {
    flex-shrink: 0;
}

/* Image Results Container with Side Panel */
.image-results-container {
    position: relative;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: white;
    gap: 0.5rem;
    pointer-events: none; /* Allow clicks to pass through when not visible */
}

.image-card-inner:hover .image-overlay {
    opacity: 1;
    pointer-events: auto;
}

.image-overlay span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Side Panel for Image Pages */
.image-pages-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.image-pages-panel.active {
    right: 0;
}

.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.panel-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #202124;
}

.panel-body {
    padding: 1rem;
}

.selected-image-preview {
    margin-bottom: 1rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
}

.selected-image-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
    object-fit: contain;
}

.pages-list {
    margin-top: 1rem;
}

.page-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.page-item {
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 0.75rem;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.page-item:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.page-item-header {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.page-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: #1a73e8;
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.page-item-content {
    flex: 1;
    min-width: 0;
}

.page-item-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1a0dab;
    text-decoration: none;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-item-title:hover {
    text-decoration: underline;
}

.page-item-url {
    font-size: 0.75rem;
    color: #006621;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-item-alt {
    font-size: 0.75rem;
    color: #5f6368;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.page-item-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.page-item-meta .badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
}

.page-item-meta .small {
    font-size: 0.7rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .result-card-content {
        flex-direction: column;
    }

    .result-thumbnail {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    .image-pages-panel {
        width: 100%;
        right: -100%;
    }

    .image-pages-panel.active {
        right: 0;
    }
}
/* Autocomplete Dropdown Styles */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: -0.25rem;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
    text-align: left;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #f0f0f0;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-icon {
    color: #999;
    margin-right: 8px;
}

    .search-results-container {
        padding: 0 0.5rem;
    }

    .image-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
    }

    .search-tabs .nav-link {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
