/**
 * Buzz Form Builder Frontend Styles
 * 
 * Styles for forms displayed on the frontend
 */

/* Form Container */
.buzz-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.buzz-form-container * {
    box-sizing: border-box;
}

/* Form Description */
.buzz-form-description {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.buzz-form-description p:last-child {
    margin-bottom: 0;
}

/* Form Element */
.buzz-form {
    margin: 0;
}

.buzz-form-fields {
    margin-bottom: 20px;
}

.buzz-form-field-wrapper {
    margin-bottom: 20px;
}

.buzz-form-field-wrapper:last-child {
    margin-bottom: 0;
}

/* Field Labels */
.buzz-field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

.buzz-required {
    color: #dc3232;
    font-weight: bold;
    margin-left: 2px;
}

/* Form Fields */
.buzz-form-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    transition: all 0.3s ease;
    background: #fff;
    color: #333;
}

.buzz-form-field:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.buzz-form-field.error {
    border-color: #dc3232;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.1);
}

.buzz-form-field.success {
    border-color: #46b450;
    box-shadow: 0 0 0 3px rgba(70, 180, 80, 0.1);
}

/* Specific Field Types */
.buzz-form-field[type="file"] {
    padding: 8px 12px;
    background: #f8f9fa;
    cursor: pointer;
    border-style: dashed;
}

.buzz-form-field[type="file"]:hover {
    background: #e9ecef;
    border-color: #0073aa;
}

.buzz-form-field[type="file"]:focus {
    background: #fff;
}

.buzz-form-field[type="checkbox"],
.buzz-form-field[type="radio"] {
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
    cursor: pointer;
}

.buzz-form-field[type="checkbox"] + label,
.buzz-form-field[type="radio"] + label {
    display: inline-block;
    font-weight: normal;
    margin-bottom: 0;
    cursor: pointer;
    vertical-align: middle;
}

/* Textarea */
.buzz-form-field[type="textarea"],
.buzz-form-field[data-field-type="textarea"] {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* Select Dropdown */
.buzz-form-field[data-field-type="select"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
    appearance: none;
}

/* Field Options (Radio/Checkbox) */
.buzz-field-options {
    margin-top: 10px;
}

.buzz-field-option {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.buzz-field-option:last-child {
    margin-bottom: 0;
}

.buzz-field-option label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: normal;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

/* Field Help Text */
.buzz-field-help {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
    line-height: 1.4;
}

/* Field Error Messages */
.buzz-field-error {
    margin-top: 5px;
    font-size: 12px;
    color: #dc3232;
    font-weight: 500;
    line-height: 1.4;
}

/* Submit Button */
.buzz-form-submit {
    text-align: center;
    margin-top: 30px;
}

/* reCAPTCHA Integration */
.buzz-recaptcha-wrapper {
    margin: 20px 0;
    text-align: center;
}

.buzz-recaptcha-wrapper .g-recaptcha {
    display: inline-block;
    margin: 0 auto;
}

.buzz-google-captcha,
.buzz-wp-recaptcha,
.buzz-cf7-recaptcha,
.buzz-ninja-recaptcha,
.buzz-gravity-recaptcha,
.buzz-custom-recaptcha {
    margin: 10px 0;
}

/* Honeypot field */
.buzz-honeypot {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.buzz-honeypot input {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

.buzz-submit-button {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
    min-width: 120px;
}

.buzz-submit-button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.2);
}

.buzz-submit-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.buzz-submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form Messages */
.buzz-form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    font-weight: 500;
    line-height: 1.4;
    display: none;
}

.buzz-form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.buzz-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.buzz-form-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* File Upload Info */
.buzz-file-info {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Loading State */
.buzz-form.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.buzz-form.loading .buzz-submit-button {
    position: relative;
    color: transparent;
}

.buzz-form.loading .buzz-submit-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: buzz-spin 1s linear infinite;
}

@keyframes buzz-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Checkbox and Radio Styles */
.buzz-form-field[type="checkbox"],
.buzz-form-field[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background: #fff;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.buzz-form-field[type="checkbox"]:checked {
    background: #0073aa;
    border-color: #0073aa;
}

.buzz-form-field[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.buzz-form-field[type="radio"] {
    border-radius: 50%;
}

.buzz-form-field[type="radio"]:checked {
    border-color: #0073aa;
}

.buzz-form-field[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #0073aa;
    border-radius: 50%;
}

/* Date Field */
.buzz-form-field[type="date"] {
    padding: 11px 15px;
}

/* Number Field */
.buzz-form-field[type="number"] {
    padding: 11px 15px;
}

/* Phone Field */
.buzz-form-field[type="tel"] {
    padding: 11px 15px;
}

/* URL Field */
.buzz-form-field[type="url"] {
    padding: 11px 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .buzz-form-container {
        padding: 15px;
        margin: 10px;
        border-radius: 6px;
    }
    
    .buzz-form-field {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 15px;
    }
    
    .buzz-submit-button {
        width: 100%;
        padding: 15px;
        font-size: 16px;
    }
    
    .buzz-form-description {
        padding: 12px;
        font-size: 13px;
    }
    
    .buzz-field-label {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .buzz-form-container {
        padding: 12px;
        margin: 5px;
    }
    
    .buzz-form-field {
        padding: 12px 12px;
    }
    
    .buzz-submit-button {
        padding: 12px 20px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .buzz-form-field {
        border-width: 3px;
    }
    
    .buzz-form-field:focus {
        border-width: 4px;
    }
    
    .buzz-submit-button {
        border: 2px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .buzz-form-field,
    .buzz-submit-button,
    .buzz-form-field[type="checkbox"],
    .buzz-form-field[type="radio"] {
        transition: none;
    }
    
    .buzz-form.loading .buzz-submit-button::after {
        animation: none;
    }
}


/* Print Styles */
@media print {
    .buzz-form-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .buzz-submit-button {
        display: none;
    }
    
    .buzz-form-field {
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }
} 