/* ─── Tango Festival — Admin App (shortcode [tf_admin]) ──────────
   Mobile-first SPA per gestione partecipanti su pagina pubblica.
   Stesso linguaggio visivo di form.css (card bianche, viola/indaco). */

.tf-admin-app, .tf-admin-app * {
    box-sizing: border-box;
}
.tf-admin-app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1e293b;
    line-height: 1.5;
    font-size: 15px;
}

.tf-admin-loading {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 16px;
}

/* ── Header app ───────────────────────────────────────────────── */
.tfaa-header {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.tfaa-header-title {
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
}
.tfaa-header-user {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    color: #64748b;
}
.tfaa-logout {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #64748b;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
}
.tfaa-logout:hover { color: #dc2626; border-color: #fecaca; }

/* ── Login OTP ────────────────────────────────────────────────── */
.tfaa-login {
    max-width: 420px;
    margin: 40px auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 28px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.tfaa-login h2 {
    margin: 0 0 6px;
    font-size: 22px;
    color: #0f172a;
}
.tfaa-login p.tfaa-login-sub {
    margin: 0 0 18px;
    color: #64748b;
    font-size: 14px;
}
.tfaa-login label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    margin-bottom: 4px;
}
.tfaa-login input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 14px;
    background: #fff;
    color: #1e293b;
}
.tfaa-login input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.tfaa-login button {
    width: 100%;
    padding: 11px;
    border: 0;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background .15s;
}
.tfaa-login button:hover { background: #1e293b; }
.tfaa-login button:disabled { background: #94a3b8; cursor: not-allowed; }
.tfaa-login .tfaa-login-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    border-left: 3px solid #dc2626;
}
.tfaa-login .tfaa-login-info {
    background: #eff6ff;
    color: #1e3a8a;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    border-left: 3px solid #3b82f6;
}
.tfaa-login .tfaa-link {
    color: #6366f1;
    background: transparent;
    border: 0;
    padding: 0;
    margin-top: 10px;
    width: auto;
    font-size: 13px;
    cursor: pointer;
}
.tfaa-login .tfaa-link:hover { background: transparent; text-decoration: underline; }

/* ── Toolbar (event selector + search + filters) ──────────────── */
.tfaa-toolbar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.tfaa-toolbar-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}
.tfaa-toolbar-row:last-child { margin-bottom: 0; }
.tfaa-event-select,
.tfaa-search {
    flex: 1;
    min-width: 200px;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #1e293b;
}
.tfaa-search:focus, .tfaa-event-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* ── Chips filtro stato ───────────────────────────────────────── */
.tfaa-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.tfaa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .12s;
    user-select: none;
}
.tfaa-chip:hover { background: #e2e8f0; }
.tfaa-chip.is-active {
    color: #fff;
    border-color: rgba(0,0,0,.1);
}
.tfaa-chip .tfaa-chip-count {
    background: rgba(0,0,0,.18);
    border-radius: 8px;
    padding: 1px 6px;
    font-size: 10px;
}

/* ── Lista partecipanti ───────────────────────────────────────── */
.tfaa-list {
    display: grid;
    gap: 10px;
}
.tfaa-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

.tfaa-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
    cursor: pointer;
    transition: all .12s;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    align-items: start;
}
.tfaa-card:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99,102,241,.1);
    transform: translateY(-1px);
}
.tfaa-card-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 15px;
    margin-bottom: 2px;
}
.tfaa-card-email {
    color: #64748b;
    font-size: 13px;
    word-break: break-all;
}
.tfaa-card-meta {
    color: #94a3b8;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.tfaa-card-meta-pill {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    color: #475569;
}

/* ── Badge stato ──────────────────────────────────────────────── */
.tfaa-state-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
    white-space: nowrap;
}
.tfaa-card-state {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.tfaa-card-total {
    font-weight: 700;
    color: #0f172a;
    font-size: 14px;
}

/* ── Detail view (sostituisce la lista) ───────────────────────── */
.tfaa-detail {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.tfaa-detail-back {
    background: transparent;
    border: 0;
    color: #6366f1;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tfaa-detail-back:hover { text-decoration: underline; }

.tfaa-detail-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 16px;
}
.tfaa-detail-name {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 4px;
}
.tfaa-detail-email {
    color: #64748b;
    font-size: 14px;
    word-break: break-all;
}

.tfaa-section {
    margin-bottom: 18px;
}
.tfaa-section h4 {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 8px;
}
.tfaa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.tfaa-field {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px 12px;
}
.tfaa-field-label {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 2px;
}
.tfaa-field-value {
    font-size: 14px;
    color: #1e293b;
    font-weight: 500;
    word-break: break-word;
}
.tfaa-field-value-empty {
    color: #cbd5e1;
    font-style: italic;
}

.tfaa-list-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}
.tfaa-list-items li {
    background: #f8fafc;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #334155;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.tfaa-list-items li .tfaa-li-time {
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
}

/* ── Actions (state transitions + email) ──────────────────────── */
.tfaa-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.tfaa-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #1e293b;
    transition: all .12s;
}
.tfaa-btn:hover {
    border-color: #6366f1;
    color: #4f46e5;
}
.tfaa-btn-primary {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}
.tfaa-btn-primary:hover {
    background: #1e293b;
    color: #fff;
    border-color: #1e293b;
}
.tfaa-btn-danger {
    color: #dc2626;
    border-color: #fecaca;
}
.tfaa-btn-danger:hover {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fca5a5;
}
.tfaa-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── History (state log) ──────────────────────────────────────── */
.tfaa-history {
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
}
.tfaa-history-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8fafc;
    font-size: 13px;
}
.tfaa-history-item:last-child { border-bottom: 0; }
.tfaa-history-when {
    color: #94a3b8;
    font-size: 11px;
    font-family: monospace;
    white-space: nowrap;
}
.tfaa-history-note {
    color: #64748b;
    font-style: italic;
    font-size: 12px;
    grid-column: 2 / -1;
}

/* ── Toast notifications ──────────────────────────────────────── */
.tfaa-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    z-index: 9999;
    font-size: 14px;
    max-width: 90vw;
    animation: tfaa-toast-in .25s ease-out;
}
.tfaa-toast.is-success { background: #16a34a; }
.tfaa-toast.is-error   { background: #dc2626; }
@keyframes tfaa-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Mobile tweaks ────────────────────────────────────────────── */
@media (max-width: 640px) {
    .tfaa-card { grid-template-columns: 1fr; }
    .tfaa-card-state { text-align: left; flex-direction: row; align-items: center; }
    .tfaa-detail-name { font-size: 18px; }
    .tfaa-actions { flex-direction: column; }
    .tfaa-btn { width: 100%; text-align: center; }
}
