/* =========================================================================
   1. GLOBAL STRUCTURE & LAYOUT CONTAINERS (RESPONSIVE GRID)
   ========================================================================= */
.whitetip-form-public-wrapper {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 850px; 
    margin: 20px auto;
    box-sizing: border-box;
}

/* Flexible flexbox grid wrapper to manage multi-column field alignments */
.whitetip-form-fields-container {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    width: 100%;
}

/* Structural encapsulation layers for individual field nodes */
.whitetip-form-field-group,
.whitetip-form-group {
    margin-bottom: 0px;
    box-sizing: border-box;
    min-width: 0 !important; /* Prevents layout overflowing on fluid viewport downscaling */
}

/* Responsive breakpoint: Enforce absolute single-column collapse below 600px */
@media (max-width: 600px) {
    .whitetip-form-field-group,
    .whitetip-form-group {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* =========================================================================
   2. MATHEMATICAL GRID WIDTH CLASSES (FLUID RESPONSIVE SYSTEM)
   ========================================================================= */
.whitetip-field-width-100 { 
    flex: 1 1 100% !important; 
    width: 100% !important; 
    max-width: 100% !important;
}

.whitetip-field-width-50  { 
    flex: 1 1 calc(50% - 8px) !important; 
    width: calc(50% - 8px) !important;
    max-width: calc(50% - 8px) !important;
}

.whitetip-field-width-33  { 
    flex: 1 1 calc(33.333% - 11px) !important; 
    width: calc(33.333% - 11px) !important;
    max-width: calc(33.333% - 11px) !important;
}

/* Mobile override: Reset fractional width metrics to full width layouts */
@media (max-width: 600px) {
    .whitetip-field-width-50, 
    .whitetip-field-width-33 {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* =========================================================================
   3. CORE ELEMENT UI SPECIFICATIONS (INPUTS, LABELS, FEEDBACKS)
   ========================================================================= */
.whitetip-field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
    font-size: 14px;
}

.whitetip-required-star {
    color: #ef4444;
    margin-left: 2px;
}

/* Base reset rules applied across structural field elements types */
.whitetip-form-field-group input[type="text"],
.whitetip-form-field-group input[type="email"],
.whitetip-form-field-group textarea,
.whitetip-form-group input,
.whitetip-form-group select,
.whitetip-form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    min-width: 0 !important; /* Overrides default vendor-specific agent spacing block metrics */
}

.whitetip-form-field-group input:focus, 
.whitetip-form-field-group textarea:focus {
    border-color: #6366f1;
    outline: none;
}

/* Core operational submit components */
.whitetip-form-submit-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    padding: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
}

.whitetip-form-submit-btn:disabled {
    background: #94a3b8;
}

/* Asynchronous transaction reporting messaging frames */
.whitetip-form-response-message {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: none;
}

.whitetip-form-response-message.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.whitetip-form-response-message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* =========================================================================
   4. NATIVE JQUERY UI DATEPICKER CALENDAR CUSTOM OVERRIDES
   ========================================================================= */
#ui-datepicker-div {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    padding: 12px !important;
    z-index: 999999 !important; /* Force render stack prioritization above page builder canvas maps */
    display: none;
    width: 300px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

.ui-datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
}

.ui-datepicker-prev, .ui-datepicker-next {
    cursor: pointer;
    background: #f1f5f9 !important;
    padding: 5px 10px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    text-decoration: none !important;
}

.ui-datepicker-prev:hover, .ui-datepicker-next:hover {
    background: #e2e8f0 !important;
    color: #1e293b !important;
}

.ui-datepicker-next { order: 3; }
.ui-datepicker-prev { order: 1; }

.ui-datepicker-title {
    order: 2;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    gap: 4px;
}

.ui-datepicker-title select {
    padding: 2px !important;
    font-size: 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 4px !important;
    background: #fff !important;
}

.ui-datepicker-calendar {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 5px;
}

.ui-datepicker-calendar th {
    font-size: 11px !important;
    color: #64748b !important;
    padding: 6px 0 !important;
    text-align: center !important;
    font-weight: 600 !important;
}

.ui-datepicker-calendar td {
    padding: 3px 2px !important;
    text-align: center !important;
}

.ui-datepicker-calendar td a {
    display: block !important;
    padding: 6px 0 !important;
    color: #334155 !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    transition: all 0.1s ease;
}

.ui-datepicker-calendar td a:hover {
    background: #6366f1 !important;
    color: #ffffff !important;
}

.ui-datepicker-calendar .ui-state-active {
    background: #4f46e5 !important;
    color: #ffffff !important;
    border-radius: 4px !important;
    font-weight: 600;
}

.ui-datepicker-prev span, .ui-datepicker-next span {
    display: inline-block !important;
}

/* =========================================================================
   5. ASYNCHRONOUS FILE MULTI-UPLOAD INTERFACE MODULE STYLE
   ========================================================================= */
.whitetip-file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.whitetip-file-custom-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.whitetip-file-custom-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-color: #94a3b8;
}

.whitetip-file-custom-name {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100% !important; /* Prevents wrapper blowout during nested flexbox allocations */
}

/* =========================================================================
   6. PREMIUM VISUAL SKIN DESIGN TOKEN TOKENS (LIGHT & DARK ARCHITECTURE)
   ========================================================================= */
.whitetip-frontend-form-container.whitetip-theme-modern-light {
    --whitetip-primary: #6366f1;
    --whitetip-primary-hover: #4f46e5;
    --whitetip-primary-alpha: rgba(99, 102, 241, 0.25);
    --whitetip-bg: #ffffff;
    --whitetip-text-main: #0f172a;
    --whitetip-text-muted: #64748b;
    --whitetip-border: #e2e8f0;
    --whitetip-border-focus: #cbd5e1;
    --whitetip-bg-input: #f8fafc;
    --whitetip-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --whitetip-radius: 8px;
}

