/**
 * Veloxity Lead Capture Popup - Frontend Styles
 */

/* Popup Wrapper */
.vlx-lc-popup-wrapper {
    position: relative;
}

/* Editor placeholder styles are in leadcapture-editor.css */

/* Popup Overlay */
.vlx-lc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.vlx-lc-popup-overlay.vlx-lc-visible {
    display: flex;
    opacity: 1;
}

/* Editor preview state - handled by editor CSS */
.vlx-lc-popup-overlay.vlx-lc-editor-preview {
    /* Styles in leadcapture-editor.css */
}

/* Popup Content */
.vlx-lc-popup-content {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    width: 680px;
    max-width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Editor preview content shadow handled by editor CSS */

/* Close Button */
.vlx-lc-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color 0.2s ease, background-color 0.2s ease;
    border-radius: 50%;
    user-select: none;
}

.vlx-lc-popup-close:hover {
    color: #333;
    background-color: rgba(0, 0, 0, 0.05);
}

.vlx-lc-popup-close svg {
    width: 20px;
    height: 20px;
}

/* Header */
.vlx-lc-popup-header {
    margin: 0;
    padding: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: center;
    box-sizing: border-box;
}

/* Form Fields Container */
.vlx-lc-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

/* Field Wrapper */
.vlx-lc-field-wrapper {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Width classes - using calc to account for 20px gap */
.vlx-lc-field-w100 {
    width: 100%;
}

.vlx-lc-field-w75 {
    width: calc(75% - 5px);
}

.vlx-lc-field-w66 {
    width: calc(66.666% - 6.67px);
}

.vlx-lc-field-w60 {
    width: calc(60% - 8px);
}

.vlx-lc-field-w50 {
    width: calc(50% - 10px);
}

.vlx-lc-field-w40 {
    width: calc(40% - 12px);
}

.vlx-lc-field-w33 {
    width: calc(33.333% - 13.33px);
}

.vlx-lc-field-w25 {
    width: calc(25% - 15px);
}

/* Labels */
.vlx-lc-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.vlx-lc-required {
    color: #e74c3c;
    margin-left: 2px;
}

/* Input Fields */
.vlx-lc-field-input,
.vlx-lc-field-textarea,
.vlx-lc-field-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: #fff;
    color: #333;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.vlx-lc-field-input:focus,
.vlx-lc-field-textarea:focus,
.vlx-lc-field-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.vlx-lc-field-input::placeholder,
.vlx-lc-field-textarea::placeholder {
    color: #999;
}

.vlx-lc-field-textarea {
    resize: vertical;
    min-height: 100px;
}

.vlx-lc-field-select {
    cursor: pointer;
    appearance: none;
    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 15px center;
    padding-right: 40px;
}

/* Radio & Checkbox Options */
.vlx-lc-options-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vlx-lc-options-wrapper.vlx-lc-options-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px 20px;
}

.vlx-lc-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vlx-lc-field-radio,
.vlx-lc-field-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #3498db;
}

.vlx-lc-option-label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
    user-select: none;
}

/* Custom styled radio/checkbox options */
.vlx-lc-custom-option {
    position: relative;
    width: 100%;
}

.vlx-lc-custom-option input[type="radio"],
.vlx-lc-custom-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.vlx-lc-custom-option .vlx-lc-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 15px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.vlx-lc-custom-option .vlx-lc-option-label:hover {
    border-color: #bbb;
}

.vlx-lc-custom-option .vlx-lc-option-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 16px;
    min-height: 16px;
}

.vlx-lc-custom-option .vlx-lc-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

/* Normal icon: visible by default */
.vlx-lc-custom-option .vlx-lc-icon-normal {
    opacity: 1;
}

/* Selected icon: hidden by default */
.vlx-lc-custom-option .vlx-lc-icon-selected {
    opacity: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* When checked: hide normal, show selected */
.vlx-lc-custom-option input:checked + .vlx-lc-option-label .vlx-lc-icon-normal {
    opacity: 0;
}

.vlx-lc-custom-option input:checked + .vlx-lc-option-label .vlx-lc-icon-selected {
    opacity: 1;
}

.vlx-lc-custom-option .vlx-lc-option-icon svg {
    width: 16px;
    height: 16px;
}

.vlx-lc-custom-option .vlx-lc-option-icon i {
    font-size: 16px;
    line-height: 1;
}

.vlx-lc-custom-option input:checked + .vlx-lc-option-label {
    background-color: #3498db;
    border-color: #3498db;
    color: #fff;
}

.vlx-lc-custom-option .vlx-lc-option-text {
    flex: 1;
}

/* Caption Field */
.vlx-lc-caption {
    width: 100%;
    box-sizing: border-box;
}

/* Submit Button */
.vlx-lc-submit-btn {
    display: inline-block;
    width: 100%;
    padding: 15px 30px;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background-color: #3498db;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: center;
    user-select: none;
    box-sizing: border-box;
}

.vlx-lc-submit-btn:hover {
    background-color: #2980b9;
}

.vlx-lc-submit-btn:active {
    transform: scale(0.98);
}

.vlx-lc-submit-btn.vlx-lc-loading {
    position: relative;
    color: transparent !important;
    background-color: #bdc3c7;
    cursor: not-allowed;
    pointer-events: none;
}

.vlx-lc-submit-btn.vlx-lc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: vlx-lc-spin 0.8s linear infinite;
}

@keyframes vlx-lc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Validation Error State */
.vlx-lc-field-wrapper.vlx-lc-error .vlx-lc-field-input,
.vlx-lc-field-wrapper.vlx-lc-error .vlx-lc-field-textarea,
.vlx-lc-field-wrapper.vlx-lc-error .vlx-lc-field-select {
    border-color: #e74c3c;
}

.vlx-lc-field-wrapper.vlx-lc-error .vlx-lc-field-label {
    color: #e74c3c;
}

/* Responsive */
@media (max-width: 600px) {
    .vlx-lc-popup-content {
        padding: 30px 20px;
    }

    /* All fields become full width on mobile */
    .vlx-lc-field-wrapper {
        width: 100% !important;
    }

    .vlx-lc-popup-header {
        font-size: 20px;
        margin-left: -20px !important;
        margin-right: -20px !important;
        margin-top: -30px !important;
    }
}

/* Virtual Keyboard overrides */
.virtual-keyboard.keyboard-normal {
    max-width: 720px !important;
}

/* Animation for popup appear */
.vlx-lc-popup-overlay.vlx-lc-animating {
    display: flex;
}

.vlx-lc-popup-content {
    transform: scale(0.9);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.vlx-lc-popup-overlay.vlx-lc-visible .vlx-lc-popup-content {
    transform: scale(1);
}
