/**
 * CCIS Access Rights field — frontend styling ("Tipologie di ticket CCIS").
 *
 * Phase 2 multi-ticket builder, laid out as three stacked sections:
 *   1. membership OTP verification (when member tickets require it);
 *   2. ticket-type selection (cards grid: name + badge + price + Aggiungi);
 *   3. participants (one sub-card per selected type; ticket boxes for M > 1).
 *
 * Specificity note: every rule is scoped under `.gform_wrapper` so the
 * resulting selectors weigh (0,2,0). This is required to beat the Gravity
 * Forms framework reset `.gform-theme--framework :where(...) { all: unset }`
 * which weighs (0,1,0) and is loaded after our stylesheet.
 *
 * @since    0.4.0
 * @modified 0.5.0 Restyled for the multi-ticket builder + membership panel
 *                 (three-section layout tracking the reference mockup).
 */

.gform_wrapper .ccis-access-rights {
    display: block;
    margin: 8px 0;
}

.gform_wrapper .ccis-access-rights.is-unconfigured .ccis-access-rights__placeholder,
.gform_wrapper .ccis-access-rights .ccis-access-rights__placeholder {
    background: #fff8e1;
    border: 1px solid #f1c40f;
    padding: 10px 12px;
    border-radius: 3px;
    font-size: 13px;
    color: #7a5c00;
}

.gform_wrapper .ccis-access-rights__empty {
    background: #f7f7f7;
    border: 1px dashed #cfcfcf;
    padding: 12px;
    text-align: center;
    color: #666;
    border-radius: 6px;
}

/* ---------- Section scaffolding ---------- */

.gform_wrapper .ccis-ar-select,
.gform_wrapper .ccis-ar-participants {
    margin: 20px 0 0;
}

.gform_wrapper .ccis-ar-section__title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #1d2327;
}

.gform_wrapper .ccis-ar-note {
    margin: 0 0 12px;
    padding: 10px 14px 10px 38px;
    position: relative;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 6px;
}

.gform_wrapper .ccis-ar-note--info {
    color: #0b4a75;
    background: #eaf3fb;
    border: 1px solid #cfe4f5;
}

.gform_wrapper .ccis-ar-note--info::before {
    content: "\2139"; /* ℹ */
    position: absolute;
    left: 14px;
    top: 9px;
    font-weight: 700;
}

.gform_wrapper .ccis-ar-note--muted {
    color: #666;
    background: #f7f7f7;
    border: 1px dashed #d5d5d5;
    padding-left: 14px;
}

/* ---------- Loading skeleton (initial / precompile) ---------- */

.gform_wrapper .ccis-ar-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.gform_wrapper .ccis-ar-skeleton__spinner {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    border: 2px solid #dcdcde;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: ccis-ar-spin 0.7s linear infinite;
}

.gform_wrapper .ccis-ar-skeleton__card {
    border: 1px solid #ededed;
    border-radius: 6px;
    padding: 14px;
    background: #fff;
}

.gform_wrapper .ccis-ar-skeleton__line {
    height: 12px;
    border-radius: 6px;
    margin: 0 0 10px;
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
    background-size: 400% 100%;
    animation: ccis-ar-shimmer 1.2s ease-in-out infinite;
}

.gform_wrapper .ccis-ar-skeleton__line:last-child {
    margin-bottom: 0;
}

.gform_wrapper .ccis-ar-skeleton__line--title {
    width: 45%;
    height: 16px;
}

.gform_wrapper .ccis-ar-skeleton__line--short {
    width: 65%;
}

@keyframes ccis-ar-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

@keyframes ccis-ar-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .gform_wrapper .ccis-ar-skeleton__spinner,
    .gform_wrapper .ccis-ar-skeleton__line {
        animation: none;
    }
}

/* ---------- "Sei socio?" gate radio ---------- */

.gform_wrapper .ccis-ar-memberask {
    margin: 0 0 12px;
    padding: 14px 18px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    background: #fafbfc;
}

