/*
 * Library Collection Aggregator - Unified Search Results CSS
 */

/* Grid Container - Applied to both plugin template and shortcode */
.lca-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Fixed 4 columns */
    gap: 20px; /* Space between items */
    margin-top: 2em;
    margin-bottom: 30px; /* Space below the grid */
    clear: both;
}

/* Individual Grid Item Styling */
.lca-grid-item {
    padding: 15px;
    border: 1px solid #eee; /* Use lighter border from theme */
    border-radius: 5px; /* Add slight rounding */
    background-color: #fff; /* Use white background from theme */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Use subtle shadow from theme */
    transition: box-shadow 0.3s ease;
    display: flex; /* Use flexbox for better content alignment */
    flex-direction: column;
    /* text-align: center; */ /* Removed from shortcode style, usually better left-aligned */
    /* justify-content: space-between; */ /* Removed, let natural flow happen */
}

.lca-grid-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Theme hover effect */
}

/* Item Titles (h2) */
.lca-grid-item h2.entry-title {
    font-size: 1.2rem !important; /* Theme size - Force override Elementor kit styles */
    margin: 0 0 10px 0;
    line-height: 1.3;
    /* We might need !important for color/weight too if Elementor overrides them */
    /* color: inherit !important; */ 
    /* font-weight: inherit !important; */ 
}
.lca-grid-item h2.entry-title a {
    text-decoration: none; /* Common practice */
    color: inherit; /* Inherit color from h2 */
}
.lca-grid-item h2.entry-title a:hover {
    text-decoration: underline;
}

/* Thumbnails and Placeholders */
.lca-grid-item .lca-thumbnail,
.lca-grid-item .wp-post-image, /* Target WP thumbnails too */
.lca-grid-item .lca-placeholder-image {
    max-width: 100%;
    height: 150px; /* Fixed height for consistency (from shortcode style) */
    object-fit: contain; /* Scales image nicely */
    margin-bottom: 15px; /* Space below image */
    border-radius: 4px; /* Optional: rounded corners */
}

.lca-grid-item .lca-thumbnail img,
.lca-grid-item .wp-post-image {
    display: block;
    width: 100%; /* Make image fill container width */
    height: 100%; /* Make image fill container height */
    object-fit: contain;
    background-color: #eee; /* Background shown while loading or if transparent */
}

.lca-grid-item .lca-placeholder-image {
    background-color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-style: italic;
    border: 1px dashed #ccc;
}

/* Item Meta (Creator, Date, etc.) */
.lca-grid-item .entry-summary p,
.lca-grid-item .lca-entry-summary p {
    font-size: 0.9em;
    margin: 5px 0 0 0;
    line-height: 1.4;
    word-wrap: break-word;
}

.lca-grid-item .lca-item-source,
.lca-grid-item .lca-item-creator,
.lca-grid-item .lca-item-date {
    color: #555;
}

/* View Details Link */
.lca-grid-item .lca-view-details-link a {
    display: inline-block;
    margin-top: 10px;
    font-weight: bold;
    /* text-decoration: underline; */ /* Maybe remove underline, handled by hover? */
}

/* Pagination Styles (applied to both shortcode and WP standard pagination) */
.lca-pagination,
.navigation.pagination {
    text-align: center;
    margin-top: 30px;
    clear: both;
}

/* Specific centering for WP standard pagination block */
.navigation.pagination {
    display: block; /* Ensure block behavior */
    width: fit-content; /* Size block to content */
    margin-left: auto;  /* Center the block */
    margin-right: auto; /* Center the block */
}

