/**
 * GetCristin Search Styles
 * 
 * This stylesheet provides styling for the GetCristin search interface:
 * - Search form and input styling
 * - Results grid and card layout
 * - Person profile presentation
 * - Interactive elements and buttons
 * - Loading states and animations
 * - Responsive design
 * - Accessibility features
 * - Print styles
 * - Dark mode support
 * 
 * @package GetCristin
 * @since 1.3.0
 */

/* ==========================================================================
   Search Container and Form
   ========================================================================== */

/* Main search container */
.getcristin-search-container {
    max-width: 100%;
    margin: 20px 0;
}

/* Search form layout */
#getcristin-search-form {
    margin-bottom: 20px;
}

.getcristin-search-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
    width: 100%;
    flex-wrap: nowrap; /* Prevent wrapping */
}

/* ==========================================================================
   Advanced Search Filters
   ========================================================================== */

/* Advanced filters container */
.getcristin-advanced-filters {
    margin-top: 15px;
}

/* Advanced filters toggle button */
.getcristin-advanced-toggle {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.getcristin-advanced-toggle:hover {
    background-color: #f9f9f9;
    border-color: #0073aa;
    color: #0073aa;
}

.getcristin-advanced-toggle[aria-expanded="true"] {
    background-color: #f0f8ff;
    border-color: #0073aa;
    color: #0073aa;
}

.getcristin-advanced-toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.getcristin-advanced-toggle[aria-expanded="true"] .getcristin-advanced-toggle-icon {
    transform: rotate(45deg);
}

/* Advanced filters content */
.getcristin-advanced-filters-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background-color: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.getcristin-advanced-filters-content[aria-hidden="false"] {
    max-height: 500px;
    padding: 20px;
}

/* Filters grid layout */
.getcristin-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Filter group */
.getcristin-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.getcristin-filter-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* ==========================================================================
   Filter Select Elements
   ========================================================================== */

.getcristin-filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    transition: border-color 0.3s ease;
    min-height: 120px; /* For multiple select */
}

.getcristin-filter-select:focus {
    outline: none;
    border-color: #0073aa;
}

.getcristin-filter-select[multiple] {
    overflow-y: auto;
}

.getcristin-filter-select option {
    padding: 4px 8px;
}

.getcristin-filter-select option:checked {
    background-color: #0073aa;
    color: white;
}

/* Filter actions */
.getcristin-filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #e1e1e1;
}

.getcristin-filter-actions .getcristin-button {
    padding: 8px 16px;
    font-size: 14px;
}

/* ==========================================================================
   Date Range Filter
   ========================================================================== */

/* Date range container */
.getcristin-date-range-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.getcristin-date-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.getcristin-date-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.getcristin-date-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    transition: border-color 0.3s ease;
}

.getcristin-date-input:focus {
    outline: none;
    border-color: #0073aa;
}

/* No institutions message */
.getcristin-no-institutions {
    padding: 8px;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Responsive design for filters */
@media (max-width: 768px) {
    .getcristin-filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .getcristin-filter-actions {
        flex-direction: column;
    }
    
    .getcristin-filter-actions .getcristin-button {
        width: 100%;
    }
    
    .getcristin-multiselect-options {
        max-height: 150px;
    }
}

/* Search input field */
.getcristin-search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s;
    min-width: 0; /* Prevent flex items from overflowing */
    box-sizing: border-box;
    display: block; /* Ensure input is visible */
    width: 100%; /* Ensure full width */
    background-color: #fff; /* Ensure background is visible */
    color: #333; /* Ensure text is visible */
}

.getcristin-search-input:focus {
    outline: none;
    border-color: #0073aa;
}

/* Clear button */
.getcristin-clear-button {
    padding: 12px 16px;
    background-color: #f8f9fa;
    color: #666;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    flex-shrink: 0;
    margin: 0 5px;
}

.getcristin-clear-button:hover {
    background-color: #e9ecef;
    color: #333;
    border-color: #0073aa;
}

.getcristin-clear-button:focus {
    outline: none;
    border-color: #0073aa;
    background-color: #e9ecef;
}

