/* ============================================
   COA Manager – Frontend Styles
   Color: #012D6B (navy blue) + black + white
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;900&family=Barlow:wght@400;500;600&display=swap');

#coam-app {
    background: #000;
    min-height: 100vh;
    padding: 0 0 80px;
    font-family: 'Barlow', sans-serif;
    color: #fff;
}

/* ── HEADER ── */
.coam-header {
    text-align: center;
    padding: 60px 20px 40px;
    background: #012D6B;
    border-bottom: 3px solid #01204e;
}

.coam-main-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: #fff;
    text-transform: uppercase;
    margin: 0;
}

/* ── CONTROLS ── */
.coam-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    max-width: 1200px;
    margin: 0 auto 36px;
    padding: 24px 24px 0;
}

.coam-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.coam-sort-label {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .12em;
    color: #aaa;
    text-transform: uppercase;
    margin-right: 4px;
}

.coam-sort-btn {
    background: #111;
    color: #ccc;
    border: 1px solid #333;
    border-radius: 50px;
    padding: 7px 18px;
    font-size: .82rem;
    font-family: 'Barlow', sans-serif;
    font-weight: 600;
    letter-spacing: .06em;
    cursor: pointer;
    transition: all .2s;
}

.coam-sort-btn:hover,
.coam-sort-btn.active {
    background: #012D6B;
    color: #fff;
    border-color: #012D6B;
    box-shadow: 0 0 18px rgba(1,45,107,0.5);
}

/* ── SEARCH ── */
.coam-search-wrap {
    position: relative;
}

.coam-search-wrap input {
    background: #111;
    border: 1px solid #333;
    border-radius: 50px;
    color: #fff;
    font-family: 'Barlow', sans-serif;
    font-size: .88rem;
    padding: 9px 18px 9px 42px;
    width: 240px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.coam-search-wrap input::placeholder { color: #666; }

.coam-search-wrap input:focus {
    border-color: #012D6B;
    box-shadow: 0 0 0 3px rgba(1,45,107,0.3);
}

.coam-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #666;
    pointer-events: none;
}

/* ── GRID ── */
.coam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.coam-loading,
.coam-empty {
    grid-column: 1/-1;
    text-align: center;
    color: #666;
    padding: 60px 0;
    font-size: 1rem;
    letter-spacing: .08em;
}

/* ── CARD ── */
.coam-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 14px;
    overflow: hidden;
    transition: transform .25s, box-shadow .25s;
    display: flex;
    flex-direction: column;
}

.coam-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.6), 0 0 0 1px #012D6B88;
}

.coam-card-header {
    padding: 16px 16px 10px;
}

.coam-card-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #fff;
    margin: 0 0 10px;
}

/* ── BATCH BADGES ── */
.coam-batches {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.coam-batch-pill {
    background: #012D6B;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    padding: 3px 10px;
    border-radius: 50px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background .15s, border-color .15s;
}

.coam-batch-pill:hover,
.coam-batch-pill.selected {
    background: #01204e;
    border-color: #4a7fd4;
}

/* ── THUMBNAIL ── */
.coam-thumb-wrap {
    background: #1a1a1a;
    margin: 10px 14px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: opacity .2s;
    border: 1px solid #2a2a2a;
}

.coam-thumb-wrap:hover { opacity: .85; }

.coam-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* PDF thumbnail wrapper */
.coam-pdf-thumb {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #fff;
}

.coam-pdf-thumb canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Overlay to block iframe interaction */
.coam-pdf-thumb-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: pointer;
}

/* Fallback icon if PDF.js not available */
.coam-pdf-icon-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #012D6B;
}

.coam-pdf-icon-fallback svg { width: 52px; height: 52px; }
.coam-pdf-icon-fallback span {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .1em;
    color: #555;
    text-transform: uppercase;
}

/* ── VIEW BUTTON ── */
.coam-view-btn {
    display: block;
    margin: auto 14px 16px;
    background: #012D6B;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 13px 0;
    font-family: 'Barlow Condensed', sans-serif;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    cursor: pointer;
    text-align: center;
    transition: background .2s, box-shadow .2s;
    width: calc(100% - 28px);
}

.coam-view-btn:hover {
    background: #01204e;
    box-shadow: 0 6px 24px rgba(1,45,107,0.5);
}

/* ── LIGHTBOX ── */
.coam-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coam-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(6px);
}

.coam-lightbox-inner {
    position: relative;
    z-index: 1;
    background: #111;
    border: 1px solid #333;
    border-radius: 16px;
    width: min(92vw, 900px);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 80px rgba(0,0,0,0.8);
}

.coam-lightbox-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: #012D6B;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 34px;
    text-align: center;
    z-index: 2;
    transition: background .15s;
}

.coam-lightbox-close:hover { background: #01204e; }

#coam-lightbox-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Image: fully visible, no zoom, no crop */
#coam-lightbox-content img {
    max-width: 100%;
    max-height: calc(90vh - 80px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

#coam-lightbox-content iframe {
    width: 100%;
    min-height: 70vh;
    border: none;
    border-radius: 8px;
}

/* ── ANIMATIONS ── */
@keyframes coamFadeIn {
    from { opacity:0; transform:translateY(14px); }
    to   { opacity:1; transform:translateY(0); }
}

.coam-card {
    animation: coamFadeIn .35s ease both;
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
    .coam-controls { flex-direction: column; align-items: flex-start; }
    .coam-search-wrap input { width: 100%; }
    .coam-search-wrap { width: 100%; }
    .coam-grid { grid-template-columns: 1fr; }
}