.lca-pagination .page-numbers,
.navigation.pagination .nav-links .page-numbers /* Target page numbers within WP structure */
{
    display: inline-block;
    margin: 0 4px;
    padding: 8px 12px;
    background-color: #f5f5f5;
    color: #0073aa;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.lca-pagination .page-numbers:hover,
.lca-pagination .page-numbers:focus,
.navigation.pagination .nav-links .page-numbers:hover,
.navigation.pagination .nav-links .page-numbers:focus
{
    background-color: #e0e0e0;
    color: #005a87;
}

.lca-pagination .page-numbers.current,
.navigation.pagination .nav-links .page-numbers.current
{
    background-color: #0073aa;
    color: #fff;
    border-color: #0073aa;
    font-weight: bold;
}

.lca-pagination .dots,
.navigation.pagination .nav-links .dots
{
    border: none;
    background: none;
    padding: 8px 4px;
}

/* Responsive adjustments - Combined and simplified */
@media (max-width: 1150px) { /* Tablet breakpoint (adjust as needed) */
    .lca-grid-container {
        grid-template-columns: repeat(3, 1fr); /* 3 columns on tablet */
        gap: 20px;
    }
}

@media (max-width: 900px) { /* Mobile breakpoint (adjust as needed) */
    .lca-grid-container {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
        gap: 15px;
    }
}

@media (max-width: 600px) { /* Small mobile breakpoint */
    .lca-grid-container {
        grid-template-columns: 1fr; /* Single column on small mobile */
        gap: 15px;
    }

    .lca-grid-item h2.entry-title {
        font-size: 1.1rem !important; /* Force override on mobile */
    }

    .lca-grid-item .lca-thumbnail,
    .lca-grid-item .wp-post-image,
    .lca-grid-item .lca-placeholder-image {
        height: 120px; /* Slightly smaller image on mobile */
    }
}

/* Hide potential <hr> separator from old theme code if it ever appears */
.lca-search-item-separator {
    display: none;
}

/* contributor List Specific Styles */
.lca-contributor-list-shortcode .lca-contributor-item {
    text-align: center;
}

/* Dynamic Column Options for contributor List */
.lca-contributor-list-shortcode.lca-columns-1 {
    grid-template-columns: 1fr !important;
}

.lca-contributor-list-shortcode.lca-columns-2 {
    grid-template-columns: repeat(2, 1fr) !important;
}

.lca-contributor-list-shortcode.lca-columns-3 {
    grid-template-columns: repeat(3, 1fr) !important;
}

.lca-contributor-list-shortcode.lca-columns-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}

.lca-contributor-list-shortcode.lca-columns-5 {
    grid-template-columns: repeat(5, 1fr) !important;
}

.lca-contributor-list-shortcode.lca-columns-6 {
    grid-template-columns: repeat(6, 1fr) !important;
}

