/**
 * Widget QR della dashboard
 *
 * Stava dentro dashboard.php, in un blocco <style> in mezzo al markup.
 * Riguarda un pezzo solo: il riquadro che genera e mostra il QR.
 *
 * SI CARICA NELLO STESSO IDENTICO PUNTO in cui stava il blocco. Non e' un
 * dettaglio: nel CSS a parita' di specificita' vince chi arriva dopo, e queste
 * regole erano scritte per sovrascrivere quelle dei fogli caricati sopra.
 * Spostarle piu' in alto ne farebbe smettere di funzionare una parte, in modo
 * sparso e difficile da collegare alla causa.
 */

/* -- QR Widget ------------------------------------------------- */
.qr-widget {
    background: rgba(76,175,80,.07);
    border: 1.5px solid #D8EDD8;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 24px;
}

/* Stato: genera */
.qr-generate-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.qr-generate-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.qr-icon-wrap { font-size: 28px; line-height: 1; flex-shrink: 0; }
.qr-widget-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.qr-widget-sub   { font-size: 12px; color: var(--text2); max-width: 360px; }
.qr-generate-right { display: flex; align-items: center; gap: 10px; }

.qr-page-select {
    background: #ffffff;
    border: 1.5px solid #D8EDD8;
    border-radius: 8px;
    color: #1A2E1A;
    font-size: 13px;
    padding: 7px 12px;
    cursor: pointer;
    max-width: 200px;
    outline: none;
}
.qr-page-select option {
    background: #ffffff;
    color: #1A2E1A;
}
.qr-btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: var(--accent, #388E3C);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
    white-space: nowrap;
}
.qr-btn-generate:hover   { opacity: .85; }
.qr-btn-generate:disabled { opacity: .5; cursor: default; }
.qr-no-pages { font-size: 12px; color: var(--text3); }

/* Stato: QR attivo */
.qr-active-state {
    display: flex;
    align-items: center;
    gap: 18px;
}
.qr-thumb-wrap {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #D8EDD8;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qr-thumb-wrap > div { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.qr-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(26,46,26,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity .15s;
}
.qr-thumb-wrap:hover .qr-thumb-overlay { opacity: 1; }

.qr-active-info { flex: 1; }
.qr-active-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.qr-active-dest  { font-size: 12px; color: var(--text2); margin-bottom: 10px; }
.qr-active-dest strong { color: #388E3C; }

.qr-change-row { display: flex; align-items: center; gap: 8px; }
.qr-btn-change {
    padding: 5px 12px;
    background: rgba(76,175,80,.12);
    color: #388E3C;
    border: 1.5px solid #D8EDD8;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.qr-btn-change:hover { background: rgba(76,175,80,.22); border-color: #4CAF50; }

/* -- Modal ----------------------------------------------------- */
.qr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,46,26,.55);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.qr-modal {
    background: #ffffff;
    border: 1.5px solid #D8EDD8;
    border-radius: 16px;
    padding: 28px 32px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    position: relative;
    animation: qrModalIn .2s ease;
    box-shadow: 0 8px 32px #D8EDD8;
}
@keyframes qrModalIn {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.qr-modal-close {
    position: absolute;
    top: 14px; right: 16px;
    background: none; border: none;
    color: var(--text3); font-size: 18px;
    cursor: pointer; line-height: 1;
    transition: color .15s;
}
.qr-modal-close:hover { color: var(--text); }
.qr-modal-title {
    font-size: 17px; font-weight: 700; color: var(--text);
    margin-bottom: 6px;
}
.qr-modal-url {
    font-size: 11px; color: var(--text3);
    font-family: monospace; margin-bottom: 20px;
    word-break: break-all;
}
.qr-modal-canvas {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(26,46,26,.04);
}
.qr-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.qr-action-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    border: 1px solid transparent;
}
.qr-action-save {
    background: #388E3C;
    color: #fff;
    border-color: #388E3C;
}
.qr-action-save:hover { opacity: .85; }
.qr-action-share {
    background: rgba(0,0,0,.04);
    color: var(--text2);
    border-color: rgba(0,0,0,.12);
}
.qr-action-share:hover { color: var(--text); background: rgba(26,46,26,.04); }
