/* =========================================================================
   Zenith Equity Gravity Forms Design System
   ========================================================================= */

/* Main Wrapper Setup */
.gform_wrapper,
.gform_wrapper .gform_body,
.gform_wrapper .gform_page,
.gform_wrapper .gform_page_fields,
.gform_wrapper .gfields,
.gform_wrapper .gfield,
.gform_wrapper .gform_fields {
    overflow: visible !important;
}

.gform_wrapper {
    font-family: var(--ze-font-body-md-family);
    color: var(--ze-color-on-surface);
}

/* Sections */
.gform_wrapper .gsection {
    border-bottom: 1px solid var(--ze-color-outline-variant);
    margin-top: var(--ze-space-2xl);
    margin-bottom: var(--ze-space-lg);
    padding-bottom: var(--ze-space-sm);
}

.gform_wrapper .gsection_title {
    font-family: var(--ze-font-headline-md-family);
    font-size: var(--ze-font-headline-md-size);
    font-weight: 600;
    color: var(--ze-color-on-surface);
    margin: 0;
}

/* Fields & Labels */
.gform_wrapper .gfield:not(.gsection) {
    background-color: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: var(--ze-space-md);
    box-shadow: none;
}

.gform_wrapper .gfield_label,
.gform_wrapper .gform-field-label {
    display: block !important;
    font-family: var(--ze-font-body-md-family) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-bottom: var(--ze-space-xs) !important;
    color: var(--ze-color-on-surface) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.gform_wrapper .gfield_required {
    color: var(--ze-color-error);
    margin-left: 4px;
    font-size: 12px;
    font-weight: 400;
}

.gform_wrapper .gfield_description {
    font-family: var(--ze-font-body-sm-family);
    font-size: 12px;
    color: var(--ze-color-on-surface-variant);
    margin-top: 4px;
    line-height: 1.5;
}

/* Input Fields */
.gform_wrapper input[type="text"],
.gform_wrapper input[type="email"],
.gform_wrapper input[type="tel"],
.gform_wrapper input[type="number"],
.gform_wrapper input[type="url"],
.gform_wrapper input[type="password"],
.gform_wrapper textarea {
    width: 100%;
    border-radius: var(--ze-radius-md) !important;
    border: 1px solid var(--ze-color-outline-variant) !important;
    background-color: var(--ze-color-surface-container-lowest) !important;
    color: var(--ze-color-on-surface) !important;
    padding: 0 16px !important;
    height: 48px !important;
    font-family: var(--ze-font-body-md-family);
    font-size: 15px !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    box-shadow: none !important;
}

.gform_wrapper textarea {
    height: auto !important;
    padding: 12px 16px !important;
    min-height: 120px;
}

.gform_wrapper input:hover,
.gform_wrapper textarea:hover {
    border-color: var(--ze-color-outline) !important;
}

.gform_wrapper input:focus,
.gform_wrapper textarea:focus {
    outline: none !important;
    border-color: var(--ze-color-secondary) !important;
    box-shadow: 0 0 0 4px var(--ze-color-surface-container) !important;
}

/* Tom Select & Select Overrides */
.gform_wrapper select,
.gform_wrapper .ts-wrapper .ts-control {
    width: 100% !important;
    border-radius: var(--ze-radius-md) !important;
    border: 1px solid var(--ze-color-outline-variant) !important;
    background-color: var(--ze-color-surface-container-lowest) !important;
    color: var(--ze-color-on-surface) !important;
    padding: 0 12px !important;
    height: 48px !important;
    min-height: 48px !important;
    font-family: var(--ze-font-body-md-family) !important;
    font-size: 15px !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.gform_wrapper .ts-wrapper {
    position: relative !important;
    background-image: none !important;
}

/* Hide all possible legacy/theme arrows */
.gform_wrapper .ts-wrapper::after,
.gform_wrapper .ts-wrapper::before,
.gform_wrapper .ts-wrapper .ts-control::before {
    display: none !important;
    content: none !important;
}

.gform_wrapper .ts-wrapper .ts-control {
    display: flex !important;
    align-items: center !important;
    padding-right: 40px !important;
    background-image: none !important; /* Clear any background-image arrows */
}

.gform_wrapper .ts-wrapper .ts-control::after {
    content: '' !important;
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2345464d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    pointer-events: none !important;
}


.gform_wrapper .ts-wrapper.dropdown-active .ts-control::after {
    transform: translateY(-50%) rotate(180deg) !important;
}


.gform_wrapper .ts-wrapper .ts-control > input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    color: inherit !important;
    font-family: inherit !important;
    font-size: inherit !important;
    outline: none !important;
}

.gform_wrapper .ts-wrapper .ts-control > .item {
    background: none !important;
    border: none !important;
    color: inherit !important;
    margin-right: 4px !important;
    padding: 0 !important;
}

.gform_wrapper select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2345464d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 18px !important;
}

.gform_wrapper .ts-wrapper.focus .ts-control {
    border-color: var(--ze-color-secondary) !important;
    box-shadow: 0 0 0 4px var(--ze-color-surface-container) !important;
}


