/* =============================================
   CROA Manager — Frontend CSS
   ============================================= */

.croa-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 0;
}

/* --- Grille --- */
.croa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* --- Carte CROA --- */
.croa-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}

.croa-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,.14);
}

/* --- Miniature --- */
.croa-thumb-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3/4;
    background: #f0f4f8;
}

.croa-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}

.croa-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.croa-thumb-placeholder svg {
    width: 60%;
    height: auto;
    opacity: .6;
}

/* --- Overlay au hover --- */
.croa-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s;
}

.croa-item:hover .croa-overlay { opacity: 1; }
.croa-item:hover .croa-thumb   { transform: scale(1.04); }

.croa-open-btn {
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    padding: .4rem .9rem;
    border: 2px solid #fff;
    border-radius: 20px;
    letter-spacing: .03em;
}

/* --- Infos --- */
.croa-info {
    padding: .6rem .8rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    border-top: 1px solid #eef0f3;
}

.croa-title {
    font-size: .85rem;
    font-weight: 600;
    color: #1a202c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.croa-date {
    font-size: .75rem;
    color: #718096;
    text-transform: capitalize;
}

/* --- Pagination --- */
.croa-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.croa-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .6rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: #fff;
    color: #2d3748;
    text-decoration: none;
    font-size: .875rem;
    transition: background .15s, color .15s;
}

.croa-page-btn:hover {
    background: #ebf4ff;
    border-color: #3182ce;
    color: #2b6cb0;
}

.croa-page-btn.active {
    background: #3182ce;
    border-color: #3182ce;
    color: #fff;
    font-weight: 700;
}

.croa-empty {
    text-align: center;
    color: #718096;
    padding: 3rem 0;
    font-style: italic;
}

/* =============================================
   Modale PDF
   ============================================= */

.croa-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.croa-modal[hidden] { display: none; }

.croa-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.croa-modal-box {
    position: relative;
    z-index: 1;
    width: min(95vw, 900px);
    height: min(90vh, 820px);
    background: #1a202c;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,.6);
}

.croa-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: #2d3748;
    color: #e2e8f0;
    gap: 1rem;
}

.croa-modal-title {
    font-size: .95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.croa-modal-actions {
    display: flex;
    gap: .5rem;
    flex-shrink: 0;
}

.croa-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .35rem .75rem;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, color .15s;
    text-decoration: none;
}

.croa-btn-dl {
    background: #38a169;
    color: #fff;
}
.croa-btn-dl:hover { background: #2f855a; color: #fff; }

.croa-btn-close {
    background: #e53e3e;
    color: #fff;
}
.croa-btn-close:hover { background: #c53030; }

.croa-modal-body {
    flex: 1;
    overflow: hidden;
}

/* Navigation PDF */
.croa-nav-btn {
    background: #4a5568;
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    padding: .3rem .65rem;
    min-width: 32px;
}
.croa-nav-btn:hover:not(:disabled) { background: #2d3748; }
.croa-nav-btn:disabled { opacity: .35; cursor: default; }

.croa-page-info {
    color: #a0aec0;
    font-size: .8rem;
    min-width: 50px;
    text-align: center;
    align-self: center;
}

/* Corps de la modale avec scroll */
.croa-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #525659;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
}

#croa-pdf-canvas {
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
    display: block;
}
/* Mobile */
@media (max-width: 600px) {
    .croa-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .croa-modal-box {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }
}