.gform_wrapper .ccis-ar-memberask__q {
    margin: 0 0 10px;
    font-weight: 700;
}

.gform_wrapper .ccis-ar-memberask__opts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
}

.gform_wrapper .ccis-ar-memberask__opt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.gform_wrapper .ccis-ar-memberask__opt input {
    margin: 0;
}

/* ---------- Membership OTP panel ---------- */

.gform_wrapper .ccis-ar-membership {
    margin: 0 0 4px;
    padding: 16px 18px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    background: #fafbfc;
}

.gform_wrapper .ccis-ar-membership.is-verified {
    border-color: #b7e0c2;
    background: #f0f9f2;
}

.gform_wrapper .ccis-ar-membership__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.gform_wrapper .ccis-ar-membership__intro {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.gform_wrapper .ccis-ar-membership__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e4edf6;
    color: #2271b1;
    font-size: 20px;
}

.gform_wrapper .ccis-ar-membership.is-verified .ccis-ar-membership__icon {
    background: #cdeed6;
    color: #1a7f37;
}

.gform_wrapper .ccis-ar-membership__title {
    margin: 0 0 2px;
    font-weight: 700;
    font-size: 15px;
    color: #1d2327;
}

.gform_wrapper .ccis-ar-membership__prompt {
    margin: 0;
    font-size: 13px;
    color: #555;
}

/* Two columns: left = email + request, right = code + verify (disabled until
 * a code has been requested). Equal-width inputs and buttons. */
