/* ==========================================================================
   jeux-print.css — Card Library Grid, Modal Dialogs, Printable Sheet Studio
   (@media print), Home / Overview Index View, CPF Donate Card & Scanner PWA
   ========================================================================== */

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.filter-btn {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 38px;
}

.filter-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.cards-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
    max-height: 680px;
    overflow-y: auto;
    padding-inline-end: 0.25rem;
}

.library-card-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.6rem;
}

.library-card-prompt {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}

.library-card-answer {
    font-size: 0.85rem;
    color: #047857;
    background: #ecfdf5;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
}

.library-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

/* ==========================================================================
   Modal Dialogs (<dialog closedby="any">)
   ========================================================================== */
.jeux-dialog {
    margin: auto;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 500px;
    width: calc(100% - 2rem);
    box-shadow: var(--shadow-md);
    color: var(--text-main);
}

.jeux-dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.dialog-inner {
    padding: 1.5rem;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-block-end: 0.5rem;
}

.btn-icon-close {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
}

.dialog-lead {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-block-end: 1rem;
}

.password-input-wrap {
    display: flex;
    gap: 0.4rem;
}

.btn-password-toggle {
    min-width: 48px;
    min-height: 48px;
    background: #f8fafc;
    border: 1px solid #94a3b8;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.1rem;
}

.dialog-actions {
    display: flex;
    gap: 0.75rem;
    margin-block-start: 1rem;
}

/* ==========================================================================
   Printable Sheet Area (Screen Preview + @media print Output)
   ========================================================================== */
.printable-sheet-area {
    max-width: 1280px;
    margin: 0 auto 2.5rem;
    padding-inline: 1.25rem;
    display: none;
}

.printable-sheet-area.visible {
    display: block;
}

.privacy-key-notice {
    background: var(--emerald-bg);
    border: 2px solid var(--emerald);
    color: #064e3b;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    margin-block-top: 0.75rem;
}

.print-section-heading {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    margin-block: 1rem 0.65rem;
    padding-block-end: 0.3rem;
    border-block-end: 2px solid #cbd5e1;
}

.print-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.print-card {
    background: #ffffff;
    border: 2px dashed #475569;
    border-radius: 12px;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 118px;
    gap: 12px;
    align-items: center;
    break-inside: avoid;
    page-break-inside: avoid;
}

.print-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #312e81;
    margin-block-end: 6px;
}

.print-card-prompt {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
}

.print-card-id {
    font-size: 0.75rem;
    color: #64748b;
}

.print-qr-box {
    width: 112px;
    height: 112px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px;
    background: #ffffff;
}

.print-qr-box svg {
    width: 100%;
    height: 100%;
    display: block;
}

.print-badges-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.print-badge-card {
    background: #ffffff;
    border: 2px dashed #3730a3;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.print-badge-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
}

/* Client-Side-Only Teacher Desk Key Table */
.teacher-key-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.teacher-key-table th,
.teacher-key-table td {
    border: 1px solid #475569;
    padding: 0.65rem 0.85rem;
    text-align: left;
}

.teacher-key-table th {
    background: #e0e7ff;
    color: #1e1b4b;
}

.ephemeral-name-input {
    border: 1px dashed #94a3b8 !important;
    min-height: 38px !important;
    padding: 0.35rem 0.6rem !important;
}

/* Footer */
.jeux-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

/* ==========================================================================
   Home / Overview Index View & Standalone Scanner PWA Styles
   ========================================================================== */
.home-hero-card {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
    color: #ffffff;
    padding: 2rem;
    margin-block-end: 1.75rem;
    border: none;
}

.home-hero-card h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(1.55rem, 3vw, 2.25rem);
    line-height: 1.2;
    margin: 0.75rem 0;
    color: #ffffff;
}