.whitetip-frontend-form-container.whitetip-theme-modern-dark {
    --whitetip-primary: #38bdf8;
    --whitetip-primary-hover: #0ea5e9;
    --whitetip-primary-alpha: rgba(56, 189, 248, 0.25);
    --whitetip-bg: #0f172a;
    --whitetip-text-main: #f8fafc;   
    --whitetip-text-muted: #94a3b8;
    --whitetip-border: #334155;       
    --whitetip-border-focus: #475569;
    --whitetip-bg-input: #1e293b;
    --whitetip-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --whitetip-radius: 8px;
}

/* =========================================================================
   7. CORE COMPONENT ENGINE - UNIFIED STRUCTURAL PROPERTY DEFINITIONS
   ========================================================================= */
.whitetip-frontend-form-container {
    background: var(--whitetip-bg) !important;
    padding: 30px !important;
    border-radius: var(--whitetip-radius) !important;
    border: 1px solid var(--whitetip-border) !important;
    box-shadow: var(--whitetip-shadow) !important;
    margin: 25px 0 !important;
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    color: var(--whitetip-text-main) !important;
    line-height: 1.5 !important;
    transition: background 0.3s ease, border 0.3s ease !important;
}

.whitetip-frontend-form-container *,
.whitetip-frontend-form-container *::before,
.whitetip-frontend-form-container *::after {
    box-sizing: border-box !important;
}

/* FIXED: Replaced static #23789d color token with active theme configuration mapping */
.whitetip-frontend-form-container .whitetip-form-group label {
    display: block !important;
    margin-bottom: 6px !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    color: var(--whitetip-text-main) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.whitetip-frontend-form-container input[type="text"],
.whitetip-frontend-form-container input[type="email"],
.whitetip-frontend-form-container input[type="tel"],
.whitetip-frontend-form-container input[type="number"],
.whitetip-frontend-form-container input[type="url"],
.whitetip-frontend-form-container textarea,
.whitetip-frontend-form-container select {
    margin: 0 0 10px 0;
    width: 100% !important;
    height: 42px !important;
    padding: 10px 14px !important;
    background-color: var(--whitetip-bg-input) !important;
    border: 1px solid var(--whitetip-border) !important;
    border-radius: var(--whitetip-radius) !important;
    color: var(--whitetip-text-main) !important;
    font-size: 14px !important;
    font-family: inherit !important;
    box-shadow: none !important;
    transition: all 0.2s ease-in-out !important;
    outline: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    min-width: 0 !important; 
}

.whitetip-frontend-form-container textarea {
    height: auto !important;
    min-height: 110px !important;
    resize: vertical !important;
}

.whitetip-frontend-form-container input:focus,
.whitetip-frontend-form-container textarea:focus,
.whitetip-frontend-form-container select:focus {
    border-color: var(--whitetip-primary) !important;
    background-color: var(--whitetip-bg) !important;
    box-shadow: 0 0 0 3px var(--whitetip-primary-alpha) !important;
}

.whitetip-frontend-form-container ::placeholder {
    color: var(--whitetip-text-muted) !important;
    opacity: 0.6 !important;
}

/* Accessible Checkbox and Radio Customization Nodes */
.whitetip-frontend-form-container input[type="checkbox"],
.whitetip-frontend-form-container input[type="radio"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 16px !important;
    height: 16px !important;
    border: 1px solid var(--whitetip-border) !important;
    border-radius: 4px !important;
    background: var(--whitetip-bg-input) !important;
    cursor: pointer !important;
    display: inline-grid !important;
    place-content: center !important;
    margin: 0 !important;
    outline: none !important;
    transition: all 0.15s ease !important;
}

.whitetip-frontend-form-container input[type="radio"] {
    border-radius: 50% !important;
}

.whitetip-frontend-form-container input[type="checkbox"]:checked,
.whitetip-frontend-form-container input[type="radio"]:checked {
    background: var(--whitetip-primary) !important;
    border-color: var(--whitetip-primary) !important;
}

.whitetip-frontend-form-container input[type="checkbox"]:checked::before {
    content: "" !important;
    width: 8px !important;
    height: 4px !important;
    border-left: 2px solid #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
    transform: rotate(-45deg) translate(1px, -1px) !important;
}

/* Premium Outbound Form Dispatch Trigger Elements */
.whitetip-frontend-form-container .whitetip-submit-button {
    width: auto !important;
    min-width: 140px !important;
    height: 44px !important;
    background: var(--whitetip-primary) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--whitetip-radius) !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.whitetip-frontend-form-container .whitetip-submit-button:hover {
    background: var(--whitetip-primary-hover) !important;
    transform: translateY(-1px) !important;
}

.whitetip-frontend-form-container .whitetip-submit-button:active {
    transform: translateY(0px) !important;
}

/* Dark Mode Overrides specific to submit button text contrast states */
.whitetip-frontend-form-container.whitetip-theme-modern-dark .whitetip-submit-button {
    color: #0f172a !important; 
}

/* Custom File Upload components integrations for Premium Dark Mode */
.whitetip-theme-modern-dark .whitetip-file-custom-btn {
    color: #1e293b !important;
    background-color: #cbd5e1;
    border-color: #94a3b8;
}

.whitetip-theme-modern-dark .whitetip-file-custom-btn:hover {
    background-color: #94a3b8;
    color: #0f172a !important;
}