/**
 * CSS for BK Form Widget
 * Author: Bùi Đức Hạnh (https://buhaweb.com/)
 * Prefix: bdh-bk-
 * Clean Stacked Label-Input Layout with Responsive Flexible Width Controls (100%, 50%, 33%)
 * Design System: Kit 4 (Green Theme / glux.test)
 */

.bdh-bk-form-container {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.bdh-bk-form {
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   1. Multi-Column Flexbox Grid System
   ========================================================================== */
.bdh-bk-form-fields-wrap {
    display: flex;
    flex-wrap: wrap;
    margin-left: calc(var(--bdh-bk-col-gap, 20px) / -2);
    margin-right: calc(var(--bdh-bk-col-gap, 20px) / -2);
    box-sizing: border-box;
}

.bdh-bk-form-field {
    box-sizing: border-box;
    padding-left: calc(var(--bdh-bk-col-gap, 20px) / 2);
    padding-right: calc(var(--bdh-bk-col-gap, 20px) / 2);
    margin-bottom: var(--bdh-bk-row-gap, 18px);
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
}

/* Desktop default 2-column layout (overridden dynamically by Elementor responsive controls) */
@media (min-width: 768px) {
    .bdh-bk-field--name,
    .bdh-bk-field--phone,
    .bdh-bk-field--address,
    .bdh-bk-field--demand {
        width: 50%;
        flex: 0 0 50%;
        max-width: 50%;
    }
    .bdh-bk-field--notes,
    .bdh-bk-field--security {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ==========================================================================
   2. Clean Stacked Label Layout (Icon + Label Above Input)
   ========================================================================== */
.bdh-bk-form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    user-select: none;
    line-height: 1.3;
}

.bdh-bk-form-label-title {
    font-size: var(--e-global-typography-fc3ef67-font-size, 15px);
    font-weight: var(--e-global-typography-fc3ef67-font-weight, 600);
    color: var(--e-global-color-d27c3cc, #1f2328);
    line-height: inherit;
    letter-spacing: -0.1px;
}

.bdh-bk-form-required {
    color: var(--e-global-color-d0d47e8, #ee3338);
    margin-left: 2px;
    font-weight: 700;
}

/* Modern Rounded Icon Box */
.bdh-bk-form-icon-box {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    background: var(--e-global-color-8d5d81d, #ffffff);
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--e-global-color-fcc82ce, #e5e7eb);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--e-global-color-938e6c1, #2a9150);
    font-size: 14px;
    transition: all 0.25s ease;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow: hidden;
}

.bdh-bk-form-icon-box i {
    font-size: inherit;
    line-height: 1;
    color: inherit;
    transition: transform 0.25s ease;
}

.bdh-bk-form-icon-box svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    display: block;
    transition: transform 0.25s ease;
}

.bdh-bk-form-icon-box .elementor-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
}

.bdh-bk-form-field:focus-within .bdh-bk-form-icon-box {
    border-color: var(--e-global-color-1070229, #2cac55);
    color: var(--e-global-color-1070229, #2cac55);
    box-shadow: 0 3px 10px rgba(44, 172, 85, 0.15);
    transform: translateY(-1px);
}

/* ==========================================================================
   3. Input Controls (Text, Tel, Select, Textarea)
   ========================================================================== */
.bdh-bk-form-input-wrap {
    position: relative;
    width: 100%;
}

.bdh-bk-form-input-wrap .wpcf7-form-control-wrap {
    display: block;
    width: 100%;
}

.bdh-bk-form-input,
.bdh-bk-form-select,
.bdh-bk-form-textarea {
    width: 100%;
    background-color: var(--e-global-color-8d5d81d, #ffffff);
    border: 1px solid var(--e-global-color-fcc82ce, #e5e7eb);
    border-radius: 8px;
    font-size: var(--e-global-typography-afd6f4d-font-size, 15px);
    line-height: var(--e-global-typography-afd6f4d-line-height, 1.5em);
    color: var(--e-global-color-d27c3cc, #1f2328);
    padding: 11px 16px;
    transition: all 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
    outline: none;
}

.bdh-bk-form-input,
.bdh-bk-form-select {
    height: 48px;
}

.bdh-bk-form-select {
    appearance: none;
    -webkit-appearance: none;
    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='%232A9150' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 42px;
    cursor: pointer;
}

.bdh-bk-form-textarea {
    min-height: 110px;
    resize: vertical;
    padding-top: 12px;
    padding-bottom: 12px;
}

.bdh-bk-form-input::placeholder,
.bdh-bk-form-textarea::placeholder {
    color: var(--e-global-color-47f60d3, #9ca3af);
    opacity: 1;
}

.bdh-bk-form-input:focus,
.bdh-bk-form-select:focus,
.bdh-bk-form-textarea:focus {
    border-color: var(--e-global-color-938e6c1, #2a9150);
    box-shadow: 0 0 0 3px rgba(42, 145, 80, 0.15);
    background-color: var(--e-global-color-8d5d81d, #ffffff);
}

/* ==========================================================================
   4. Security Anti-Spam Card Elements
   ========================================================================== */
.bdh-bk-sec-card {
    background: var(--e-global-color-d9c2012, #e8f6ec);
    border: 1px solid var(--e-global-color-619c75f, #c5e8d0);
    border-radius: 10px;
    padding: 14px 16px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bdh-bk-sec-card:focus-within {
    border-color: var(--e-global-color-1070229, #2cac55);
    box-shadow: 0 2px 10px rgba(44, 172, 85, 0.1);
}

.bdh-bk-sec-question-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.bdh-bk-sec-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--e-global-color-619c75f, #c5e8d0);
    color: var(--e-global-color-97923db, #1e6b3a);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 3px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.bdh-bk-sec-badge i {
    font-size: 12px;
}

.bdh-bk-sec-badge svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
    display: inline-block;
}

.bdh-bk-sec-q-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--e-global-color-97923db, #1e6b3a);
    flex: 1;
    min-width: 180px;
    line-height: 1.35;
}

.bdh-bk-sec-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--e-global-color-8d5d81d, #ffffff);
    border: 1px solid var(--e-global-color-5c987e6, #7fcb98);
    color: var(--e-global-color-97923db, #1e6b3a);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.bdh-bk-sec-refresh-btn:hover {
    background: var(--e-global-color-938e6c1, #2a9150);
    color: var(--e-global-color-8d5d81d, #ffffff);
    border-color: var(--e-global-color-938e6c1, #2a9150);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(42, 145, 80, 0.2);
}

.bdh-bk-sec-refresh-btn i {
    font-size: 11px;
    transition: transform 0.4s ease;
}

.bdh-bk-sec-refresh-btn svg {
    width: 11px;
    height: 11px;
    fill: currentColor;
    display: inline-block;
    transition: transform 0.4s ease;
}

.bdh-bk-sec-refresh-btn.is-refreshing i,
.bdh-bk-sec-refresh-btn.is-refreshing svg {
    animation: bdh-bk-spin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.bdh-bk-sec-subtip {
    font-size: 12px;
    color: var(--e-global-color-76ff1c6, #4b5563);
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.bdh-bk-sec-subtip i {
    font-size: 12px;
    color: var(--e-global-color-1070229, #2cac55);
}

.bdh-bk-sec-subtip svg {
    width: 12px;
    height: 12px;
    fill: var(--e-global-color-1070229, #2cac55);
    display: inline-block;
}

/* ==========================================================================
   5. Submit Wrap & Button (Green Primary Theme)
   ========================================================================== */
.bdh-bk-form-submit-wrap {
    text-align: center;
    margin-top: 10px;
    width: 100%;
}

.bdh-bk-form-submit-btn {
    background: var(--e-global-color-938e6c1, #2a9150);
    color: var(--e-global-color-8d5d81d, #ffffff);
    font-size: var(--e-global-typography-fc3ef67-font-size, 16px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 44px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(42, 145, 80, 0.25);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
    min-width: 200px;
    text-decoration: none !important;
    box-sizing: border-box;
}

.bdh-bk-form-submit-btn:hover {
    background: var(--e-global-color-97923db, #1e6b3a);
    box-shadow: 0 6px 18px rgba(30, 107, 58, 0.35);
    transform: translateY(-1px);
}

.bdh-bk-form-submit-btn:active {
    transform: translateY(0);
}

.bdh-bk-form-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.bdh-bk-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.bdh-bk-btn-icon svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Spinner */
.bdh-bk-form-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: bdh-bk-spin 0.8s linear infinite;
}

.bdh-bk-form-submit-btn.is-loading .bdh-bk-form-spinner {
    display: inline-block;
}

.bdh-bk-form-submit-btn.is-loading .bdh-bk-btn-icon {
    display: none;
}

@keyframes bdh-bk-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   6. Response Output Alert
   ========================================================================== */
.bdh-bk-form-response {
    display: none;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.45;
    margin-top: 20px;
    text-align: center;
}

.bdh-bk-form-response.is-success {
    display: block;
    background-color: var(--e-global-color-d9c2012, #e8f6ec);
    border: 1px solid var(--e-global-color-619c75f, #c5e8d0);
    color: var(--e-global-color-97923db, #1e6b3a);
}

.bdh-bk-form-response.is-error {
    display: block;
    background-color: var(--e-global-color-91a7225, #fdecec);
    border: 1px solid var(--e-global-color-0345fbc, #f58c8f);
    color: var(--e-global-color-d0d47e8, #ee3338);
}

/* ==========================================================================
   7. Mobile & Tablet Specific Behavior
   ========================================================================== */
@media (max-width: 767px) {
    .bdh-bk-form-fields-wrap {
        margin-left: 0;
        margin-right: 0;
    }

    .bdh-bk-form-field {
        padding-left: 0;
        padding-right: 0;
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 16px;
    }

    .bdh-bk-sec-question-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .bdh-bk-sec-refresh-btn {
        margin-left: 0;
    }

    .bdh-bk-form-submit-btn {
        width: 100%;
        padding: 13px 20px;
    }
}
