/* ==========================================================================
   TWS CONTACT FORMS
   ========================================================================== */

.tws-form-wrapper {
    max-width: 800px;
    margin: 0 auto;
    font-family: inherit;
    text-align: left !important;
    box-sizing: border-box;
}
.tws-form-wrapper *,
.tws-form-wrapper *::before,
.tws-form-wrapper *::after {
    box-sizing: border-box !important;
    text-align: left !important;
}
/* eccezioni: elementi centrati intenzionalmente */
.tws-form-wrapper .tws-radio-card,
.tws-form-wrapper .tws-radio-pill,
.tws-form-wrapper .tws-submit {
    text-align: center !important;
}
.tws-form-wrapper .tws-form {
    text-align: left !important;
}

/* Form header */
.tws-form-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}
.tws-form-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
}
.tws-package-label {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Fieldset */
.tws-form-wrapper .tws-fieldset {
    border: none !important;
    padding: 0 !important;
    margin: 0 0 24px !important;
    background: none !important;
    box-shadow: none !important;
    text-align: left !important;
}
.tws-form-wrapper .tws-fieldset legend {
    font-size: 16px !important;
    font-weight: 600 !important;
    margin-bottom: 12px !important;
    padding: 0 0 8px !important;
    color: #333 !important;
    width: 100% !important;
    border-bottom: 1px solid #eee !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    text-align: left !important;
    float: none !important;
    display: block !important;
    background: none !important;
}

/* Grid */
.tws-form-wrapper .tws-row {
    display: flex !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
    float: none !important;
    width: auto !important;
}
.tws-form-wrapper .tws-col {
    flex: 1 !important;
    min-width: 200px !important;
    float: none !important;
    padding: 0 !important;
}
.tws-form-wrapper .tws-row-align-end {
    align-items: flex-end !important;
}

/* Inputs */
.tws-form input[type="text"],
.tws-form input[type="email"],
.tws-form input[type="tel"],
.tws-form input[type="number"],
.tws-form textarea,
.tws-form select {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #ccc !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    background: #fff !important;
    transition: border-color 0.2s;
    box-sizing: border-box !important;
    display: block !important;
    margin: 0 !important;
    text-align: left !important;
    line-height: normal !important;
    height: auto !important;
    max-width: 100% !important;
    float: none !important;
}
.tws-form input:focus,
.tws-form textarea:focus,
.tws-form select:focus {
    outline: none !important;
    border-color: var(--tws-accent-color, #4a7c59) !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--tws-accent-color, #4a7c59) 20%, transparent) !important;
}
.tws-form label {
    display: block !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    margin-bottom: 4px !important;
    color: #444 !important;
    text-align: left !important;
    float: none !important;
    width: auto !important;
}

/* Radio cards (con chi viaggi) */
.tws-form-wrapper .tws-radio-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.tws-form-wrapper .tws-radio-card {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 16px !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    flex: 1 !important;
    min-width: 140px !important;
    background: #fff !important;
    text-align: center !important;
    margin: 0 !important;
    float: none !important;
}
.tws-form-wrapper .tws-radio-card:hover {
    border-color: var(--tws-accent-color, #4a7c59) !important;
}
.tws-form-wrapper .tws-radio-card.active {
    border-color: var(--tws-accent-color, #4a7c59) !important;
    background: color-mix(in srgb, var(--tws-accent-color, #4a7c59) 10%, white) !important;
}
.tws-form-wrapper .tws-radio-card input[type="radio"] {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    opacity: 0 !important;
}
.tws-radio-label {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

/* Radio pills (notti, budget) */
.tws-form-wrapper .tws-radio-inline {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.tws-form-wrapper .tws-radio-pill {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 8px 16px !important;
    border: 1px solid #ddd !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    background: #fff !important;
    font-size: 14px !important;
    margin: 0 !important;
    float: none !important;
    text-align: center !important;
}
.tws-form-wrapper .tws-radio-pill:hover {
    border-color: var(--tws-accent-color, #4a7c59) !important;
}
.tws-form-wrapper .tws-radio-pill.active {
    border-color: var(--tws-accent-color, #4a7c59) !important;
    background: var(--tws-accent-color, #4a7c59) !important;
    color: #fff !important;
}
.tws-form-wrapper .tws-radio-pill input[type="radio"] {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important;
    opacity: 0 !important;
}

/* Radio vertical (strutture ricettive) */
.tws-form-wrapper .tws-radio-vertical {
    flex-direction: column !important;
}
.tws-form-wrapper .tws-radio-option {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    background: #fff !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    float: none !important;
    text-align: left !important;
}
.tws-form-wrapper .tws-radio-option:hover {
    border-color: var(--tws-accent-color, #4a7c59) !important;
}
.tws-form-wrapper .tws-radio-option.active {
    border-color: var(--tws-accent-color, #4a7c59) !important;
    background: color-mix(in srgb, var(--tws-accent-color, #4a7c59) 10%, white) !important;
}
.tws-form-wrapper .tws-radio-option input[type="radio"] {
    display: inline-block !important;
    width: auto !important;
    margin-top: 2px !important;
    accent-color: var(--tws-accent-color, #4a7c59) !important;
    opacity: 1 !important;
    position: static !important;
    height: auto !important;
}

/* Counter (+/-) */
.tws-counter {
    display: inline-flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.tws-counter-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.15s;
}
.tws-counter-btn:hover:not(:disabled) {
    background: #e0e0e0;
}
.tws-counter-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.tws-form-wrapper .tws-counter input[type="number"] {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid #ddd !important;
    border-right: 1px solid #ddd !important;
    border-radius: 0 !important;
    padding: 6px 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    -moz-appearance: textfield !important;
    box-shadow: none !important;
    display: block !important;
    flex: none !important;
    height: 36px !important;
}
.tws-form-wrapper .tws-counter input[type="number"]::-webkit-outer-spin-button,
.tws-form-wrapper .tws-counter input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.tws-counter-group {
    min-width: auto;
    flex: 0 0 auto;
}
.tws-counter-group label {
    margin-bottom: 6px;
}

/* Participants section */
.tws-participants {
    margin-top: 16px;
    padding: 16px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eee;
}

/* Notti group */
.tws-notti-group {
    margin-top: 16px;
}
.tws-notti-group > label {
    margin-bottom: 8px;
}

/* Checkbox group */
.tws-form-wrapper .tws-checkbox-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}
.tws-form-wrapper .tws-checkbox {
    display: flex !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    margin: 0 !important;
    float: none !important;
    text-align: left !important;
    background: transparent !important;
}
.tws-form-wrapper .tws-checkbox:hover {
    background: #f5f5f5 !important;
}
.tws-form-wrapper .tws-checkbox input[type="checkbox"] {
    display: inline-block !important;
    width: auto !important;
    min-width: 0 !important;
    margin-top: 2px !important;
    flex-shrink: 0 !important;
    accent-color: var(--tws-accent-color, #4a7c59) !important;
    opacity: 1 !important;
    position: static !important;
    height: auto !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    border-radius: 0 !important;
}

/* Altro text */
.tws-altro-text {
    padding-left: 28px;
    margin-top: -2px;
    margin-bottom: 6px;
}
.tws-input-full {
    width: 100%;
}

/* Budget section */
.tws-budget-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.tws-budget-voli > label {
    margin-bottom: 8px;
}
.tws-col-budget-input {
    max-width: 200px;
    min-width: 160px;
    flex: 0 0 auto;
}

/* Textarea */
.tws-form-wrapper .tws-form textarea {
    resize: vertical !important;
    min-height: 80px !important;
}

/* Form footer */
.tws-form-wrapper .tws-form-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    margin-top: 24px !important;
    padding-top: 20px !important;
    border-top: 1px solid #eee !important;
    flex-wrap: wrap !important;
    float: none !important;
}
.tws-form-wrapper .tws-privacy {
    flex: 1 !important;
    min-width: 250px !important;
}
.tws-form-wrapper .tws-privacy a {
    color: var(--tws-accent-color, #4a7c59) !important;
    text-decoration: underline !important;
}
.tws-form-wrapper .tws-submit {
    padding: 12px 32px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 8px !important;
    background: var(--tws-accent-color, #4a7c59) !important;
    color: #fff !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
    white-space: nowrap !important;
    display: inline-block !important;
    width: auto !important;
    line-height: normal !important;
}
.tws-form-wrapper .tws-submit:hover {
    background: color-mix(in srgb, var(--tws-accent-color, #4a7c59) 80%, black) !important;
}
.tws-form-wrapper .tws-submit:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* Messages */
.tws-form-messages {
    margin-top: 16px;
}
.tws-error {
    padding: 12px 16px;
    background: #fff0f0;
    border: 1px solid #e8a0a0;
    border-radius: 6px;
    color: #c00;
    font-size: 14px;
    line-height: 1.5;
}
.tws-success {
    padding: 12px 16px;
    background: #f0fff4;
    border: 1px solid #a0d8b0;
    border-radius: 6px;
    color: #2d7a3a;
    font-size: 14px;
}

/* ==========================================================================
   MODAL
   ========================================================================== */
.tws-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tws-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}
.tws-modal-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 860px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.tws-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 4px;
    line-height: 1;
    z-index: 1;
}
.tws-modal-close:hover {
    color: #333;
}
body.tws-modal-open {
    overflow: hidden;
}

/* ==========================================================================
   PIKADAY — z-index above modal
   ========================================================================== */
.pika-single {
    z-index: 100000 !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .tws-form-wrapper {
        padding: 0 8px;
    }
    .tws-row {
        flex-direction: column;
        gap: 12px;
    }
    .tws-col {
        min-width: 100%;
    }
    .tws-radio-group {
        flex-direction: column;
    }
    .tws-radio-card {
        min-width: 100%;
    }
    .tws-radio-inline {
        flex-wrap: wrap;
    }
    .tws-radio-pill {
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }
    .tws-form-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .tws-submit {
        width: 100%;
    }
    .tws-modal-container {
        padding: 20px;
        width: 96%;
        max-height: 95vh;
        border-radius: 8px;
    }
    .tws-col-budget-input {
        max-width: 100%;
        min-width: 100%;
    }
    .tws-budget-tipo-importo .tws-row {
        gap: 16px;
    }
}