.getcristin-clear-icon {
    font-weight: bold;
    line-height: 1;
}

/* Remove the connected border styling */
.getcristin-search-wrapper:has(.getcristin-clear-button) .getcristin-search-input {
    border-right: 2px solid #ddd;
    border-radius: 4px;
}

/* Search button */
.getcristin-search-button {
    padding: 12px 24px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.getcristin-search-button:hover {
    background-color: #005a87;
}

/* ==========================================================================
   Loading States and Messages
   ========================================================================== */

/* Loading spinner */
.getcristin-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}

.getcristin-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: getcristin-spin 1s linear infinite;
    vertical-align: middle;
}

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

/* Status messages */
.getcristin-notice,
.getcristin-no-results,
.getcristin-error {
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

.getcristin-notice {
    background-color: #f0f8ff;
    color: #0073aa;
}

.getcristin-no-results {
    background-color: #fff9e6;
    color: #856404;
}

.getcristin-error {
    background-color: #fee;
    color: #c33;
}

/* ==========================================================================
   Results Display
   ========================================================================== */

/* Results header */
.getcristin-results-count {
    margin-bottom: 20px;
    font-size: 16px;
    color: #666;
    padding: 10px 0;
    border-bottom: 2px solid #e1e1e1;
}

.getcristin-language-indicator {
    font-size: 14px;
    color: #999;
}

/* Results grid layout */
.getcristin-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* ==========================================================================
   Person Card
   ========================================================================== */

/* Card container */
.getcristin-person-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 40px; /* Added more space below each card */
}

.getcristin-person-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: #0073aa;
}

/* Person header section */
.getcristin-person-header {
    margin-bottom: 20px;
}

.getcristin-person-name {
    margin: 0 0 10px 0;
    color: #23282d;
    font-size: 22px;
    font-weight: 600;
}

.getcristin-person-institution {
    margin: 5px 0;
    color: #666;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.getcristin-person-position {
    color: #999;
    font-style: italic;
}

