/* ================================================
   COA Manager v3.1 — Frontend CSS
   ================================================ */

/* ---- Grid ---- */
.coa-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 10px 0;
    align-items: start;
    overflow: clip;
}
.coa-cols-1 { grid-template-columns: repeat(1, 1fr); }
.coa-cols-2 { grid-template-columns: repeat(2, 1fr); }
.coa-cols-3 { grid-template-columns: repeat(3, 1fr); }
.coa-cols-4 { grid-template-columns: repeat(4, 1fr); }

.coa-grid > * {
    min-width: 0;
}

/* ---- Base card ---- */
.coa-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--coa-card-border, #e8e8e8);
    border-radius: var(--coa-card-radius, 12px);
    overflow: hidden;
    transition: box-shadow 0.22s ease, transform 0.22s ease;
    text-decoration: none;
    color: inherit;
    isolation: isolate;
    min-width: 0;
}

.coa-card:hover {
    box-shadow: 0 10px 30px var(--coa-card-shadow, rgba(0, 0, 0, 0.10));
    transform: translateY(-3px);
}

/* ---- Card media area ---- */
.coa-card__media {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #f4f4f4;
    flex-shrink: 0;
}

/* ---- Media link (wraps media for single-image + PDF cards) ---- */
.coa-card__media-link {
    display: block;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

/* ---- Single image ---- */
.coa-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #f7f8fa;
}

/* ================================================
   CAROUSEL
   ================================================ */

.coa-carousel {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(255,255,255,0.16), transparent 36%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.02), rgba(15, 23, 42, 0.14));
}

.coa-carousel__viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.coa-carousel__track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.coa-carousel__slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.coa-carousel__slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.04) 0%, rgba(15, 23, 42, 0) 35%, rgba(15, 23, 42, 0.12) 100%);
    pointer-events: none;
}

.coa-carousel__img-link {
    display: block;
    position: relative;
    inset: 0;
    text-decoration: none;
    width: 100%;
    height: 100%;
}

/* ---- Prev / Next buttons ---- */
.coa-carousel__btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #222;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, transform 0.2s ease;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
}

.coa-card--carousel:hover .coa-carousel__btn,
.coa-card--carousel:focus-within .coa-carousel__btn {
    opacity: 1;
}

.coa-carousel__btn--prev { left: 12px; }
.coa-carousel__btn--next { right: 12px; }

.coa-carousel__btn:hover {
    background: #ffffff;
    transform: translateY(-50%) scale(1.05);
}

.coa-carousel__status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.68);
    color: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
    backdrop-filter: blur(8px);
}

.coa-carousel__count {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ---- Dot indicators ---- */
.coa-carousel__dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 20;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.44);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(8px);
}

.coa-carousel__dot {
    width: 9px;
    height: 8px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, transform 0.2s ease, width 0.2s ease;
}

.coa-carousel__dot.is-active {
    background: #ffffff;
    width: 22px;
    transform: none;
}

/* On mobile show buttons at all times (no hover on touch) */
@media (hover: none) {
    .coa-carousel__btn {
        opacity: 0.7;
    }
}

/* ================================================
   PDF CARD
   ================================================ */

/* Transparent click-catcher above iframe — desktop only */
.coa-pdf-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: transparent;
    cursor: pointer;
}

/* PDF iframe — desktop only */
.coa-pdf-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    display: block;
    background: #fff;
}

/* ---- Mobile PDF placeholder ---- */
/* Hidden on desktop; shown on mobile where iframes don't render PDFs */
.coa-pdf-mobile-placeholder {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 15;           /* above iframe(z:auto) and overlay(z:10) */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: linear-gradient(145deg, #f0f4f8 0%, #e8edf2 100%);
    pointer-events: none;  /* parent <a> handles the click */
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.coa-pdf-mobile-placeholder::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.22));
}

.coa-pdf-mobile-placeholder--image::before {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.04), rgba(15, 23, 42, 0.34));
}

.coa-pdf-mobile-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    max-width: 90%;
}

.coa-pdf-icon {
    width: 52px;
    height: 52px;
    color: #e53e3e;        /* red PDF colour */
    flex-shrink: 0;
}

.coa-pdf-mobile-name {
    font-size: 13px;
    font-weight: 700;
    color: #222;
    text-align: center;
    line-height: 1.3;
    max-width: 90%;
    /* clamp to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.coa-pdf-mobile-placeholder--image .coa-pdf-mobile-name {
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(15, 23, 42, 0.55);
}

.coa-pdf-mobile-cta {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: #e53e3e;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.02em;
    margin-top: 2px;
    box-shadow: 0 10px 20px rgba(229, 62, 62, 0.22);
}

/* ================================================
   CARD FOOTER — centred, theme-proof
   ================================================ */

.coa-card__footer {
    padding: 12px 16px;
    border-top: 1px solid #f0f0f0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.coa-card .coa-card__label {
    font-size: var(--coa-label-size, 14px);
    font-weight: 600;
    color: #111111 !important;
    margin: 0;
    line-height: 1.35;
    text-align: center;
}

.coa-card .coa-card__label-link {
    display: block;
    font-size: var(--coa-label-size, 14px);
    font-weight: 600;
    color: #111111 !important;
    margin: 0;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    transition: color 0.15s ease;
}

.coa-card .coa-card__label-link:hover {
    color: var(--coa-btn-bg, #0071a1) !important;
    text-decoration: underline;
}

/* ---- Empty state ---- */
.coa-empty {
    padding: 20px 0;
    color: #888;
    font-style: italic;
}

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

@media ( max-width: 1024px ) {
    .coa-grid,
    .coa-cols-3,
    .coa-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: hide iframe, show placeholder */
@media ( max-width: 768px ) {
    .coa-grid {
        gap: 16px;
    }

    .coa-card {
        transform: none !important;
    }

    .coa-carousel__btn {
        width: 36px;
        height: 36px;
        font-size: 22px;
        opacity: 0.88;
    }

    .coa-carousel__status {
        top: 10px;
        right: 10px;
    }

    .coa-carousel__dots {
        bottom: 10px;
        gap: 6px;
        padding: 7px 10px;
    }

    .coa-pdf-iframe,
    .coa-pdf-overlay {
        display: none;
    }

    .coa-pdf-mobile-placeholder {
        display: flex;
    }
}

@media ( max-width: 600px ) {
    .coa-grid,
    .coa-cols-2,
    .coa-cols-3,
    .coa-cols-4 {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .coa-card__media {
        aspect-ratio: auto;
        height: clamp(280px, 88vw, 420px);
    }

    .coa-card__footer {
        padding: 12px 14px;
    }

    .coa-carousel__btn--prev {
        left: 10px;
    }

    .coa-carousel__btn--next {
        right: 10px;
    }
}
