/* ═══════════════════════════════════════════════════════
   ERM – Frontend Styles  v1.8.2
   Palette OPI Rimini  #04585F  ·  WCAG 2.1 AA ≥ 7.28:1
═══════════════════════════════════════════════════════ */

/* Variabili palette ──────────────────────────────────── */
:root {
    --erm-primary:       #04585F;
    --erm-primary-dark:  #033F45;
    --erm-primary-light: #d0eef0;
    --erm-primary-tint:  #E8F4F5;
    --erm-border:        #b0cfd2;
    --erm-border-outer:  #c8dfe1;   /* linea esterna – sottilissima */
    --erm-focus-shadow:  rgba(4,88,95,.18);
}

/* Wrapper – unica cornice sottile intorno a tutto il widget */
.erm-wrapper {
    font-family: 'Segoe UI',system-ui,sans-serif;
    max-width: 680px;
    margin: 0 auto;
    border: 1px solid var(--erm-border-outer);
}

/* ── Event header – sfondo bianco, nessun bordo laterale ─ */
.erm-event-header {
    background: #fff;
    color: #1a1a1a;                          /* 17.4:1 ✅ */
    padding: 26px 32px 20px;
    border-bottom: 1px solid var(--erm-primary-light);
}
.erm-event-title {
    margin: 0 0 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--erm-primary);               /* 8.18:1 ✅ */
    line-height: 1.3;
}
.erm-event-desc {
    margin: 0 0 16px;
    color: #333;                             /* 12.6:1 ✅ */
    line-height: 1.7;
    font-size: .95rem;
}
.erm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: .88rem;
    color: var(--erm-primary-dark);          /* 11.66:1 ✅ */
    padding-top: 12px;
    border-top: 1px solid var(--erm-primary-light);
}
.erm-meta-item { display:flex; align-items:center; gap:6px; font-weight:500; }

