/* Stylesheet for MacManus Brochures Plugin */

:root {
    --macmanus-primary: #000c34;
    --macmanus-secondary: #0b2347;
    --macmanus-bg-light: #eff3ff;
    --macmanus-bg-lighter: #f2f6ff;
    --macmanus-text: #2f2f2f;
    --macmanus-accent-blue: #0073aa;
    --macmanus-accent-checked: #3182ce;
    --macmanus-border: #ccd2e3;
    --macmanus-font: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
}

.macmanus-brochures-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    font-family: var(--macmanus-font);
    color: var(--macmanus-text);
    margin: 40px 0;
    align-items: start;
}

/* Sidebar Styling */
.macmanus-brochures-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 30px;
    background-color: var(--macmanus-bg-lighter);
    border-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 12, 52, 0.04);
    z-index: 10;
}

.macmanus-brochures-sidebar .sidebar-header-border {
    height: 4px;
    background-color: var(--macmanus-primary);
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    width: 100%;
}

.macmanus-brochures-sidebar .sidebar-content {
    padding: 24px 20px;
}

.macmanus-brochures-sidebar .categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.macmanus-brochures-sidebar .category-item {
    font-size: 15px;
    font-weight: 500;
    color: var(--macmanus-secondary);
    transition: color 0.2s ease;
}

.macmanus-brochures-sidebar .category-item.category-active {
    font-weight: 600;
}

/* Custom Checkbox Design */
.macmanus-brochures-sidebar .custom-checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
}

.macmanus-brochures-sidebar .custom-checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.macmanus-brochures-sidebar .checkbox-checkmark {
    height: 16px;
    width: 16px;
    background-color: transparent;
    border: 1.5px solid var(--macmanus-secondary);
    border-radius: 2px;
    margin-right: 12px;
    position: relative;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* When checked, add a blue background */
.macmanus-brochures-sidebar .custom-checkbox-container input:checked~.checkbox-checkmark {
    background-color: var(--macmanus-accent-checked);
    border-color: var(--macmanus-accent-checked);
}

/* Checkmark indicator symbol */
.macmanus-brochures-sidebar .checkbox-checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

/* Show checkmark when checked */
.macmanus-brochures-sidebar .custom-checkbox-container input:checked~.checkbox-checkmark:after {
    display: block;
}

/* Style the checkmark */
.macmanus-brochures-sidebar .checkbox-checkmark:after {
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Full-width title + search row above the sidebar/grid */
.brochures-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    gap: 20px;
}

.brochures-top-row .header-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--macmanus-secondary);
    margin: 0;
    line-height: 1;
}

/* Search Bar Wrapper */
.brochures-top-row .brochures-search-wrapper {
    display: flex !important;
    align-items: center !important;
    background-color: var(--macmanus-bg-light) !important;
    border: 1px solid var(--macmanus-border) !important;
    border-radius: 50px !important;
    padding: 3px 3px 3px 20px !important;
    width: 320px !important;
    height: 44px !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

.brochures-top-row .brochures-search-wrapper:focus-within {
    border-color: var(--macmanus-secondary);
    box-shadow: 0 0 0 3px rgba(11, 35, 71, 0.1);
}

.brochures-top-row #brochures-search-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    width: 100% !important;
    height: 100% !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    font-family: inherit !important;
    color: var(--macmanus-secondary) !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

.brochures-top-row #brochures-search-submit {
    border: none !important;
    outline: none !important;
    background-color: var(--macmanus-primary) !important;
    color: #ffffff !important;
    border-radius: 50px !important;
    height: 38px !important;
    width: auto !important;
    min-width: 90px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 16px !important;
    margin: 0 !important;
    box-shadow: none !important;
    font-family: inherit !important;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.brochures-top-row #brochures-search-submit:hover {
    background-color: var(--macmanus-secondary);
}

.brochures-top-row #brochures-search-submit:active {
    transform: scale(0.97);
}

.brochures-top-row .search-btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brochures-top-row .search-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid #ffffff;
    border-radius: 50%;
    flex-shrink: 0;
}

.brochures-top-row .search-icon-circle svg {
    width: 10px;
    height: 10px;
}

.brochures-top-row .search-btn-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Brochure Grid */
.macmanus-brochures-content .brochures-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 35px 25px;
    transition: all 0.4s ease;
}

/* Brochure Card */
.macmanus-brochures-content .brochure-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

.macmanus-brochures-content .brochure-card.card-hidden {
    opacity: 0;
    transform: scale(0.85);
    visibility: hidden;
    position: absolute;
    pointer-events: none;
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Clickable cover link wrapper */
.macmanus-brochures-content .brochure-cover-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
}

/* Card Cover Wrapper */
.macmanus-brochures-content .brochure-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 12, 52, 0.08);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s ease;
    background-color: #f7f9fc;
}

.macmanus-brochures-content .brochure-card:hover .brochure-cover-wrapper {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 12, 52, 0.15);
}

.macmanus-brochures-content .brochure-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Premium Fallback CSS Cover Styling */
.macmanus-brochures-content .brochure-css-cover {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.macmanus-brochures-content .css-cover-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?auto=format&fit=crop&w=600&q=80');
    background-size: cover;
    background-position: center;
    transform: scale(1.02);
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.macmanus-brochures-content .brochure-card:hover .css-cover-bg-image {
    transform: scale(1.08);
}

.macmanus-brochures-content .css-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(11, 35, 71, 0.94) 0%, rgba(0, 12, 52, 0.97) 100%);
    opacity: 0.98;
}

