/* CMIP 2026 Presentation Search Plugin CSS */

* {
    box-sizing: border-box;
}

.cmip-search-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
}

.cmip-header {
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 1rem;
}

.cmip-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
    color: #1a1a1a;
}

.cmip-header p {
    margin: 0;
    color: #666;
    font-size: 1.1rem;
}

.cmip-wrapper {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
}

.cmip-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.cmip-search-box {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.cmip-search-input {
    flex: 1;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.cmip-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.cmip-clear-search {
    padding: 0.75rem 1rem;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.cmip-clear-search:hover {
    background-color: #e0e0e0;
}

.cmip-facets-container {
    background: #fafafa;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.facet-group {
    margin-bottom: 1.5rem;
}

.facet-group:last-child {
    margin-bottom: 0;
}

.facet-group label {
    display: block;
    margin-bottom: 0.5rem;
}

.facet-group h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.facet-select {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    color: #333;
    cursor: pointer;
}

.facet-select:hover {
    border-color: #0073aa;
}

.facet-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0, 115, 170, 0.3);
}

.cmip-main {
    display: flex;
    flex-direction: column;
}

.cmip-result-count {
    background-color: #e7f3ff;
    border-left: 4px solid #0073aa;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    color: #0073aa;
}

.cmip-result-count strong {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Results - FULL WIDTH ROWS, no grid */
.cmip-results {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cmip-result-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    width: 100%;
}

.cmip-result-card:hover {
    border-color: #0073aa;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

.cmip-result-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    color: #1a1a1a;
    line-height: 1.4;
}

.cmip-result-card p {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    color: #555;
}

.cmip-result-card p strong {
    color: #1a1a1a;
}

.cmip-card-abstract {
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
    color: #666;
    line-height: 1.6;
    max-height: 90px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.cmip-card-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cmip-view-abstract,
.cmip-view-presentation {
    padding: 0.6rem 1.5rem;
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.cmip-view-abstract:hover,
.cmip-view-presentation:hover:not([disabled]) {
    background-color: #005a87;
}

.cmip-file-unavailable-note {
    background-color: #fff8f0;
    border: 1px solid #ffb84d;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #8a5a00;
    font-size: 0.9rem;
}

.cmip-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
    font-size: 1.1rem;
}

.cmip-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.cmip-page-btn {
    padding: 0.6rem 0.9rem;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
}

.cmip-page-btn:hover {
    background-color: #e0e0e0;
    border-color: #0073aa;
}

.cmip-page-btn.active {
    background-color: #0073aa;
    color: white;
    border-color: #0073aa;
}

.cmip-page-dots {
    padding: 0.6rem 0.5rem;
    color: #999;
}

.cmip-modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.cmip-modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 4px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

/* Used for the presentation viewer - takes up most of the screen */
.cmip-modal-large .cmip-modal-content {
    margin: 2vh auto;
    width: 95vw;
    max-width: 1400px;
    height: 96vh;
    max-height: 96vh;
}

.cmip-presentation-body {
    display: flex;
    flex-direction: column;
    height: calc(96vh - 5rem);
    overflow-y: auto;
}

/* YouTube embed. aspect-ratio keeps the 16:9 player intact at any width
   without the old padding-bottom percentage hack. flex-shrink: 0 stops the
   player being squashed by .cmip-presentation-body's flex layout when a PDF
   embed sits below it - the container scrolls instead. */
.cmip-video-embed {
    position: relative;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 0.75rem;
    aspect-ratio: 16 / 9;
    max-height: 60vh;
    flex-shrink: 0;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
}

.cmip-video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.cmip-video-link {
    margin: 0 0 1.5rem 0;
    text-align: right;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.cmip-video-link a {
    color: #0073aa;
    text-decoration: none;
}

.cmip-video-link a:hover {
    text-decoration: underline;
}

/* Direct link to the recording, sitting alongside the real buttons in
   .cmip-card-actions. It is an <a>, not a <span>: it is styled like a
   button, so it has to behave like one. Opens YouTube in a new tab
   rather than the in-page player, for people who just want the video. */
.cmip-video-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    color: #fff;
    background-color: #0073aa;
    border: 1px solid #0073aa;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.cmip-video-btn:hover,
.cmip-video-btn:focus {
    background-color: #005a87;
    border-color: #005a87;
    color: #fff;
    text-decoration: none;
}

.cmip-pdf-embed {
    flex: 1;
    /* Approx PDF page height on typical viewports. If a video's shown
       above it, the flex container may overflow - .cmip-presentation-body
       has overflow-y: auto to let the user scroll down to the full page. */
    min-height: 80vh;
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.cmip-modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: #1a1a1a;
    padding-right: 2rem;
}

.cmip-modal-body {
    color: #555;
    line-height: 1.8;
    font-size: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cmip-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
}

.cmip-close:hover {
    color: #333;
}

.cmip-error {
    background-color: #fff8f0;
    border: 1px solid #ffb84d;
    border-radius: 4px;
    padding: 1.5rem;
    color: #333;
    margin: 1rem 0;
}

@media (max-width: 768px) {
    .cmip-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .cmip-sidebar {
        position: static;
    }

    .cmip-header h2 {
        font-size: 1.5rem;
    }

    .cmip-modal-content {
        width: 95%;
        margin: 20% auto;
        padding: 1.5rem;
    }

    .cmip-search-input {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .cmip-search-container {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    .cmip-header h2 {
        font-size: 1.25rem;
    }

    .cmip-search-box {
        flex-direction: column;
    }

    .cmip-clear-search {
        width: 100%;
    }

    .cmip-modal-content {
        margin: 50% auto;
    }

    .cmip-pagination {
        gap: 0.25rem;
    }

    .cmip-page-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.85rem;
    }
}