/* Password Strength Meter */
.gform_wrapper .gfield_password_strength {
    background-color: var(--ze-color-surface-container-low);
    border: 1px solid var(--ze-color-outline-variant);
    border-radius: var(--ze-radius-sm);
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ze-color-on-surface-variant);
}

.gform_wrapper .gfield_password_strength.strong { background-color: #d1fae5; border-color: #10b981; color: #065f46; }
.gform_wrapper .gfield_password_strength.good { background-color: #fef3c7; border-color: #f59e0b; color: #92400e; }
.gform_wrapper .gfield_password_strength.short,
.gform_wrapper .gfield_password_strength.bad { background-color: #fee2e2; border-color: #ef4444; color: #991b1b; }

/* Datepicker (jQuery UI) */
#ui-datepicker-div {
    display: none;
    position: absolute;
    background-color: var(--ze-color-surface-container-lowest) !important;
    border: 1px solid var(--ze-color-outline-variant) !important;
    border-radius: var(--ze-radius-md) !important;
    box-shadow: var(--ze-shadow-level-3) !important;
    font-family: var(--ze-font-body-md-family) !important;
    padding: 16px !important;
    z-index: 9999 !important;
}

.ui-datepicker-header {
    background: none !important;
    border: none !important;
    margin-bottom: 8px !important;
}

.ui-datepicker-title {
    font-weight: 700 !important;
    color: var(--ze-color-primary) !important;
}

.ui-datepicker-calendar .ui-state-default {
    background: none !important;
    border: none !important;
    text-align: center !important;
    border-radius: 50% !important;
    color: var(--ze-color-on-surface) !important;
    transition: all 0.2s ease !important;
}

.ui-datepicker-calendar .ui-state-hover {
    background-color: var(--ze-color-surface-container) !important;
}

.ui-datepicker-calendar .ui-state-active {
    background-color: var(--ze-color-secondary) !important;
    color: var(--ze-color-on-secondary) !important;
}

.ui-datepicker-today .ui-state-default {
    color: var(--ze-color-secondary) !important;
    font-weight: 700 !important;
    border: 1px solid var(--ze-color-secondary) !important;
}

/* File Upload */
.gform_wrapper .gform_fileupload_multifile .gpfup__droparea {
    border: 2px dashed var(--ze-color-outline-variant);
    background-color: var(--ze-color-surface-container-lowest);
    border-radius: var(--ze-radius-md);
    padding: 40px;
    text-align: center;
    transition: all 0.2s ease;
}

.gform_wrapper .gform_fileupload_multifile .gpfup__droparea:hover {
    border-color: var(--ze-color-secondary);
    background-color: var(--ze-color-surface-container-low);
}

/* Buttons */
.gform_wrapper .gform_button,
.gform_wrapper .gform_next_button,
.gform_wrapper .gform_previous_button {
    height: 48px !important;
    padding: 0 32px !important;
    border-radius: var(--ze-radius-full) !important;
    font-family: var(--ze-font-headline-sm-family) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
}

.gform_wrapper .gform_button,
.gform_wrapper .gform_next_button {
    background-color: var(--ze-color-primary) !important;
    color: var(--ze-color-on-primary) !important;
    border: none !important;
}

.gform_wrapper .gform_button:hover,
.gform_wrapper .gform_next_button:hover {
    transform: translateY(-2px);
    box-shadow: var(--ze-shadow-level-2);
}

.gform_wrapper .gform_previous_button {
    background-color: transparent !important;
    color: var(--ze-color-on-surface) !important;
    border: 1px solid var(--ze-color-outline-variant) !important;
}

/* GravityView Edit Entry Action Buttons */
#publishing-action {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    margin-top: var(--ze-space-lg, 24px) !important;
    width: 100% !important;
}

/* Base style for all GravityView edit actions to match form buttons */
#publishing-action .button,
#publishing-action .btn,
#publishing-action .gform_button {
    height: 48px !important;
    padding: 0 32px !important;
    border-radius: var(--ze-radius-full) !important;
    font-family: var(--ze-font-headline-sm-family, Geist, sans-serif) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    text-decoration: none !important;
}

/* 1. Update / Aktualisieren Button */
#publishing-action .gv-button-update {
    background-color: var(--ze-color-primary, #000000) !important;
    color: var(--ze-color-on-primary, #ffffff) !important;
    border: none !important;
    box-shadow: var(--ze-shadow-level-1, 0px 1px 3px rgba(15, 23, 42, 0.05)) !important;
}

#publishing-action .gv-button-update:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--ze-shadow-level-2) !important;
}

#publishing-action .gv-button-update:active {
    transform: translateY(0) !important;
}