.gform_wrapper .ccis-ar-membership__cols {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.gform_wrapper .ccis-ar-membership__col {
    min-width: 0;
}

/* Column head: numbered step bubble + label, so the two verification steps
 * (1 = request the code, 2 = enter it) read clearly. */
.gform_wrapper .ccis-ar-membership__colhead {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
}

.gform_wrapper .ccis-ar-membership__stepnum {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.gform_wrapper .ccis-ar-membership__label {
    display: block;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.gform_wrapper .ccis-ar-membership__row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.gform_wrapper .ccis-ar-membership__email,
.gform_wrapper .ccis-ar-membership__code {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
}

.gform_wrapper .ccis-ar-membership__email[readonly] {
    background: #eef1f4;
    color: #555;
    cursor: default;
}

.gform_wrapper .ccis-ar-membership__request,
.gform_wrapper .ccis-ar-membership__verify {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 16px;
    border: none;
    border-radius: 6px;
    background: #2271b1;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gform_wrapper .ccis-ar-membership__verify {
    background: #1a7f37;
    color: #fff;
    border: none;
}

.gform_wrapper .ccis-ar-membership__request:hover { background: #185a8f; }
.gform_wrapper .ccis-ar-membership__verify:hover  { background: #14682d; }

.gform_wrapper .ccis-ar-membership__code[disabled],
.gform_wrapper .ccis-ar-membership__verify[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    background: #cfcfcf;
    color: #fff;
    border-color: #cfcfcf;
}

/* "Cambia email" now sits in the send-button slot (replacing "Invia codice"
 * once the email is locked), so it is styled as a secondary button. */
.gform_wrapper .ccis-ar-membership__change {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 9px 16px;
    border: 1px solid #2271b1;
    border-radius: 6px;
    background: #fff;
    color: #2271b1;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gform_wrapper .ccis-ar-membership__change:hover {
    background: #eaf3fb;
}

.gform_wrapper .ccis-ar-membership__reset {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: #2271b1;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 6px;
}

.gform_wrapper .ccis-ar-membership__status {
    margin: 10px 0 0;
    font-size: 13px;
    min-height: 1.2em;
    color: #1a7f37;
}

.gform_wrapper .ccis-ar-membership__status.is-error {
    color: #b00020;
}

/* ---------- Ticket-type selection (cards grid) ---------- */

.gform_wrapper .ccis-ar-select__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.gform_wrapper .ccis-ar-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
}

.gform_wrapper .ccis-ar-card--member {
    border-color: #b7e0c2;
    background: #f6fbf7;
}

.gform_wrapper .ccis-ar-card--open {
    border-color: #cfe0f0;
    background: #f7fafd;
}

.gform_wrapper .ccis-ar-card.is-disabled {
    opacity: 0.75;
    background: #f4f4f4;
    border-color: #e0e0e0;
}

/* Member ticket shown but not yet purchasable (verification pending): muted,
 * readable, dashed — NOT greyed out (the visitor should still see the tariff). */
.gform_wrapper .ccis-ar-card.is-locked {
    opacity: 1;
    background: #f4f6f8;
    border-color: #dfe3e8;
    border-style: dashed;
}

/* Top row = two columns: name (left, flexible) and a right column with the
 * badge stacked above the price. */
.gform_wrapper .ccis-ar-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.gform_wrapper .ccis-ar-name {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.4;
    color: #1d2327;
}

.gform_wrapper .ccis-ar-card__top .ccis-ar-name {
    flex: 1 1 auto;
    min-width: 0;
}

.gform_wrapper .ccis-ar-card__meta {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    text-align: right;
}

/* Notes + button pushed to the bottom of the card, so they align across the
 * whole row of (equal-height) cards. */
.gform_wrapper .ccis-ar-card__foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
}

.gform_wrapper .ccis-ar-price {
    font-weight: 700;
    font-size: 20px;
    color: #2c2c2c;
    white-space: nowrap;
}

.gform_wrapper .ccis-ar-card__meta .ccis-ar-price {
    margin-left: 0;
}

.gform_wrapper .ccis-ar-price--free {
    color: #1a7f37;
}

.gform_wrapper .ccis-ar-desc {
    margin: 0;
    font-size: 13px;
    color: #444;
}

.gform_wrapper .ccis-ar-state {
    margin: 0;
    font-size: 12px;
    color: #6a6a6a;
}

.gform_wrapper .ccis-ar-card--member .ccis-ar-state {
    color: #1a7f37;
}

/* ---------- Badges ---------- */

.gform_wrapper .ccis-ar-avail {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.5;
}

.gform_wrapper .ccis-ar-avail--member {
    color: #1a7f37;
    background: #d8f0de;
}

.gform_wrapper .ccis-ar-avail--open {
    color: #0b4a75;
    background: #d9e9f7;
}

.gform_wrapper .ccis-ar-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* ---------- Add button ---------- */

.gform_wrapper .ccis-ar-add {
    margin-top: 4px; /* the __foot wrapper anchors this block to the card bottom */
    align-self: flex-start;
    padding: 8px 16px;
    border: 1px solid #1a7f37;
    border-radius: 6px;
    background: #fff;
    color: #1a7f37;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.gform_wrapper .ccis-ar-card--open .ccis-ar-add {
    border-color: #2271b1;
    color: #2271b1;
}

.gform_wrapper .ccis-ar-add:hover { background: #f0f9f2; }
.gform_wrapper .ccis-ar-card--open .ccis-ar-add:hover { background: #eaf3fb; }

.gform_wrapper .ccis-ar-add[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: #bbb;
    color: #888;
    background: #f0f0f0;
}

/* ---------- Participants (sub-cards) ---------- */

.gform_wrapper .ccis-ar-pcard {
    margin: 0 0 12px;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.gform_wrapper .ccis-ar-pcard--member { border-color: #b7e0c2; }
.gform_wrapper .ccis-ar-pcard--open   { border-color: #cfe0f0; }

.gform_wrapper .ccis-ar-pcard__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid #ececec;
    background: #f6f7f7;
}

.gform_wrapper .ccis-ar-pcard--member .ccis-ar-pcard__head { background: #f0f9f2; }
.gform_wrapper .ccis-ar-pcard--open   .ccis-ar-pcard__head { background: #f2f8fd; }

/* First column elastic, then fixed-width count + price aligned right so the
 * "columns" line up across stacked sub-cards regardless of the ticket name. */
.gform_wrapper .ccis-ar-pcard__title {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gform_wrapper .ccis-ar-pcard__count {
    flex: 0 0 auto;
    width: 130px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.gform_wrapper .ccis-ar-pcard__head .ccis-ar-price {
    flex: 0 0 auto;
    width: 100px;
    text-align: right;
    margin-left: 0;
    font-size: 16px;
}

.gform_wrapper .ccis-ar-pcard__body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---------- Ticket box (multiplier > 1) ---------- */

/* Rendered as a full-width band of the sub-card body (negative horizontal
 * margins cancel the body padding, then the same padding is re-applied) so the
 * participant rows inside — and therefore their numbered bubbles — line up with
 * the flat rows of single-participant (M = 1) tickets. The sub-card's
 * `overflow:hidden` clips the band to the rounded corners. */
.gform_wrapper .ccis-ar-tbox {
    margin: 0 -14px;
    padding: 10px 14px 12px;
    background: #f7f8fa;
}

.gform_wrapper .ccis-ar-tbox__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.gform_wrapper .ccis-ar-tbox__title {
    font-weight: 700;
    font-size: 13px;
}

/* ---------- Participant row ---------- */

.gform_wrapper .ccis-ar-participant {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.gform_wrapper .ccis-ar-participant + .ccis-ar-participant {
    margin-top: 12px;
}

.gform_wrapper .ccis-ar-pnum {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-top: 18px;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.gform_wrapper .ccis-ar-pcard--member .ccis-ar-pnum { background: #1a7f37; }

.gform_wrapper .ccis-ar-pfields {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

/* Two-row participant layout (0.6.0).
 *
 * Active ONLY when the event collects BOTH optional groups (Azienda + Ruolo
 * AND Tipologia + Settore). With a single group the fields keep flowing inline
 * with name/surname/email and the markup below never appears, so the existing
 * look is untouched.
 *
 * `.ccis-ar-prows` is the column wrapper that lets the two `.ccis-ar-pfields`
 * rows stack while the numbered badge stays beside them. */
.gform_wrapper .ccis-ar-prows {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

/* Second row: the business-side fields, visually separated from the personal
 * ones by a hairline rule rather than by extra spacing alone. */
.gform_wrapper .ccis-ar-pfields--business {
    padding-top: 8px;
    border-top: 1px dashed #d5d8dc;
}

.gform_wrapper .ccis-ar-pp-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 140px;
    font-size: 12px;
    color: #555;
}

.gform_wrapper .ccis-ar-pp {
    width: 100%;
    padding: 6px 8px;
}

.gform_wrapper .ccis-ar-remove-group {
    border: none;
    background: transparent;
    color: #d63638;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
}

/* Align the inline trash to the input row (bottom), not the labels (top). */
.gform_wrapper .ccis-ar-remove-inline {
    flex: 0 0 auto;
    font-size: 20px;
    line-height: 1;
    align-self: flex-end;
    margin-bottom: 6px;
}

/* Required / optional field markers. */
.gform_wrapper .ccis-ar-req {
    color: #d63638;
    margin-left: 2px;
    font-weight: 700;
}

.gform_wrapper .ccis-ar-opt {
    color: #8a8a8a;
    font-weight: 400;
    font-size: 0.9em;
    margin-left: 4px;
}

/* ---------- Responsive ---------- */

@media (max-width: 782px) {
    /* Membership panel: stack the two columns on tablet/phone. */
    .gform_wrapper .ccis-ar-membership__cols {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .gform_wrapper .ccis-ar-select__grid {
        grid-template-columns: 1fr;
    }

    /* Each participant field takes a full row on narrow screens. */
    .gform_wrapper .ccis-ar-pp-field {
        flex: 1 1 100%;
    }

    /* Ticket sub-card head: let count + price wrap under the name. */
    .gform_wrapper .ccis-ar-pcard__title {
        flex: 1 1 100%;
    }
    .gform_wrapper .ccis-ar-pcard__count,
    .gform_wrapper .ccis-ar-pcard__head .ccis-ar-price {
        width: auto;
        text-align: left;
    }
}