/* Responsive adjustments for contributor list columns */
@media (max-width: 1150px) {
    .lca-contributor-list-shortcode.lca-columns-5,
    .lca-contributor-list-shortcode.lca-columns-6 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

@media (max-width: 900px) {
    .lca-contributor-list-shortcode.lca-columns-4,
    .lca-contributor-list-shortcode.lca-columns-5,
    .lca-contributor-list-shortcode.lca-columns-6 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .lca-contributor-list-shortcode.lca-columns-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .lca-contributor-list-shortcode.lca-columns-2,
    .lca-contributor-list-shortcode.lca-columns-3,
    .lca-contributor-list-shortcode.lca-columns-4,
    .lca-contributor-list-shortcode.lca-columns-5,
    .lca-contributor-list-shortcode.lca-columns-6 {
        grid-template-columns: 1fr !important;
    }
}

.lca-contributor-image-wrapper,
.lca-contributor-item .lca-placeholder-image {
    margin-bottom: 15px;
}

.lca-contributor-image {
    max-width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 4px;
}

.lca-contributor-description {
    font-size: 0.9em;
    margin: 10px 0;
    line-height: 1.4;
    color: #555;
}

.lca-contributor-website-button {
    margin: 15px 0;
}

.lca-contributor-button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.lca-contributor-button:hover,
.lca-contributor-button:focus {
    background-color: #005a87;
    color: #fff;
    text-decoration: none;
}

.lca-contributor-button-disabled {
    background-color: #ccc !important;
    color: #666 !important;
    cursor: default !important;
}

.lca-contributor-button-disabled:hover {
    background-color: #ccc !important;
    color: #666 !important;
}

.lca-contributor-collections-list {
    margin-top: 15px;
    text-align: left;
}

.lca-contributor-collections-list h3 {
    font-size: 1em;
    margin-bottom: 8px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.lca-contributor-collections-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lca-contributor-collections-list li {
    margin-bottom: 5px;
    font-size: 0.9em;
}

.lca-contributor-collections-list a {
    color: #0073aa;
    text-decoration: none;
}

.lca-contributor-collections-list a:hover {
    text-decoration: underline;
}

/* ==============================================
   Item Viewer Styles (from inline/frontend.css)
   ============================================== */

/* Applied via viewer page template or [lca_item_viewer] shortcode */
.lca-viewer-content-area-shortcode,
.lca-viewer-content-area /* From inline */
{
    max-width: 100%; /* Allow full width for viewer */
    padding: 15px;
}

.lca-viewer-article {
    /* Add any overall article styling if needed */
    max-width: 1400px; /* Improve readability on wide screens */
    margin-left: auto; /* Center the article when max-width applies */
    margin-right: auto; /* Center the article when max-width applies */
}

.lca-viewer-header {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.lca-viewer-title {
    margin-bottom: 5px;
}

.lca-archive-link {
    font-size: 0.9em;
    margin-top: 5px;
}

.lca-iframe-container {
    position: relative;
    overflow: hidden;
    padding-top: 75%; /* Aspect ratio 4:3, adjust as needed */
    border: 1px solid #ccc;
    background: #f0f0f0;
    margin-bottom: 20px; /* Add space below iframe */
}

.lca-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lca-viewer-metadata {
    margin-top: 20px;
    font-size: 0.9em;
}

.lca-viewer-metadata h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.lca-viewer-metadata dl dt {
    font-weight: bold;
    float: left;
    clear: left;
    width: 120px; /* Adjust width as needed */
    margin-right: 10px;
    margin-bottom: 5px;
}

.lca-viewer-metadata dl dd {
    margin-left: 130px; /* Should be width + margin-right */
    margin-bottom: 5px;
}

/* Results Count (below pagination) */
.lca-results-count {
    text-align: center; /* Center the text */
    margin-top: 1em;    /* Add space above */
    clear: both;        /* Ensure it appears below floated pagination if any */
    font-size: 0.9em;   /* Slightly smaller text */
    color: #555;         /* Match meta text color */
}

/* Related Items Section */
.lca-related-items-section {
    margin-top: 40px; /* Add space above the related items section */
    padding-top: 30px; /* Add padding inside the container */
    border-top: 1px solid #eee; /* Optional: add a separator line */
}

.lca-related-items-section h3 {
    margin-bottom: 20px; /* Space below the related items heading */
}

.lca-related-pagination {
    margin-top: 20px;
    clear: both; /* Ensure it clears floated grid items */
}

.lca-related-pagination .page-numbers {
    display: inline-block;
    padding: 5px 10px;
    margin: 0 2px;
    border: 1px solid #ccc;
    text-decoration: none;
    color: #333;
    background-color: #fff;
    border-radius: 3px;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.lca-related-pagination .page-numbers:hover {
    background-color: #eee;
    color: #000;
    border-color: #bbb;
}

.lca-related-pagination .page-numbers.current {
    background-color: #0073aa; /* WordPress blue */
    color: #fff;
    border-color: #0073aa;
    font-weight: bold;
    cursor: default;
}

.lca-related-pagination .page-numbers.dots {
    border: none;
    background-color: transparent;
    padding: 5px 0;
    cursor: default;
}

/* Optional: Hide prev/next if they are dots (can happen on first/last page sometimes) */
.lca-related-pagination .prev.dots,
.lca-related-pagination .next.dots {
    display: none;
} 