/* 2. Cancel / Zurück Button (Outline layout) */
#publishing-action .gv-button-cancel {
    background-color: transparent !important;
    color: var(--ze-color-on-surface, #0b1c30) !important;
    border: 1px solid var(--ze-color-outline-variant, #E2E8F0) !important;
}

#publishing-action .gv-button-cancel:hover {
    background-color: var(--ze-color-surface-container, #f3f4f6) !important;
    border-color: var(--ze-color-outline, #cbd5e1) !important;
    transform: translateY(-2px) !important;
}

#publishing-action .gv-button-cancel:active {
    transform: translateY(0) !important;
}

/* 3. Delete / Löschen Button (Destructive filled red, pulled right) */
#publishing-action .gv-button-delete {
    background-color: var(--ze-color-error, #ba1a1a) !important;
    color: #ffffff !important;
    border: none !important;
    margin-left: auto !important; /* Push elegantly to the far right */
}

#publishing-action .gv-button-delete:hover {
    background-color: #a61313 !important; /* Slightly deeper tone */
    transform: translateY(-2px) !important;
    box-shadow: var(--ze-shadow-level-2) !important;
}

#publishing-action .gv-button-delete:active {
    transform: translateY(0) !important;
}

/* Mobile responsive alignment */
@media (max-width: 600px) {
    #publishing-action {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    #publishing-action .button,
    #publishing-action .btn,
    #publishing-action .gform_button {
        width: 100% !important;
    }
    #publishing-action .gv-button-delete {
        margin-left: 0 !important;
    }
}


/* --- 5. Tom Select Dropdown List --- */
.gform_wrapper .ts-wrapper .ts-dropdown {
    border-radius: var(--ze-radius-md) !important;
    border: 1px solid var(--ze-color-outline-variant) !important;
    box-shadow: var(--ze-shadow-level-3) !important;
    background-color: var(--ze-color-surface-container-lowest) !important;
    margin-top: 4px !important;
    z-index: 1000 !important;
    overflow: hidden;
}

.gform_wrapper .ts-wrapper .ts-dropdown .option {
    padding: 10px 16px !important;
    color: var(--ze-color-on-surface) !important;
    font-family: var(--ze-font-body-md-family) !important;
    cursor: pointer !important;
    transition: all 0.1s ease;
}

.gform_wrapper .ts-wrapper .ts-dropdown .option:hover,
.gform_wrapper .ts-wrapper .ts-dropdown .active {
    background-color: var(--ze-color-surface-container) !important;
    color: var(--ze-color-primary) !important;
}

/* --- 4. Checkboxes & Radios --- */
.gform_wrapper .gfield_radio,
.gform_wrapper .gfield_checkbox {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    margin-top: 12px !important;
    padding: 0 !important;
    list-style: none !important;
}

.gform_wrapper .gchoice {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.gform_wrapper .gfield-choice-input {
    accent-color: var(--ze-color-secondary) !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    border: 1px solid var(--ze-color-outline-variant) !important;
    border-radius: 4px !important; /* Slightly rounded corners for Zenith look */
    background-color: var(--ze-color-surface-container-lowest) !important;
}

.gform_wrapper .gform-field-label--type-inline {
    margin: 0 !important;
    padding: 0 !important;
    font-family: var(--ze-font-body-md-family) !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    color: var(--ze-color-on-surface) !important;
    cursor: pointer !important;
    line-height: 1 !important;
    display: inline-block !important;
}

/* --- 6. Complex Fields (Address, Name, etc.) --- */
.gform_wrapper .ginput_complex {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: var(--ze-space-md);
}

.gform_wrapper .ginput_complex span {
    display: block !important;
}

.gform_wrapper .ginput_complex .ginput_full {
    grid-column: span 2;
}

.gform_wrapper .gform-field-label--type-sub {
    font-size: 11px !important;
    font-weight: 500 !important;
    color: var(--ze-color-on-surface-variant) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px !important;
    display: block;
}

/* --- 7. Uploaded Files List --- */
.gform_wrapper .ginput_preview {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 12px 16px !important;
    background-color: var(--ze-color-surface-container-low) !important;
    border: 1px solid var(--ze-color-outline-variant) !important;
    border-radius: var(--ze-radius-sm) !important;
    margin-top: 12px !important;
    gap: 12px !important;
}

.gform_wrapper .ginput_preview > a:first-child {
    flex-grow: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--ze-color-primary);
    text-decoration: none;
}

.gform_wrapper .gfield_fileupload_filename {
    color: var(--ze-color-on-surface) !important;
}

/* --- 8. Validation & Errors --- */
.gform_wrapper .gfield_error input,
.gform_wrapper .gfield_error select,
.gform_wrapper .gfield_error textarea {
    border-color: var(--ze-color-error) !important;
    background-color: var(--ze-color-error-container) !important;
}

.gform_wrapper .gfield_validation_message {
    color: var(--ze-color-on-error-container);
    background-color: var(--ze-color-error-container);
    padding: 8px 16px;
    border-radius: var(--ze-radius-sm);
    border-left: 4px solid var(--ze-color-error);
    margin-top: 8px;
    font-size: 13px;
}

.gform_wrapper .gform_validation_errors {
    background-color: var(--ze-color-error-container);
    border: 1px solid var(--ze-color-error);
    border-radius: var(--ze-radius-md);
    padding: var(--ze-space-md) var(--ze-space-lg);
    margin-bottom: var(--ze-space-lg);
}

.gform_wrapper .gform_validation_errors h2 {
    color: var(--ze-color-on-error-container);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}