/**
 * LX Form - Frontend Styles
 * Base styles for form elements with outline/border reset and clean aesthetics
 */

/* ==============================
   Form Wrapper
   ============================== */
.lx-form-wrapper {
    max-width: 100%;
}

.lx-form-wrapper .elementor {
    width: 100%;
}

.lx-form {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0;
}

/* ==============================
   Field Container
   ============================== */
.lx-form-field {
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* ==============================
   Labels
   ============================== */
.lx-form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
}

.lx-form-required-mark {
    color: #e74c3c;
    margin-left: 2px;
}

.lx-form-required {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* In Elementor editor, always show required text for styling preview */
.elementor-editor-active .lx-form-required {
    display: block;
}

/* ==============================
   Input Reset & Base Styles
   ============================== */
.lx-form-input,
.lx-form-input[type="text"],
.lx-form-input[type="email"],
.lx-form-input[type="tel"],
.lx-form-input[type="url"],
.lx-form-input[type="number"],
.lx-form-input[type="date"],
input.lx-form-input {
    /* Reset */
    outline: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #ffffff;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    width: 100%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Transition */
    transition: border-color 0.2s ease, border-width 0.2s ease, border-style 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, border-radius 0.2s ease, color 0.2s ease;
    /* Font */
    font-family: inherit;
}

.lx-form-input::placeholder {
    color: #999;
    opacity: 1;
}

.lx-form-input:hover {
    border-color: #c0c0c0;
}

.lx-form-input:focus {
    outline: none !important;
}

/* ==============================
   Textarea
   ============================== */
textarea.lx-form-input {
    resize: vertical;
    min-height: 100px;
}

/* ==============================
   Select
   ============================== */
select.lx-form-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

/* ==============================
   Checkbox
   ============================== */
.lx-form-field-checkbox .lx-form-label,
.lx-form-field-radio .lx-form-label {
    margin-bottom: 10px;
}

.lx-form-checkbox-group,
.lx-form-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.lx-form-checkbox-horizontal .lx-form-checkbox-group,
.lx-form-radio-horizontal .lx-form-radio-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 16px;
}

.lx-form-checkbox-item,
.lx-form-radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
}

.lx-form-checkbox-horizontal .lx-form-checkbox-item,
.lx-form-radio-horizontal .lx-form-radio-item {
    margin-bottom: 4px;
}

.lx-form-checkbox-input,
.lx-form-radio-input {
    /* Reset */
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin: 0;
}

.lx-form-checkbox-input {
    border-radius: 3px;
}

.lx-form-radio-input {
    border-radius: 50%;
}

.lx-form-checkbox-input:hover,
.lx-form-radio-input:hover {
    border-color: #c0c0c0;
}

.lx-form-checkbox-input:checked {
    background-color: #4a90d9;
    border-color: #4a90d9;
    position: relative;
    background-image: none;
}

.lx-form-checkbox-input:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.lx-form-radio-input:checked {
    background-color: #ffffff;
    border-color: #4a90d9;
    position: relative;
    background-image: none;
}

.lx-form-radio-input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background-color: #4a90d9;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.lx-form-checkbox-input:focus,
.lx-form-radio-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.lx-form-checkbox-label,
.lx-form-radio-label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
    line-height: 1.4;
}

/* ==============================
   Submit Button
   ============================== */
.lx-form-field-submit {
    display: flex;
}

.lx-form-submit-btn {
    /* Reset */
    outline: none;
    border: none;
    cursor: pointer;
    /* Style */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #4a90d9;
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.lx-form-submit-btn:hover {
    background-color: #357abd;
    color: #ffffff;
}

.lx-form-submit-btn:focus {
    outline: none !important;
    box-shadow: none;
}

.lx-form-submit-btn:active {
    transform: translateY(1px);
}

/* Button Sizes */
.lx-form-btn-small {
    padding: 8px 20px;
    font-size: 13px;
}

.lx-form-btn-default {
    padding: 12px 28px;
    font-size: 15px;
}

.lx-form-btn-large {
    padding: 16px 36px;
    font-size: 17px;
}

.lx-form-btn-full,
.lx-form-btn-stretch {
    width: 100%;
    padding: 14px 28px;
    font-size: 15px;
}

/* Button Icon */
.lx-form-btn-icon {
    display: inline-flex;
    align-items: center;
}

/* Button Loading State */
.lx-form-submit-btn.lx-form-loading {
    pointer-events: none;
    opacity: 0.7;
}

.lx-form-submit-btn.lx-form-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lx-form-spin 0.6s linear infinite;
    margin-left: 8px;
}

@keyframes lx-form-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==============================
   Success Message
   ============================== */
.lx-form-success-message {
    padding: 16px 20px;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #155724;
    font-size: 14px;
    line-height: 1.5;
    margin-top: 10px;
    animation: lx-form-fade-in 0.3s ease;
}

@keyframes lx-form-fade-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================
   Error Message Box (email sending failure)
   ============================== */