.getcristin-person-email {
    margin: 5px 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.getcristin-person-email a {
    color: #0073aa;
    text-decoration: none;
}

.getcristin-person-email a:hover {
    text-decoration: underline;
}

.getcristin-icon {
    font-size: 16px;
    opacity: 0.7;
}

/* ==========================================================================
   Keywords and Debug
   ========================================================================== */

/* Keywords section */
.getcristin-person-keywords {
    margin: 20px 0;
    padding: 15px;
    background-color: #f7f9fb;
    border-radius: 8px;
    border-left: 3px solid #0073aa;
    font-size: 14px;
    line-height: 1.6;
}

.getcristin-person-keywords strong {
    color: #555;
    display: block;
    margin-bottom: 8px;
}

.getcristin-keyword-list {
    color: #666;
}

/* Publications section */
.getcristin-person-publications {
    margin: 20px 0;
    padding: 15px;
    background-color: #f7f9fb;
    border-radius: 8px;
    border-left: 3px solid #28a745;
    font-size: 14px;
    line-height: 1.6;
}

.getcristin-person-publications h4 {
    color: #555;
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
}

/* Projects section */
.getcristin-person-projects {
    margin: 20px 0;
    padding: 15px;
    background-color: #f7f9fb;
    border-radius: 8px;
    border-left: 3px solid #ffc107;
    font-size: 14px;
    line-height: 1.6;
}

.getcristin-person-projects h4 {
    color: #555;
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
}

/* Empty section styling */
.getcristin-empty-section {
    color: #999;
    font-style: italic;
    margin: 0;
}

/* Data source timestamp */
.getcristin-data-source {
    text-align: right;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.getcristin-data-source small {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

/* Debug information */
.getcristin-debug-keywords {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

/* ==========================================================================
   Actions and Buttons
   ========================================================================== */

/* Action buttons container */
.getcristin-person-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

/* Base button styles */
.getcristin-button {
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
}

.getcristin-button-icon {
    font-size: 16px;
}

/* Primary button */
.getcristin-button-primary {
    background-color: #0073aa;
    color: white;
}

.getcristin-button-primary:hover {
    background-color: #005a87;
    color: white;
}

/* Secondary button */
.getcristin-button-secondary {
    background-color: #f7f9fb;
    color: #0073aa;
    border-color: #0073aa;
}

.getcristin-button-secondary:hover {
    background-color: #e6f0f5;
}

/* Expand button */
.getcristin-button-expand {
    background-color: transparent;
    color: #666;
    border-color: #ddd;
}

.getcristin-button-expand:hover {
    background-color: #f7f9fb;
    color: #0073aa;
}

.getcristin-button-expand[aria-expanded="true"] .getcristin-button-icon {
    transform: rotate(45deg);
}

/* ==========================================================================
   Save Button and Status
   ========================================================================== */

/* Save button */
.getcristin-save-researcher {
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-right: 10px;
}

.getcristin-save-researcher:hover {
    background-color: #218838;
}

.getcristin-save-researcher:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Unsave button */
.getcristin-unsave-researcher {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-right: 10px;
}

.getcristin-unsave-researcher:hover {
    background-color: #c82333;
}

.getcristin-unsave-researcher:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

/* Saved status indicator */
.getcristin-saved-status {
    display: inline-block;
    background-color: #17a2b8;
    color: white;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 14px;
    margin-right: 10px;
    font-weight: 500;
}

/* ==========================================================================
   Expanded Content
   ========================================================================== */

/* Expanded content container */
.getcristin-person-expanded {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

/* Inline loading indicator */
.getcristin-loading-inline {
    text-align: center;
    padding: 20px;
    color: #666;
}

.getcristin-loading-inline:before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: getcristin-spin 1s linear infinite;
    vertical-align: middle;
}

/* Progressive loading indicator */
.getcristin-loading-more {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.getcristin-loading-more:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: getcristin-spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

/* ==========================================================================
   Tabs
   ========================================================================== */

/* Tab navigation */
.getcristin-person-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid #e1e1e1;
    margin-bottom: 20px;
}

.getcristin-tab {
    padding: 10px 20px;
    background: #f7f9fb;
    border: 1px solid #e1e1e1;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.getcristin-tab:hover {
    background: #e6f0f5;
}

.getcristin-tab.active {
    background: #fff;
    color: #0073aa;
    border-bottom-color: #fff;
    margin-bottom: -1px;
}

.getcristin-tab-content {
    display: none;
}

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

/* ==========================================================================
   Metrics and Statistics
   ========================================================================== */

/* Metrics container */
.getcristin-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.getcristin-metric {
    text-align: center;
    padding: 15px;
    background: #f7f9fb;
    border-radius: 8px;
}

.getcristin-metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #0073aa;
}

.getcristin-metric-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* ==========================================================================
   Popular Keywords
   ========================================================================== */

/* Popular keywords section */
.getcristin-popular-keywords {
    margin: 30px 0;
}

.getcristin-popular-header {
    font-size: 16px;
    color: #23282d;
    margin-bottom: 15px;
}

.getcristin-keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.getcristin-keyword-tag {
    padding: 6px 12px;
    background: #f7f9fb;
    border: 1px solid #e1e1e1;
    border-radius: 20px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    cursor: pointer;
}

.getcristin-keyword-tag:hover {
    background: #e6f0f5;
    color: #0073aa;
    border-color: #0073aa;
}

.getcristin-keyword-tag span {
    font-size: 12px;
    opacity: 0.7;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet and smaller desktop */
@media (max-width: 768px) {
    .getcristin-search-wrapper {
        flex-direction: column;
    }
    
    .getcristin-search-input,
    .getcristin-search-button {
        width: 100%;
    }
    
    .getcristin-results-grid {
        grid-template-columns: 1fr;
    }
    
    .getcristin-person-actions {
        grid-template-columns: 1fr;
    }
    
    .getcristin-button {
        width: 100%;
    }
    
    .getcristin-person-card {
        padding: 15px;
    }
    
    .getcristin-person-name {
        font-size: 18px;
    }
    
    .getcristin-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile devices */
@media (max-width: 480px) {
    .getcristin-search-container {
        margin: 10px 0;
    }
    
    .getcristin-search-input {
        font-size: 16px;
        padding: 16px 20px; /* Increased padding for bigger touch target */
        min-height: 56px; /* Increased height for better mobile usability */
        border-radius: 8px; /* Slightly more rounded corners */
        border-width: 2px;
    }
    
    .getcristin-search-button {
        padding: 16px 20px; /* Increased padding to match input */
        font-size: 16px;
        min-height: 56px; /* Match input height */
        border-radius: 8px;
        font-weight: 600; /* Make button text more prominent */
    }
    
    .getcristin-clear-button {
        padding: 16px 20px; /* Increased padding */
        min-height: 56px; /* Match input height */
        min-width: 56px; /* Increased width for better touch target */
        font-size: 20px; /* Larger X icon */
        border-radius: 8px;
    }
    
    .getcristin-search-wrapper {
        gap: 12px; /* Increased gap between elements */
    }
    
    .getcristin-person-card {
        padding: 12px;
    }
    
    .getcristin-person-name {
        font-size: 16px;
    }
    
    .getcristin-person-institution {
        font-size: 13px;
    }
    
    .getcristin-button {
        padding: 12px 16px; /* Increased padding */
        font-size: 14px;
        min-height: 48px; /* Better touch target */
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus states */
.getcristin-button:focus,
.getcristin-search-input:focus,
.getcristin-tab:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Screen reader text */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .getcristin-search-form,
    .getcristin-person-actions,
    .getcristin-button-expand {
        display: none !important;
    }
    
    .getcristin-person-card {
        break-inside: avoid;
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .getcristin-person-actions {
        display: none;
    }
    
    .getcristin-button {
        border: 1px solid #000;
        color: #000;
        text-decoration: none;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .getcristin-search-input,
    .getcristin-button {
        border: 2px solid #000;
    }
    
    .getcristin-button {
        background: #000;
        color: #fff;
    }
    
    .getcristin-person-keywords {
        border: 2px solid #000;
    }
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .getcristin-person-card {
        background: #1e1e1e;
        border-color: #333;
    }
    
    .getcristin-person-name {
        color: #fff;
    }
    
    .getcristin-person-institution,
    .getcristin-person-email {
        color: #ccc;
    }
    
    .getcristin-person-keywords {
        background: #2a2a2a;
        border-color: #0073aa;
    }
    
    .getcristin-search-input {
        background: #1e1e1e;
        border-color: #333;
        color: #fff;
    }
    
    .getcristin-button-secondary {
        background: #2a2a2a;
        border-color: #0073aa;
        color: #fff;
    }
    
    .getcristin-button-secondary:hover {
        background: #333;
    }
}

.getcristin-common-keywords,
.getcristin-popular-searches,
.getcristin-popular-keywords {
    margin-bottom: 40px;
}

.getcristin-search-results-list {
    margin-top: 32px;
}

.getcristin-result-item {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    padding: 24px 24px 18px 24px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.getcristin-result-item:not(:last-child) {
    margin-bottom: 48px;
}
.getcristin-result-item:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    border-color: #0073aa;
}

/* ==========================================================================
   Pagination Controls
   ========================================================================== */

.getcristin-pagination {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid #e1e1e1;
    text-align: center;
}

.getcristin-pagination-info {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

.getcristin-pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.getcristin-pagination-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.getcristin-pagination-btn:hover {
    background-color: #f8f9fa;
    border-color: #0073aa;
    color: #0073aa;
}

.getcristin-pagination-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.getcristin-pagination-current {
    background-color: #0073aa !important;
    color: white !important;
    border-color: #0073aa !important;
    cursor: default;
}

.getcristin-pagination-current:hover {
    background-color: #0073aa !important;
    color: white !important;
}

.getcristin-pagination-prev,
.getcristin-pagination-next {
    font-weight: 500;
}

.getcristin-pagination-ellipsis {
    color: #666;
    padding: 8px 4px;
    font-size: 14px;
}

/* Mobile responsive pagination */
@media (max-width: 768px) {
    .getcristin-pagination-controls {
        gap: 4px;
    }
    
    .getcristin-pagination-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 36px;
    }
    
    .getcristin-pagination-info {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .getcristin-pagination-controls {
        gap: 2px;
    }
    
    .getcristin-pagination-btn {
        padding: 5px 8px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .getcristin-pagination-prev,
    .getcristin-pagination-next {
        font-size: 11px;
    }
}

/* Suggestions dropdown styling */
.getcristin-suggestions-dropdown {
    background: #fff;
    border: 1px solid #0073aa;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    border-radius: 8px;
    padding: 0;
    margin-top: 2px;
    z-index: 1000;
    min-width: 220px;
    max-width: 100vw;
    max-height: 320px;
    overflow-y: auto;
}
.getcristin-suggestion-item {
    padding: 12px 18px;
    cursor: pointer;
    font-size: 15px;
    color: #23282d;
    background: none;
    border: none;
    outline: none;
    transition: background 0.2s, color 0.2s;
}
.getcristin-suggestion-item:hover,
.getcristin-suggestion-item:focus {
    background: #e6f0f5;
    color: #0073aa;
}
.getcristin-suggestion-loading,
.getcristin-suggestion-empty {
    padding: 12px 18px;
    color: #888;
    font-size: 14px;
    background: none;
}

.getcristin-keyword-match {
    border-width: 3px !important;
    border-style: double !important;
    border-color: #0073aa !important;
    background: #fff !important;
    color: #0073aa !important;
    font-weight: bold;
}

/* ==========================================================================
   Back to Top Button
   ========================================================================== */

.getcristin-back-to-top {
    position: fixed;
    bottom: 50px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    font-size: 20px;
    font-weight: bold;
}

.getcristin-back-to-top:hover {
    background-color: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.4);
}

.getcristin-back-to-top:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.getcristin-back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.getcristin-back-to-top-icon {
    line-height: 1;
}

/* Mobile responsive back to top */
@media (max-width: 768px) {
    .getcristin-back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .getcristin-back-to-top {
        bottom: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* ==========================================================================
   Mobile Touch Optimizations
   ========================================================================== */

/* Prevent zoom on input focus and improve touch response */
.getcristin-search-input,
.getcristin-search-button,
.getcristin-clear-button,
.getcristin-button,
.getcristin-tab,
.getcristin-advanced-toggle,
.getcristin-filter-select,
.getcristin-date-input,
.getcristin-pagination-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow text selection in search input */
.getcristin-search-input {
    -webkit-user-select: text;
    user-select: text;
}

/* Prevent zoom on input focus in mobile browsers */
@media screen and (max-width: 768px) {
    .getcristin-search-input,
    .getcristin-date-input {
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    /* Improve touch targets on mobile */
    .getcristin-button,
    .getcristin-search-button,
    .getcristin-clear-button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Optimize filter dropdowns for touch */
    .getcristin-filter-select {
        padding: 12px 16px;
        font-size: 16px;
    }
}

/* ==========================================================================
   Critical CSS for Mobile Performance
   ========================================================================== */

/* Optimize rendering for mobile devices */
.getcristin-search-container {
    will-change: auto;
    transform: translateZ(0); /* Force hardware acceleration */
}

/* Optimize animations for mobile */
.getcristin-loading:before {
    will-change: transform;
}

/* Reduce repaints on mobile */
.getcristin-results-grid {
    contain: layout style;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Debug styles to ensure search input is visible */
.getcristin-search-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.3s;
    min-width: 0; /* Prevent flex items from overflowing */
    box-sizing: border-box;
    display: block !important; /* Force display */
    width: 100% !important; /* Force full width */
    background-color: #fff !important; /* Force background */
    color: #333 !important; /* Force text color */
    opacity: 1 !important; /* Force opacity */
    visibility: visible !important; /* Force visibility */
    position: relative !important; /* Ensure proper positioning */
    z-index: 1; /* Ensure it's above other elements */
}