/**
 * LeadFunnel Form Styles
 * Shared between frontend and admin preview
 */

/* Form Container */
.lf-form {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Field Base Styles */
.lf-field {
    margin-bottom: 5px;
    position: relative;
}

.lf-field label {
display: block;
    font-weight: 600;
    color: #344054;
    font-size: 16px;
    margin-bottom: 0.5rem;
}

.lf-field input[type="text"],
.lf-field input[type="email"],
.lf-field input[type="url"],
.lf-field input[type="tel"],
.lf-field input[type="number"],
.lf-field input[type="password"],
.lf-field textarea,
.lf-field select {
    width: 100%;
    padding: 5px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 3px;
    font-size: 17px;
    min-height: 35px;
}

.lf-field input[type="text"]:focus,
.lf-field input[type="email"]:focus,
.lf-field input[type="url"]:focus,
.lf-field input[type="tel"]:focus,
.lf-field input[type="number"]:focus,
.lf-field input[type="password"]:focus,
.lf-field textarea:focus,
.lf-field select:focus {
    color: #666;
    border: 1px solid var(--lf-border);
    border-radius: 8px;
    padding: 3px;
}

.lf-field input[type="text"]:invalid,
.lf-field input[type="email"]:invalid,
.lf-field input[type="url"]:invalid,
.lf-field input[type="tel"]:invalid,
.lf-field input[type="number"]:invalid,
.lf-field input[type="password"]:invalid,
.lf-field textarea:invalid,
.lf-field select:invalid {

}

/* Required Field Indicator */
.lf-required {
    color: #dc3232;
}

/* Textarea */
.lf-field-textarea textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select Dropdown */
.lf-field-select select {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7em center;
    background-size: 0.65em auto;
    padding-right: 2.5rem;
    appearance: none;
}

/* Radio Buttons */
.lf-field-radio fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.lf-field-radio legend {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    padding: 0;
}

.lf-radio-option {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.lf-radio-option input[type="radio"] {
    width: auto;
    margin-right: 0.5rem;
    margin-bottom: 0;
}

.lf-radio-option label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Checkboxes */
.lf-field-checkbox fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.lf-field-checkbox legend {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    padding: 0;
}

.lf-checkbox-option {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.lf-checkbox-option input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    margin-bottom: 0;
}

.lf-checkbox-option label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Consent Checkbox */
.lf-field-consent {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 4px;
}

.lf-consent-option {
    display: flex;
    align-items: flex-start;
}

.lf-consent-option input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    margin-top: 0.2rem;
    margin-bottom: 0;
}

.lf-consent-option label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
    line-height: 1.4;
}

/* File Upload */
.lf-field-file input[type="file"] {
    padding: 0.5rem;
    border: 2px dashed #ddd;
    border-radius: 4px;
    background: #fafafa;
    cursor: pointer;
}

.lf-field-file input[type="file"]:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

/* Date/Time Pickers */
.lf-datepicker-wrapper,
.lf-datetimepicker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.lf-datepicker-wrapper input,
.lf-datetimepicker-wrapper input {
    padding-right: 3rem;
}

.lf-datepicker-icon,
.lf-datetimepicker-icon {
    position: absolute;
    right: 0.75rem;
    color: #666;
    pointer-events: none;
    font-size: 1.2rem;
}

.lf-field-datepicker-expanded .lf-datepicker-wrapper,
.lf-field-datetimepicker-expanded .lf-datetimepicker-wrapper {
    flex-direction: column;
    align-items: stretch;
}

.lf-field-datepicker-expanded .lf-datepicker-icon,
.lf-field-datetimepicker-expanded .lf-datetimepicker-icon {
    position: static;
    text-align: center;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f0f0f0;
    border-radius: 4px;
}

/* Layout System */
.lf-layout {
    display: flex;
    gap: 1rem;
    margin-bottom: 10px;
}

.lf-layout-1cols .lf-column {
    flex: 1;
}

.lf-layout-2cols .lf-column {
    flex: 1;
}

.lf-layout-3cols .lf-column {
    flex: 1;
}

.lf-layout-4cols .lf-column {
    flex: 1;
}

/* Responsive Layout */
@media (max-width: 768px) {
    .lf-layout {
        flex-direction: column;
        gap: 0;
    }
    
    .lf-layout .lf-column {
        margin-bottom: 1.5rem;
    }
    
    .lf-layout .lf-column:last-child {
        margin-bottom: 0;
    }
}