.lx-form-error-message-box {
    padding: 16px 20px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    font-size: 14px;
    line-height: 1.5;
    margin-top: 10px;
    animation: lx-form-fade-in 0.3s ease;
}

/* ==============================
   Error/Validation States
   ============================== */
.lx-form-input.lx-form-error {
    border-color: #e74c3c;
}

.lx-form-error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* ==============================
   Custom Date Picker
   ============================== */
.lx-form-date-picker-wrapper {
    position: relative;
}

.lx-form-date-input {
    min-height: 42px;
    cursor: pointer;
}


/* Date Dropdown */
.lx-form-date-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10000;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 12px;
    margin-top: 4px;
    min-width: 280px;
    box-sizing: border-box;
    animation: lx-form-datepicker-fade-in 0.15s ease;
}

@keyframes lx-form-datepicker-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Date Header (month/year navigation) */
.lx-form-date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.lx-form-date-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    user-select: none;
}

.lx-form-date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: background-color 0.15s ease, color 0.15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    line-height: 1;
    padding: 0;
}

.lx-form-date-nav:hover {
    background-color: #f0f0f0;
    color: #333;
}

.lx-form-date-nav:focus {
    outline: none;
    box-shadow: none;
}

/* Date Weekday Headers */
.lx-form-date-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    margin-bottom: 4px;
}

.lx-form-date-weekdays span {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #999;
    height: 28px;
    user-select: none;
}

/* Date Days Grid */
.lx-form-date-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.lx-form-date-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 1px auto;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    font-family: inherit;
    transition: background-color 0.15s ease, color 0.15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    padding: 0;
    line-height: 1;
}

.lx-form-date-day:hover {
    background-color: #f0f4ff;
    color: #4a90d9;
}

.lx-form-date-day:focus {
    outline: none;
    box-shadow: none;
}

/* Other month days (grayed out) */
.lx-form-date-day.lx-form-date-other-month {
    color: #ccc;
}

.lx-form-date-day.lx-form-date-other-month:hover {
    color: #999;
    background-color: #f8f8f8;
}

/* Today */
.lx-form-date-day.lx-form-date-today {
    font-weight: 700;
    color: #4a90d9;
    position: relative;
}

.lx-form-date-day.lx-form-date-today::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #4a90d9;
}

/* Selected */
.lx-form-date-day.lx-form-date-selected {
    background-color: #4a90d9;
    color: #fff;
    font-weight: 600;
}

.lx-form-date-day.lx-form-date-selected:hover {
    background-color: #357abd;
    color: #fff;
}

.lx-form-date-day.lx-form-date-selected.lx-form-date-today::after {
    background-color: #fff;
}

/* Disabled (outside min/max range) */
.lx-form-date-day.lx-form-date-disabled {
    color: #ddd;
    cursor: not-allowed;
    pointer-events: none;
}

/* ==============================
   Time Picker
   ============================== */
.lx-form-time-picker {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.lx-form-time-unit {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 70px;
}

.lx-form-time-unit-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.3;
}

.lx-form-time-select {
    text-align: center;
    padding: 10px 8px !important;
    min-width: 70px;
    cursor: pointer;
}

.lx-form-time-separator {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    padding-bottom: 2px;
    line-height: 1;
    height: 42px;
    user-select: none;
}

.lx-form-time-ampm .lx-form-time-select {
    min-width: 70px;
}

/* Time picker required validation */
.lx-form-field-time .lx-form-time-select.lx-form-error {
    border-color: #e74c3c;
}

/* ==============================
   Number Input - hide spinners
   ============================== */
.lx-form-input[type="number"]::-webkit-inner-spin-button,
.lx-form-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.lx-form-input[type="number"] {
    -moz-appearance: textfield;
}

/* ==============================
   Hidden Field
   ============================== */
.lx-form-hidden {
    display: none;
}

/* ==============================
   Form Submitting Overlay
   ============================== */
.lx-form.lx-form-submitting {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.lx-form.lx-form-submitting::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    z-index: 1;
}

/* ==============================
   Responsive
   ============================== */