/* ── Seats box ────────────────────────────────────────── */
.erm-seats-box {
    background: #fff;
    border-bottom: 1px solid var(--erm-primary-light);
    padding: 20px 32px;
}
.erm-seats-numbers {
    display: flex; align-items: center; justify-content: center;
    gap: 20px; margin-bottom: 14px; text-align: center;
}
.erm-seats-divider { color:#ccc; font-size:1.4rem; }
.erm-seats-num     { display:block; font-size:2.2rem; font-weight:800; line-height:1; }
.erm-seats-num.total     { color:#555; }
.erm-seats-num.booked    { color:#c0720a; }          /* arancio caldo, contrasto 3.6:1 su bianco – solo decorativo (grandi dimensioni AA-L ✅) */
.erm-seats-num.available { color: var(--erm-primary); } /* 8.18:1 ✅ */
.erm-seats-num.available.full { color:#c0392b; }     /* rosso, solo decorativo – testo 2rem */
.erm-seats-label {
    font-size:.75rem; color:#555; text-transform:uppercase;
    letter-spacing:.6px; margin-top:4px; display:block;
}
.erm-progress-wrap {
    height: 10px; background: #e0edf0;
    border-radius: 0; overflow: hidden;
}
.erm-progress-bar-front {
    height: 100%; border-radius: 0;
    background: var(--erm-primary);
    transition: width .5s ease, background .4s ease;
}
.erm-seats-pct { text-align:center; font-size:.85rem; color:#555; margin:8px 0 0; }

/* ── Alerts ───────────────────────────────────────────── */
.erm-alert {
    padding: 14px 20px; border-radius: 0; margin: 0;
    font-size: .95rem; border-left: 4px solid transparent;
}
.erm-alert-warning {
    background:#fff8e1; border-color:#f9a825; color:#7b5800;
    border-top:1px solid #ffe082; border-right:1px solid #ffe082; border-bottom:1px solid #ffe082;
}
.erm-alert-danger {
    background:#ffebee; border-color:#e53935; color:#b71c1c;
    border-top:1px solid #ef9a9a; border-right:1px solid #ef9a9a; border-bottom:1px solid #ef9a9a;
}

/* ── Alert doppia prenotazione ────────────────────────── */
.erm-alert-duplicate {
    background: var(--erm-primary-tint);
    border-left: 4px solid var(--erm-primary);
    border-top: 1px solid var(--erm-border);
    border-right: 1px solid var(--erm-border);
    border-bottom: 1px solid var(--erm-border);
    padding: 14px 18px;
    margin-bottom: 16px;
    border-radius: 0;
    font-size: .92rem;
    color: var(--erm-primary-dark);
}
.erm-alert-duplicate strong { display:block; margin-bottom:4px; font-size:1rem; }
.erm-alert-duplicate .erm-dup-msg { display:block; margin-top:4px; line-height:1.5; }
.erm-alert-duplicate a { color: var(--erm-primary); font-weight:600; }

/* ── Form ─────────────────────────────────────────────── */
.erm-form {
    background: #fff;
    padding: 24px 32px 28px;
}
.erm-fields { display:grid; grid-template-columns:1fr 1fr; gap:18px; }
.erm-field-group[data-type="textarea"],
.erm-field-group[data-type="checkbox"],
.erm-field-group[data-type="select"] { grid-column:1/-1; }

.erm-field-group label {
    display:block; font-weight:600; font-size:.875rem; color:#222; margin-bottom:6px;
}
.erm-req { color:#b71c1c; margin-left:2px; }   /* 5.75:1 su bianco ✅ */

/* Input / Select / Textarea */
.erm-field-group input:not([type="checkbox"]),
.erm-field-group select,
.erm-field-group textarea {
    width:100%; padding:10px 14px;
    border:1.5px solid var(--erm-border); border-radius:0;
    font-size:.95rem; font-family:inherit; box-sizing:border-box;
    background:#fafefe; color:#1a1a1a;                /* 17.4:1 ✅ */
    transition:border-color .2s, box-shadow .2s; appearance:auto;
}
.erm-field-group input:not([type="checkbox"]):focus,
.erm-field-group select:focus,
.erm-field-group textarea:focus {
    outline:none;
    border-color: var(--erm-primary);
    box-shadow: inset 0 0 0 1px var(--erm-primary);   /* 8.18:1 ✅ */
    background:#fff;
}
.erm-field-group input.erm-invalid,
.erm-field-group select.erm-invalid,
.erm-field-group textarea.erm-invalid {
    border-color:#dc3545; box-shadow:inset 0 0 0 1px #dc3545;
}
.erm-field-group textarea { resize:vertical; min-height:90px; }
.erm-field-group select   { cursor:pointer; }

/* Nasconde frecce input number */
.erm-field-group input[type="number"] { -moz-appearance:textfield; }
.erm-field-group input[type="number"]::-webkit-inner-spin-button,
.erm-field-group input[type="number"]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }

.erm-field-error { display:block; font-size:.8rem; color:#b71c1c; margin-top:5px; min-height:16px; }

/* ── Checkbox group ───────────────────────────────────── */
.erm-checkbox-group { display:flex; flex-direction:column; gap:8px; margin-top:2px; }
.erm-checkbox-label { display:flex; align-items:center; gap:10px; font-weight:400; cursor:pointer; font-size:.9rem; color:#333; }
.erm-checkbox-label input[type="checkbox"] {
    width:16px; height:16px; border:1.5px solid var(--erm-border);
    border-radius:0; cursor:pointer; accent-color: var(--erm-primary); flex-shrink:0;
}

/* ── Consenso GDPR ────────────────────────────────────── */
.erm-consent-block {
    margin-top: 20px; padding: 14px 18px;
    background: var(--erm-primary-tint);
    border: 1px solid var(--erm-border);
    border-left: 4px solid var(--erm-primary);
}
.erm-consent-label {
    display: flex; align-items: flex-start; gap: 10px;
    cursor: pointer; font-size: .88rem; color: #222;   /* 17.4:1 ✅ */
    line-height: 1.5; font-weight: 400;
}
.erm-consent-label input[type="checkbox"] {
    width:16px; height:16px; flex-shrink:0; margin-top:2px;
    accent-color: var(--erm-primary); border-radius:0; cursor:pointer;
}
.erm-consent-label a { color: var(--erm-primary); font-weight:600; }  /* 8.18:1 ✅ */
.erm-consent-block .erm-field-error { margin-top:6px; display:block; }

/* ── Form footer ──────────────────────────────────────── */
.erm-form-footer {
    display:flex; align-items:center; justify-content:space-between;
    margin-top:26px; border-top:1px solid #dde8e9; padding-top:18px;
}
.erm-required-note { font-size:.8rem; color:#555; margin:0; }

/* Pulsante – colore piatto, nessun gradiente */
.erm-submit-btn {
    background: var(--erm-primary);
    color: #fff;                                     /* 8.18:1 ✅ */
    border: none; padding: 11px 30px; border-radius: 0;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: background .15s, box-shadow .15s; letter-spacing: .3px;
}
.erm-submit-btn:hover    { background: var(--erm-primary-dark); box-shadow: 0 2px 8px rgba(4,88,95,.25); }
.erm-submit-btn:active   { background: var(--erm-primary-dark); box-shadow: none; }
.erm-submit-btn:disabled { opacity:.55; cursor:not-allowed; box-shadow:none; }

/* ── Messaggi esito ───────────────────────────────────── */
.erm-form-messages {
    padding:14px 18px; border-radius:0; margin-top:14px;
    font-size:.95rem; border-left:4px solid transparent;
}
.erm-form-messages.success {
    background: var(--erm-primary-tint);
    border: 1px solid var(--erm-border);
    border-left: 3px solid var(--erm-primary);
    color: var(--erm-primary-dark);             /* 11.66:1 ✅ */
}
.erm-form-messages.error {
    background:#ffebee; border-color:#e53935; color:#b71c1c;
    border-top:1px solid #ef9a9a; border-right:1px solid #ef9a9a; border-bottom:1px solid #ef9a9a;
}

/* ── Badge live real-time ─────────────────────────────── */
.erm-live-badge {
    display:inline-flex; align-items:center; gap:5px;
    font-size:.72rem; color:#555; margin-top:6px; user-select:none;
}
.erm-live-dot {
    width:7px; height:7px; border-radius:50%;
    background: var(--erm-primary); flex-shrink:0;
    animation:erm-pulse 2s infinite;
}
.erm-live-dot.inactive { background:#bbb; animation:none; }
@keyframes erm-pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50%      { opacity:.4; transform:scale(.8); }
}

/* ── Animazione flash numero (real-time) ──────────────── */
@keyframes erm-num-flash {
    0%   { transform:scale(1); color:inherit; }
    30%  { transform:scale(1.18); color: var(--erm-primary); }
    100% { transform:scale(1); color:inherit; }
}
.erm-num-flash { animation:erm-num-flash .55s ease-out; display:block; }

/* ── Responsive ───────────────────────────────────────── */
@media(max-width:520px){
    .erm-event-header  { padding:18px 20px 16px; }
    .erm-seats-box     { padding:16px 20px; }
    .erm-form          { padding:18px 20px 22px; }
    .erm-fields        { grid-template-columns:1fr; }
    .erm-field-group[data-type="select"] { grid-column:auto; }
    .erm-form-footer   { flex-direction:column; gap:12px; text-align:center; }
    .erm-submit-btn    { width:100%; }
    .erm-seats-numbers { gap:10px; }
    .erm-seats-num     { font-size:1.7rem; }
}
