/**
 * BMV Certificates Stylesheet
 * Responsive CSS Grid on Desktop + Horizontal Scroll-Snap Slider on Mobile
 */

/* Master Wrapper */
.bmv-certificates-master-wrapper {
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 15px 50px 15px;
    font-family: inherit;
    color: #1e293b;
}

/* Quick Jump Nav */
.bmv-cert-quick-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 18px;
    margin-bottom: 35px;
    box-sizing: border-box;
    max-width: 100%;
}
.bmv-cert-quick-nav-title {
    font-weight: 700;
    font-size: 13.5px;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.bmv-cert-nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    max-width: 100%;
}
.bmv-cert-nav-pill {
    display: inline-block;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #17469e;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
}
.bmv-cert-nav-pill:hover {
    background: #17469e;
    color: #ffffff;
    border-color: #17469e;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(23, 70, 158, 0.2);
}

/* Certificate Set Section */
.bmv-cert-set-section {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    padding: 28px 24px 32px 24px;
    margin-bottom: 40px;
    position: relative;
    scroll-margin-top: 100px;
}

/* Prominent Title & Header */
.bmv-cert-set-header {
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 18px;
    margin-bottom: 24px;
}
.bmv-cert-set-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
.bmv-cert-ribbon-badge {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #17469e 0%, #0d2b63 100%);
    color: #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(23, 70, 158, 0.25);
    margin-top: 2px;
}
.bmv-cert-meta-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.bmv-cert-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.bmv-cert-pill-primary {
    background: rgba(23, 70, 158, 0.1);
    color: #17469e;
}
.bmv-cert-pill-count {
    background: #f1f5f9;
    color: #64748b;
}
.bmv-cert-pill-count .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
}
.bmv-cert-set-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    margin: 0;
}
.bmv-cert-set-desc {
    margin-top: 12px;
    color: #475569;
    font-size: 14.5px;
    line-height: 1.6;
}
.bmv-cert-set-desc p {
    margin: 0;
}

/* Mobile swipe hint */
.bmv-cert-swipe-hint {
    display: none;
    margin-top: 12px;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    padding: 5px 12px;
    border-radius: 6px;
    width: fit-content;
}

/* === GALLERY CONTAINER (DESKTOP: CSS GRID) === */
.bmv-cert-gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 22px;
}

/* Single Certificate Card */
.bmv-cert-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}
.bmv-cert-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(23, 70, 158, 0.12);
    border-color: #cbd5e1;
}
.bmv-cert-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* Certificate Image Frame */
.bmv-cert-image-frame {
    position: relative;
    width: 100%;
    height: 320px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}
.bmv-cert-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.4s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-radius: 4px;
    background: #ffffff;
}
.bmv-cert-card:hover .bmv-cert-img {
    transform: scale(1.03);
}

/* Card Hover Overlay */
.bmv-cert-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 2;
}
.bmv-cert-card:hover .bmv-cert-overlay {
    opacity: 1;
}
.bmv-cert-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(10px);
    transition: transform 0.25s ease;
}
.bmv-cert-card:hover .bmv-cert-action-btn {
    transform: translateY(0);
}
.bmv-btn-pdf {
    background: #e11d48;
    color: #ffffff;
}
.bmv-btn-zoom {
    background: #17469e;
    color: #ffffff;
}