.macmanus-brochures-content .css-cover-inner {
    position: relative;
    z-index: 3;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 30px 22px 20px;
    box-sizing: border-box;
    color: #ffffff;
    text-align: left;
}

/* Cover Logo Block */
.macmanus-brochures-content .css-cover-logo-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.macmanus-brochures-content .css-cover-logo-svg {
    margin-bottom: 12px;
}

.macmanus-brochures-content .css-cover-logo-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #ffffff;
    line-height: 1;
}

.macmanus-brochures-content .css-cover-logo-sub {
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 3px;
}

/* Cover Title/Content Block */
.macmanus-brochures-content .css-cover-content-area {
    margin-top: auto;
    margin-bottom: auto;
    padding-right: 15px;
}

.macmanus-brochures-content .css-cover-title {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 10px 0;
    line-height: 1.15;
    font-family: var(--macmanus-font);
}

.macmanus-brochures-content .css-cover-subtitle {
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    line-height: 1.4;
}

/* Cover Footer Block */
.macmanus-brochures-content .css-cover-footer {
    width: 100%;
}

.macmanus-brochures-content .css-cover-badges {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding-top: 8px;
    margin-bottom: 8px;
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
}

.macmanus-brochures-content .css-cover-badge-divider {
    color: rgba(255, 255, 255, 0.3);
}

.macmanus-brochures-content .css-cover-badge-extra {
    font-weight: 500;
}

.macmanus-brochures-content .css-cover-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 6.5px;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.2px;
}

/* Card Action Button */
.macmanus-brochures-content .brochure-actions {
    width: 100%;
    margin-top: 16px;
}

.macmanus-brochures-content .view-brochure-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--macmanus-primary);
    transition: color 0.28s ease;
}

.macmanus-brochures-content .action-text {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.2px;
    margin-right: 10px;
}

.macmanus-brochures-content .action-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--macmanus-primary);
    color: #ffffff;
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 0.28s ease;
}

.macmanus-brochures-content .action-arrow-svg {
    transition: transform 0.28s ease;
}

/* Card Hover Animation */
.macmanus-brochures-content .view-brochure-link:hover {
    color: var(--macmanus-secondary);
}

.macmanus-brochures-content .view-brochure-link:hover .action-icon-circle {
    transform: translateX(4px);
    background-color: var(--macmanus-secondary);
}

.macmanus-brochures-content .no-brochures-found {
    grid-column: 1 / -1;
    font-size: 16px;
    color: var(--macmanus-secondary);
    font-weight: 500;
    text-align: center;
    padding: 40px 0;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .macmanus-brochures-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .macmanus-brochures-sidebar {
        position: static;
        width: 100%;
    }

    .macmanus-brochures-sidebar .categories-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px 20px;
    }

    .macmanus-brochures-content .brochures-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (max-width: 640px) {
    .brochures-top-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .brochures-top-row .brochures-search-wrapper {
        width: 100%;
    }

    .macmanus-brochures-sidebar .categories-list {
        flex-direction: column;
        gap: 12px;
    }

    .macmanus-brochures-content .brochures-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* Loader Styles */
.brochures-grid-wrapper {
    position: relative;
    min-height: 250px;
    width: 100%;
}

.grid-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.brochures-grid-wrapper.is-loading .grid-loader-overlay {
    opacity: 1;
    pointer-events: auto;
}

.macmanus-brochures-content .brochures-grid {
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.brochures-grid-wrapper.is-loading .brochures-grid {
    opacity: 0.35;
    filter: blur(1px);
}

.grid-loader-spinner {
    width: 44px;
    height: 44px;
    border: 3.5px solid var(--macmanus-bg-light);
    border-top: 3.5px solid var(--macmanus-primary);
    border-radius: 50%;
    animation: brochures-spin 0.75s linear infinite;
}

@keyframes brochures-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ============================================
   Brochure Popup Modal
   ============================================ */
.macmanus-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 8, 30, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999 !important;
    display: none !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.macmanus-modal-overlay.is-open {
    display: flex !important;
    opacity: 1;
}

.macmanus-modal-inner {
    position: relative;
    width: var(--mb-popup-width, 1200px);
    max-width: 95vw;
    height: calc(var(--mb-popup-height, 88) * 1vh);
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.92) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.macmanus-modal-overlay.is-open .macmanus-modal-inner {
    transform: scale(1) translateY(0);
}

.macmanus-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--macmanus-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    padding: 0;
}

.macmanus-modal-close:hover {
    background: #1a3a6b;
    transform: scale(1.1);
}

.macmanus-modal-close:active {
    transform: scale(0.95);
}

/* iframe loading spinner */
.macmanus-modal-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f6ff;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.macmanus-modal-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-spinner {
    width: 48px;
    height: 48px;
    border: 3.5px solid #dce5f5;
    border-top: 3.5px solid var(--macmanus-primary);
    border-radius: 50%;
    animation: brochures-spin 0.75s linear infinite;
}

#macmanus-brochure-iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: relative;
    z-index: 6;
}