/* Section */
.lf-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.lf-section-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.lf-section-description {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

/* Submit Button */
.lf-field-submit {
    text-align: center;
    margin-top: 2rem;
}

.lf-submit-button {
    background: var(--lf-primary-color, #0073aa);
    color: #fff;
    border: 2px solid var(--lf-primary-color, #0073aa);
    padding: 10px;
    font-size: 17px;
    font-weight: 600;
    border-radius: var(--lf-radius, 4px);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
}

.lf-submit-button:hover {
    background: var(--lf-primary-color-dark, #005a87);
    border-color: var(--lf-primary-color-dark, #005a87);
}

.lf-submit-button:active {
    transform: translateY(0);
}

.lf-submit-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--lf-primary-color-light, rgba(0, 115, 170, 0.3));
}

/* Phone Field */
.lf-phone-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.lf-phone-prefix {
    flex: 0 0 auto;
    min-width: 120px;
}

.lf-phone-prefix-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--lf-border, #ddd);
    border-radius: var(--lf-radius, 4px);
    background: #fff;
    font-size: 0.9rem;
    color: var(--lf-text-color, #333);
    transition: border-color 0.2s ease;
}

.lf-phone-prefix-select:focus {
    outline: none;
    border-color: var(--lf-primary-color, #0073aa);
    box-shadow: 0 0 0 3px var(--lf-primary-color-light, rgba(0, 115, 170, 0.1));
}

.lf-phone-number {
    flex: 1;
}

.lf-phone-number-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--lf-border, #ddd);
    border-radius: var(--lf-radius, 4px);
    background: #fff;
    font-size: 1rem;
    color: var(--lf-text-color, #333);
    transition: border-color 0.2s ease;
}

.lf-phone-number-input:focus {
    outline: none;
    border-color: var(--lf-primary-color, #0073aa);
    box-shadow: 0 0 0 3px var(--lf-primary-color-light, rgba(0, 115, 170, 0.1));
}

/* Custom HTML */
.lf-field-custom-html {
    margin: 1.5rem 0;
}

.lf-field-custom-html h1,
.lf-field-custom-html h2,
.lf-field-custom-html h3,
.lf-field-custom-html h4,
.lf-field-custom-html h5,
.lf-field-custom-html h6 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.lf-field-custom-html p {
    margin-bottom: 1rem;
}

.lf-field-custom-html ul,
.lf-field-custom-html ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.lf-field-custom-html a {
    color: #0073aa;
    text-decoration: none;
}

.lf-field-custom-html a:hover {
    text-decoration: underline;
}

/* Hidden Fields */
.lf-field input[type="hidden"] {
    display: none;
}

/* Error States */
.lf-field-error input,
.lf-field-error textarea,
.lf-field-error select {
    border-color: #dc3232;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.1);
}

.lf-field-error-message {
    color: #dc3232;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Success States */
.lf-field-success input,
.lf-field-success textarea,
.lf-field-success select {
    border-color: #46b450;
    box-shadow: 0 0 0 3px rgba(70, 180, 80, 0.1);
}

/* Form Messages */
.lf-form-message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.lf-form-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.lf-form-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.lf-form-message-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading States */
.lf-form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.lf-form-loading .lf-submit-button {
    position: relative;
    color: transparent;
}

.lf-form-loading .lf-submit-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: lf-spin 1s linear infinite;
}

@keyframes lf-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Preview Mode Adjustments */
.lf-preview .lf-field input,
.lf-preview .lf-field textarea,
.lf-preview .lf-field select {
    pointer-events: none;
    background: #f9f9f9;
}

.lf-preview .lf-submit-button {
    background: var(--lf-muted-color, #666);
    border-color: var(--lf-muted-color, #666);
    cursor: not-allowed;
}

.lf-preview .lf-submit-button:hover {
    background: var(--lf-muted-color, #666);
    border-color: var(--lf-muted-color, #666);
    transform: none;
}

/* Accessibility */
.lf-field input:focus,
.lf-field textarea:focus,
.lf-field select:focus,
.lf-field button:focus {

}

/* Consent Lightbox */
.lf-consent-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

/* Prevent body scroll when lightbox is open */
body.lf-lightbox-open {
    overflow: hidden;
}

.lf-consent-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.lf-consent-lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.lf-consent-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e1e1e1;
    background: #f9f9f9;
}

.lf-consent-lightbox-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.lf-consent-lightbox-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.lf-consent-lightbox-close:hover {
    background: #e1e1e1;
    color: #333;
}

.lf-consent-lightbox-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    line-height: 1.6;
}

.lf-consent-lightbox-body p {
    margin-bottom: 15px;
}

.lf-consent-lightbox-body p:last-child {
    margin-bottom: 0;
}

.lf-consent-lightbox-footer {
    padding: 20px;
    border-top: 1px solid #e1e1e1;
    background: #f9f9f9;
    text-align: right;
}

.lf-consent-lightbox-accept {
    background: var(--lf-primary-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.lf-consent-lightbox-accept:hover {
    background: var(--lf-primary-color-dark);
}

/* Consent Link Styling */
.lf-consent-link {
    color: var(--lf-primary-color);
    text-decoration: underline;
}

.lf-consent-link:hover {
    color: var(--lf-primary-color-dark);
}

.lf-consent-lightbox-trigger {
    color: var(--lf-primary-color);
    text-decoration: underline;
    cursor: pointer;
}

.lf-consent-lightbox-trigger:hover {
    color: var(--lf-primary-color-dark);
}

/* Responsive Lightbox */
@media (max-width: 768px) {
    .lf-consent-lightbox-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .lf-consent-lightbox-header,
    .lf-consent-lightbox-body,
    .lf-consent-lightbox-footer {
        padding: 15px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .lf-field input,
    .lf-field textarea,
    .lf-field select {
        border-width: 3px;
    }
    
    .lf-submit-button {
        border: 2px solid var(--lf-text-color, #000);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .lf-field input,
    .lf-field textarea,
    .lf-field select,
    .lf-submit-button {
        transition: none;
    }
    
    .lf-submit-button:hover {
        transform: none;
    }
    
    @keyframes lf-spin {
        to {
            transform: none;
        }
    }
}