.home-hero-lead {
    font-size: 1.06rem;
    line-height: 1.6;
    color: #e0e7ff;
    max-width: 72ch;
    margin-block-end: 1.35rem;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.home-hero-actions a.btn-secondary {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
    text-decoration: none;
}

.home-steps-section {
    margin-block-end: 1.75rem;
}

.home-steps-section > h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.35rem;
    margin-block-end: 1rem;
    color: #1e1b4b;
}

.home-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.step-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.65rem;
}

.step-num-badge {
    display: inline-block;
    align-self: flex-start;
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
}

.step-card h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    margin: 0;
}

.step-card p {
    font-size: 0.94rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    flex: 1;
}

.home-bottom-grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 920px) {
    .home-bottom-grid {
        grid-template-columns: 1fr;
    }
}

.scanner-shortcut-panel {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1.25rem;
    align-items: center;
    border: 2px solid #6366f1;
    background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
}

@media (max-width: 640px) {
    .scanner-shortcut-panel {
        grid-template-columns: 1fr;
    }
}

.scanner-url-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    background: #1e1b4b;
    color: #ffffff;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    margin: 0.75rem 0;
}

.scanner-url-box code {
    font-size: 0.95rem;
    font-weight: 700;
    color: #a5b4fc;
    flex: 1;
    word-break: break-all;
}

.homescreen-steps {
    padding-inline-start: 1.2rem;
    margin: 0.5rem 0 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #334155;
}

.homescreen-steps li {
    margin-block-end: 0.35rem;
}

.shortcut-qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.85rem;
}

.home-scanner-qr-svg {
    width: 155px;
    height: 155px;
}

.home-scanner-qr-svg svg {
    width: 100%;
    height: 100%;
    display: block;
}

.qr-caption {
    font-size: 0.8rem;
    color: #475569;
    margin-block-start: 0.45rem;
}

.home-side-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cpf-donate-panel {
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
    border: 2px solid #f43f5e;
}

.cpf-badge {
    display: inline-block;
    background: #be123c;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    margin-block-end: 0.5rem;
}

.cpf-donate-panel h2 {
    font-family: 'Fredoka', sans-serif;
    color: #881337;
    margin: 0.25rem 0 0.5rem;
    font-size: 1.25rem;
}

.cpf-donate-panel p {
    color: #4c0519;
    font-size: 0.94rem;
    line-height: 1.5;
    margin: 0 0 0.75rem;
}

.btn-cpf-donate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    background: #be123c;
    color: #ffffff;
    font-weight: 700;
    border-radius: var(--radius-md);
    text-decoration: none;
    text-align: center;
    transition: background 0.15s ease;
}

.btn-cpf-donate:hover {
    background: #9f1239;
}

.companion-apps-panel h3 {
    font-family: 'Fredoka', sans-serif;
    margin: 0 0 0.65rem;
    font-size: 1.08rem;
}

.companion-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.companion-links-list a {
    display: block;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-main);
}

.companion-links-list a:hover {
    border-color: var(--primary);
    background: #eef2ff;
}

.companion-links-list strong {
    display: block;
    color: var(--primary);
    margin-block-end: 0.2rem;
}

.companion-links-list span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Standalone Scanner App (/scan) Banner & Layout */
.scanner-class-picker select {
    min-height: 40px;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
    max-width: 240px;
}

.pwa-install-banner {
    background: #fef3c7;
    border-bottom: 2px solid #f59e0b;
    padding: 0.85rem 1.25rem;
}

.pwa-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.92rem;
    color: #78350f;
}

.pwa-banner-inner p {
    margin: 0.3rem 0 0;
    line-height: 1.45;
}

/* ==========================================================================
   @media print — Clean Cut-Ready Classroom Sheets
   ========================================================================== */
@media print {
    body {
        background: #ffffff;
        color: #000000;
    }

    .no-print {
        display: none !important;
    }

    .printable-sheet-area {
        display: block !important;
        margin: 0;
        padding: 0;
        max-width: 100%;
    }

    .ephemeral-name-input {
        border: none !important;
        padding: 0 !important;
    }
}