/* Corner Badges (PDF vs IMAGE) */
.bmv-cert-corner-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}
.bmv-badge-pdf {
    background: #e11d48;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.35);
}
.bmv-badge-img {
    background: #0284c7;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

/* Caption and Action Footer */
.bmv-cert-caption-wrap {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
    background: #ffffff;
}
.bmv-cert-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.45;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bmv-cert-action-label {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
}
.bmv-label-pdf {
    color: #e11d48;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.bmv-label-zoom {
    color: #0284c7;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* === MOBILE HORIZONTAL SLIDER (MAX-WIDTH: 768PX) === */
@media (max-width: 768px) {
    /* Quick Jump Nav on Mobile - Horizontal Chip Scroll (No Overflow) */
    .bmv-cert-quick-nav {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 12px 14px 10px 14px !important;
        margin-bottom: 22px !important;
        gap: 8px !important;
        border-radius: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    .bmv-cert-quick-nav-title {
        font-size: 11px !important;
        color: #64748b !important;
        letter-spacing: 0.4px !important;
    }
    .bmv-cert-nav-pills {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x mandatory !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 2px 2px 6px 2px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    .bmv-cert-nav-pills::-webkit-scrollbar {
        height: 4px !important;
    }
    .bmv-cert-nav-pills::-webkit-scrollbar-track {
        background: #f1f5f9 !important;
        border-radius: 4px !important;
    }
    .bmv-cert-nav-pills::-webkit-scrollbar-thumb {
        background: #cbd5e1 !important;
        border-radius: 4px !important;
    }
    .bmv-cert-nav-pill {
        flex: 0 0 auto !important;
        flex-shrink: 0 !important;
        font-size: 12px !important;
        padding: 6px 12px !important;
        border-radius: 16px !important;
        white-space: nowrap !important;
        max-width: 78vw !important;
        text-overflow: ellipsis !important;
        overflow: hidden !important;
        scroll-snap-align: start !important;
        box-sizing: border-box !important;
    }

    .bmv-cert-set-section {
        padding: 20px 14px 22px 14px;
        border-radius: 12px;
        margin-bottom: 25px;
    }
    .bmv-cert-set-title-wrap {
        gap: 10px !important;
    }
    .bmv-cert-ribbon-badge {
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
    }
    .bmv-cert-ribbon-badge svg {
        width: 17px !important;
        height: 17px !important;
    }
    .bmv-cert-meta-tags {
        gap: 5px !important;
        margin-bottom: 5px !important;
    }
    .bmv-cert-pill-badge {
        font-size: 9.5px !important;
        padding: 2px 7px !important;
        border-radius: 12px !important;
        letter-spacing: 0.2px !important;
        line-height: 1.3 !important;
        white-space: nowrap !important;
    }
    .bmv-cert-pill-count .dashicons {
        font-size: 11px !important;
        width: 11px !important;
        height: 11px !important;
    }
    .bmv-cert-set-title {
        font-size: 17px !important;
        line-height: 1.35 !important;
    }
    .bmv-cert-set-desc {
        font-size: 13.5px !important;
        line-height: 1.55 !important;
        margin-top: 8px !important;
    }
    .bmv-cert-swipe-hint {
        display: block;
    }

    /* Convert Grid to Horizontal Scrollable Slide */
    .bmv-cert-gallery-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 14px !important;
        padding: 4px 4px 14px 4px !important;
        margin: 0 -4px;
    }

    /* Styled Horizontal Scrollbar */
    .bmv-cert-gallery-container::-webkit-scrollbar {
        height: 6px;
    }
    .bmv-cert-gallery-container::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 10px;
    }
    .bmv-cert-gallery-container::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }
    .bmv-cert-gallery-container::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }

    /* Each card is a fixed width slide */
    .bmv-cert-card {
        flex: 0 0 76% !important;
        max-width: 270px !important;
        min-width: 230px !important;
        scroll-snap-align: start !important;
        scroll-snap-stop: always !important;
    }
    .bmv-cert-image-frame {
        height: 260px;
    }
}

/* === FULLSCREEN MODERN LIGHTBOX MODAL === */
.bmv-cert-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.bmv-cert-lightbox.is-open {
    display: flex;
    opacity: 1;
}
.bmv-cert-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
}
.bmv-cert-lightbox-dialog {
    position: relative;
    z-index: 10;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.bmv-cert-lightbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    max-height: 85vh;
}
.bmv-cert-lightbox-content img {
    max-width: 90vw;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    background: #ffffff;
    user-select: none;
}
.bmv-cert-lightbox-caption {
    margin-top: 14px;
    color: #f8fafc;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    max-width: 700px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}
.bmv-cert-lightbox-close {
    position: absolute;
    top: -46px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 30px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.bmv-cert-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg);
}
.bmv-cert-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    font-size: 22px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    backdrop-filter: blur(4px);
}
.bmv-cert-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.35);
}
.bmv-cert-lightbox-prev {
    left: -60px;
}
.bmv-cert-lightbox-next {
    right: -60px;
}

@media (max-width: 768px) {
    .bmv-cert-lightbox-prev {
        left: 10px;
    }
    .bmv-cert-lightbox-next {
        right: 10px;
    }
    .bmv-cert-lightbox-close {
        top: -40px;
        right: 10px;
    }
    .bmv-cert-lightbox-caption {
        font-size: 13px;
        padding: 0 10px;
    }
}