@media screen and (max-width: 600px) {
    .lx-form-input {
        padding: 10px 12px;
    }

    .lx-form-submit-btn {
        padding: 12px 20px;
    }

    .lx-form-btn-full {
        width: 100%;
    }

    .lx-form-date-dropdown {
        min-width: 260px;
    }

    .lx-form-date-day {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* ==============================
   WooCommerce Product Select Group
   ============================== */
.lx-form-woo-product-group-selects {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 12px;
    row-gap: 12px;
}

.lx-form-woo-product-group-item {
    margin-bottom: 0;
    min-width: 0;
}

/* When quantity is enabled, make items flex row */
.lx-form-field-woo-product-select-group[data-enable-quantity="yes"] .lx-form-woo-product-group-item {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.lx-form-woo-product-select-wrapper {
    flex: 1;
    min-width: 0;
}

.lx-form-field-woo-product-select-group[data-enable-quantity="yes"] .lx-form-woo-product-quantity {
    flex: none;
}

.lx-form-woo-product-group-item .lx-form-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}

.lx-form-group-min-error {
    margin-top: 8px;
}

/* ==============================
   Expand Button
   ============================== */
.lx-form-expand-wrapper {
    margin-top: 4px;
}

/* New line position (always used) */
.lx-form-expand-pos-newline {
    display: block;
}

.lx-form-expand-pos-newline.lx-form-expand-align-left {
    text-align: left;
}

.lx-form-expand-pos-newline.lx-form-expand-align-center {
    text-align: center;
}

.lx-form-expand-pos-newline.lx-form-expand-align-right {
    text-align: right;
}

.lx-form-expand-pos-newline .lx-form-expand-btn {
    display: inline-flex;
}

.lx-form-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid transparent;
    background: #f0f4ff;
    color: #5b7fff;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.4;
    padding: 8px 20px;
    border-radius: 20px;
    transition: color 0.3s ease, border-color 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

.lx-form-expand-btn:hover {
    color: #3a5fd9;
}

.lx-form-expand-btn:focus {
    outline: none;
    box-shadow: none;
}

.lx-form-expand-icon {
    display: inline-flex;
    align-items: center;
}

.lx-form-expand-text {
    display: inline;
}

/* ==============================
   WooCommerce Price Calculate
   ============================== */
.lx-form-field-woo-price-calculate {
    margin-bottom: 16px;
}

.lx-form-price-display {
    display: block;
    width: 100%;
}

.lx-form-price-prefix {
    display: inline;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.lx-form-price-unit {
    display: inline;
    color: #555;
    font-size: 16px;
    font-weight: 600;
}

.lx-form-price-amount {
    display: inline;
    color: #5b7fff;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.lx-form-price-suffix {
    display: inline;
    color: #333;
    font-size: 14px;
    font-weight: 400;
}

/* ==============================
   WooCommerce Product Select (Single)
   ============================== */
.lx-form-field-woo-product-select[data-enable-quantity="yes"] {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.lx-form-field-woo-product-select[data-enable-quantity="yes"] > .lx-form-label {
    width: 100%;
}

.lx-form-field-woo-product-select[data-enable-quantity="yes"] > .lx-form-woo-product-select-wrapper {
    flex: 1;
    min-width: 0;
}

.lx-form-field-woo-product-select[data-enable-quantity="yes"] > .lx-form-woo-product-quantity {
    flex: none;
}

.lx-form-field-woo-product-select[data-enable-quantity="yes"] > .lx-form-required {
    width: 100%;
}

/* ==============================
   WooCommerce Product Group (Pair)
   ============================== */
.lx-form-woo-pair-group-items {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 12px;
    row-gap: 12px;
}

.lx-form-woo-pair-group-item {
    margin-bottom: 0;
    min-width: 0;
}

.lx-form-woo-pair-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* When quantity is enabled, pair-selects grid has 3 columns */
.lx-form-woo-pair-selects .lx-form-woo-pair-quantity {
    margin-top: 0;
}

.lx-form-field-woo-product-group[data-enable-quantity="yes"] .lx-form-woo-pair-selects {
    grid-template-columns: 1fr 1fr auto;
}

.lx-form-woo-pair-select {
    min-width: 0;
}

/* Disabled state for pair product select */
select.lx-form-woo-pair-product-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

/* Per-group item label (from Repeater) */
.lx-form-woo-pair-item-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}

/* Quantity input within pair group items */
.lx-form-woo-pair-quantity {
    /* margin-top handled by grid layout */
}

.lx-form-woo-pair-quantity-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.3;
}

.lx-form-woo-pair-quantity-input {
    width: 100%;
}

.lx-form-field-woo-product-group[data-enable-quantity="yes"] .lx-form-woo-pair-quantity-input {
    width: 80px;
}

/* Quantity input within product select group items */
.lx-form-woo-product-quantity {
    /* When quantity enabled, layout handled by flex */
}

.lx-form-woo-product-quantity-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
    line-height: 1.3;
}

.lx-form-woo-product-quantity-input {
    width: 100%;
}

.lx-form-field-woo-product-select-group[data-enable-quantity="yes"] .lx-form-woo-product-quantity-input {
    width: 80px;
}

/* Price animation */
.lx-form-price-amount {
    transition: none;
}

/* Price increase animation */
.lx-form-price-amount.lx-form-price-increasing {
    animation: lx-form-price-up 0.3s ease;
}

/* Price decrease animation */
.lx-form-price-amount.lx-form-price-decreasing {
    animation: lx-form-price-down 0.3s ease;
}

@keyframes lx-form-price-up {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    30% {
        transform: translateY(-4px);
        opacity: 0.7;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes lx-form-price-down {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    30% {
        transform: translateY(4px);
        opacity: 0.7;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}
