/**
 * Stili per il flusso di Firma Elettronica Semplice (FES) Multi-Documento
 * A.S.D. Urban Runners
 */

.fes-wrapper {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.fes-intro-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(30, 41, 59, 0.4) 100%);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.fes-intro-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    color: #ef4444;
}

.fes-intro-icon svg {
    width: 100%;
    height: 100%;
}

.fes-intro-text h4 {
    margin: 0 0 0.35rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-display, sans-serif);
    letter-spacing: 0.02em;
}

.fes-intro-text p {
    margin: 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

/* Accordion Documenti */
.fes-docs-accordion {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.fes-doc-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.25s ease;
}

.fes-doc-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.fes-doc-card.is-accepted {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.03);
}

.fes-doc-header {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
}

.fes-doc-info-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.fes-doc-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.fes-doc-card.is-accepted .fes-doc-num {
    background: #22c55e;
    color: #fff;
}

.fes-doc-title {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-display, sans-serif);
    letter-spacing: 0.02em;
}

.fes-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fes-badge-mandatory {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.fes-badge-optional {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.fes-doc-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.fes-doc-download-link {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 0.2s ease;
}

.fes-doc-download-link:hover {
    color: #ffffff;
    text-decoration: underline;
}

.fes-chevron {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.25s ease;
}

.fes-doc-card.is-open .fes-chevron {
    transform: rotate(180deg);
}

.fes-doc-body {
    display: none;
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.fes-doc-card.is-open .fes-doc-body {
    display: block;
}

.fes-doc-preview-text {
    width: 100%;
    min-height: 160px;
    max-height: 240px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    font-family: inherit;
}

/* Checkbox di Consenso Granulare */
.fes-consent-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.fes-checkbox-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.fes-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ef4444;
    cursor: pointer;
}

/* Signature Pad Unico */
.fes-signature-card {
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.7) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1.75rem;
    margin-top: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.fes-sig-head {
    margin-bottom: 1.25rem;
}

.fes-sig-head h3 {
    margin: 0 0 0.35rem 0;
    font-size: 1.25rem;
    color: #ffffff;
    font-family: var(--font-display, sans-serif);
}

.fes-sig-head p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.fes-pad-container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

.fes-canvas-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    touch-action: none;
    cursor: crosshair;
}

.fes-canvas-wrapper canvas {
    display: block;
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

.fes-canvas-baseline {
    position: absolute;
    bottom: 35px;
    left: 40px;
    right: 40px;
    height: 1px;
    background: #e2e8f0;
    pointer-events: none;
    z-index: 1;
}

.fes-canvas-watermark {
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.75rem;
    font-style: italic;
    color: #94a3b8;
    pointer-events: none;
    user-select: none;
    z-index: 1;
}

.fes-pad-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.fes-btn-clear {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.fes-btn-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.fes-pad-hint {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Pulsante Primario di Firma */
.fes-submit-wrap {
    text-align: center;
    margin-top: 2rem;
}

.btn-fes-sign {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    font-family: var(--font-display, sans-serif);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1.1rem 2.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: all 0.25s ease;
}

.btn-fes-sign:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
    transform: translateY(-2px);
}

.btn-fes-sign:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-fes-sign svg {
    width: 20px;
    height: 20px;
}

/* Banner di errore/avviso */
.fes-error-banner {
    display: none;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    align-items: center;
    gap: 0.75rem;
}

.fes-error-banner.is-visible {
    display: flex;
}

/* Overlay di Caricamento Asincrono */
.fes-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 29, 0.92);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.fes-loading-overlay.is-active {
    display: flex;
}

.fes-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: fesSpin 0.9s linear infinite;
    margin-bottom: 1.5rem;
}

@keyframes fesSpin {
    to { transform: rotate(360deg); }
}

.fes-loading-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 0.5rem 0;
    font-family: var(--font-display, sans-serif);
}

.fes-loading-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 450px;
    line-height: 1.5;
    margin: 0;
}

/* Banner di successo post-firma */
.fes-success-card {
    display: none;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.fes-success-card.is-visible {
    display: block;
}

.fes-success-icon {
    width: 48px;
    height: 48px;
    color: #22c55e;
    margin: 0 auto 1rem auto;
}

.fes-success-card h3 {
    color: #ffffff;
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
    font-family: var(--font-display, sans-serif);
}

.fes-success-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    margin: 0 0 1rem 0;
}

.fes-audit-badge {
    display: inline-block;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #a7f3d0;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

/* Stili Backoffice Scheda Tesserato (Area Admin) */
.fes-admin-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1.75rem;
}

.fes-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.fes-admin-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    font-family: var(--font-display, sans-serif);
}

.fes-btn-zip {
    background: #0ea5e9;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: background 0.2s ease;
}

.fes-btn-zip:hover {
    background: #0284c7;
    color: #fff;
}

.fes-docs-table {
    width: 100%;
    border-collapse: collapse;
}

.fes-docs-table th {
    text-align: left;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fes-docs-table td {
    padding: 0.85rem 0.75rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.fes-hash-code {
    font-family: monospace;
    font-size: 0.78rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.fes-btn-dl {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.fes-btn-dl:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

/* ==========================================================================
   Stili Step 6: Selettore Modalità di Firma (Digitale FES vs Cartacea)
   ========================================================================== */

.fes-mode-container {
    margin: 1.5rem 0 2rem 0;
}

.fes-mode-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.85rem;
}

.fes-mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .fes-mode-cards {
        grid-template-columns: 1fr;
    }
}

.fes-mode-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
}

.fes-mode-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.25);
}

.fes-mode-card.selected {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(30, 41, 59, 0.5) 100%);
    border-color: #ef4444;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.2);
}

.fes-mode-card input[type="radio"] {
    margin-top: 0.25rem;
    width: 18px;
    height: 18px;
    accent-color: #ef4444;
    cursor: pointer;
}

.fes-mode-content {
    flex: 1;
}

.fes-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.fes-mode-content strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.35rem;
    font-family: var(--font-display, sans-serif);
}

.fes-mode-content p {
    margin: 0;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.45;
}

/* Banner Informativo Firma Digitale */
.fes-digital-notice {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.fes-digital-notice svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: #22c55e;
    margin-top: 0.1rem;
}

.fes-digital-notice p {
    margin: 0;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

/* Box Segnaposto Documento Firmato Digitalmente */
.fes-digital-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(34, 197, 94, 0.4);
    border-radius: 8px;
    padding: 0.9rem 1.15rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    gap: 1rem;
}

.fes-dp-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: #22c55e;
}

.fes-dp-icon svg {
    width: 100%;
    height: 100%;
}

.fes-dp-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.fes-dp-info strong {
    font-size: 0.88rem;
    color: #ffffff;
}

.fes-dp-info span {
    font-size: 0.78rem;
    color: #86efac;
}

.fes-dp-link {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: underline;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.fes-dp-link:hover {
    color: #ffffff;
}

/* Separatore e Sezione Moduli FIDAL Step 6 */
.fes-section-divider {
    margin-top: 2.25rem;
    margin-bottom: 1.25rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.fes-section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-display, sans-serif);
    letter-spacing: 0.02em;
    margin-bottom: 0.35rem;
}

.fes-section-desc {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    line-height: 1.5;
}

.fes-fidal-row {
    margin-bottom: 1.25rem;
}
