/* WP Pro Forms - Frontend Styles */

.wppf-form-container {
    max-width: 600px;
    margin: 0 auto 30px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
}

.wppf-form-title {
    font-size: 24px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
    text-align: center;
}

.wppf-form-description {
    color: #666;
    margin-bottom: 30px;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
}

.wppf-form {
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

/* Campo wrapper */
.wppf-field-wrapper {
    margin-bottom: 20px;
}

.wppf-field-wrapper:last-child {
    margin-bottom: 0;
}

/* Labels */
.wppf-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.wppf-required {
    color: #dc3545;
    margin-left: 2px;
}

/* Campos de entrada */
.wppf-field {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #ffffff;
    box-sizing: border-box;
}

.wppf-field:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wppf-field.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Textarea */
textarea.wppf-field {
    min-height: 100px;
    resize: vertical;
}

/* Select */
select.wppf-field {
    background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Radio y Checkbox */
.wppf-radio-group,
.wppf-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wppf-radio-group.wppf-inline,
.wppf-checkbox-group.wppf-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
}

.wppf-radio-label,
.wppf-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
}

.wppf-radio-label input,
.wppf-checkbox-label input {
    width: auto;
    margin-right: 8px;
    margin-bottom: 0;
}

/* File upload */
.wppf-file-upload {
    padding: 12px;
    border: 2px dashed #e1e5e9;
    border-radius: 6px;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
}

.wppf-file-upload:hover,
.wppf-file-upload:focus {
    border-color: #0073aa;
    background-color: #f0f8ff;
}

/* Elementos de diseño */
.wppf-heading {
    margin: 20px 0 15px;
    color: #333;
    font-weight: 600;
}

.wppf-divider {
    border: none;
    border-top: 1px solid #e1e5e9;
    margin: 20px 0;
}

.wppf-html-content {
    margin: 15px 0;
}

/* Botón de envío */
.wppf-form-actions {
    margin-top: 30px;
    text-align: center;
}

.wppf-submit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.wppf-submit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.wppf-submit-button:active {
    transform: translateY(0);
}

.wppf-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.wppf-submit-button.loading {
    position: relative;
    color: transparent;
}

.wppf-submit-button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: wppf-spin 1s linear infinite;
}

@keyframes wppf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensajes */
.wppf-form-messages {
    margin-top: 20px;
}

.wppf-success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #c3e6cb;
    margin-bottom: 15px;
}

.wppf-error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin-bottom: 15px;
}

.wppf-field-error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 5px;
    display: block;
}

/* Página de confirmación */
.wppf-confirmation-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 40px 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

.wppf-confirmation-icon {
    font-size: 48px;
    color: #28a745;
    margin-bottom: 20px;
}

.wppf-confirmation-icon .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
}

.wppf-confirmation-message {
    font-size: 18px;
    color: #333;
    line-height: 1.5;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .wppf-form {
        padding: 20px;
        margin: 0 15px;
        border-radius: 6px;
    }
    
    .wppf-form-container {
        max-width: 100%;
        padding: 0 10px;
    }
    
    .wppf-field {
        font-size: 16px; /* Prevenir zoom en iOS */
    }
    
    .wppf-radio-group.wppf-inline,
    .wppf-checkbox-group.wppf-inline {
        flex-direction: column;
        gap: 10px;
    }
    
    .wppf-submit-button {
        width: 100%;
        padding: 16px;
    }
}

@media screen and (max-width: 480px) {
    .wppf-form {
        padding: 15px;
    }
    
    .wppf-form-title {
        font-size: 20px;
    }
    
    .wppf-form-description {
        font-size: 14px;
    }
}

/* Temas adicionales */
.wppf-form.theme-minimal {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
}

.wppf-form.theme-minimal .wppf-field {
    border: none;
    border-bottom: 2px solid #e1e5e9;
    border-radius: 0;
    background: transparent;
    padding: 12px 0;
}

.wppf-form.theme-minimal .wppf-field:focus {
    border-bottom-color: #0073aa;
    box-shadow: none;
}

.wppf-form.theme-dark {
    background: #2d3748;
    color: #e2e8f0;
}

.wppf-form.theme-dark .wppf-field {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.wppf-form.theme-dark .wppf-field:focus {
    border-color: #63b3ed;
    background: #2d3748;
}

.wppf-form.theme-dark label {
    color: #e2e8f0;
}

/* Smart Autocomplete Styles */
.wppf-field-wrapper {
    position: relative;
}

.wppf-autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
}

.wppf-suggestion {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.wppf-suggestion:last-child {
    border-bottom: none;
}

.wppf-suggestion:hover,
.wppf-suggestion.active {
    background-color: #f8f9fa;
}

.wppf-suggestion.loading {
    text-align: center;
    color: #666;
    cursor: default;
    font-style: italic;
}

.wppf-suggestion.no-results {
    text-align: center;
    color: #999;
    cursor: default;
    font-style: italic;
}

.wppf-suggestion.error {
    text-align: center;
    color: #dc3545;
    cursor: default;
    font-style: italic;
}

.wppf-suggestion .address-main {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.wppf-suggestion .address-details {
    font-size: 12px;
    color: #666;
}

.wppf-suggestion:hover .address-main,
.wppf-suggestion.active .address-main {
    color: #007cba;
}

/* Responsive autocomplete */
@media screen and (max-width: 768px) {
    .wppf-autocomplete-suggestions {
        max-height: 200px;
    }
    
    .wppf-suggestion {
        padding: 10px 12px;
    }
    
    .wppf-suggestion .address-main {
        font-size: 14px;
    }
    
    .wppf-suggestion .address-details {
        font-size: 11px;
    }
}

/* Custom Submit Button Styles */
.wppf-submit-button {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border: 2px solid #007cba;
    background-color: #007cba;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.2;
    text-align: center;
    min-width: 120px;
}

.wppf-submit-button:hover {
    background-color: #005a87;
    border-color: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.wppf-submit-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 124, 186, 0.2);
}

.wppf-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Predefined Styles */
.wppf-submit-button.wppf-style-primary {
    background-color: #007cba;
    border-color: #007cba;
    color: #ffffff;
}

.wppf-submit-button.wppf-style-primary:hover {
    background-color: #005a87;
    border-color: #005a87;
}

.wppf-submit-button.wppf-style-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #ffffff;
}

.wppf-submit-button.wppf-style-secondary:hover {
    background-color: #545b62;
    border-color: #545b62;
}

.wppf-submit-button.wppf-style-success {
    background-color: #28a745;
    border-color: #28a745;
    color: #ffffff;
}

.wppf-submit-button.wppf-style-success:hover {
    background-color: #1e7e34;
    border-color: #1e7e34;
}

.wppf-submit-button.wppf-style-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #ffffff;
}

.wppf-submit-button.wppf-style-danger:hover {
    background-color: #c82333;
    border-color: #c82333;
}

/* Custom Style with Dynamic Colors */
.wppf-submit-button.wppf-custom-style:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Button Sizes */
.wppf-submit-button.wppf-size-small {
    padding: 8px 16px;
    font-size: 14px;
    min-width: 100px;
}

.wppf-submit-button.wppf-size-large {
    padding: 16px 32px;
    font-size: 18px;
    min-width: 150px;
}

/* Button Width */
.wppf-submit-button.wppf-width-full {
    width: 100%;
    display: block;
}

/* Form Actions Container */
.wppf-form-actions {
    margin-top: 30px;
    text-align: left;
}

.wppf-form-actions .wppf-width-full {
    text-align: center;
}

/* Responsive Button Styles */
@media screen and (max-width: 768px) {
    .wppf-submit-button {
        padding: 14px 24px;
        font-size: 16px;
        width: 100%;
        display: block;
    }
    
    .wppf-submit-button.wppf-size-small {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .wppf-submit-button.wppf-size-large {
        padding: 16px 28px;
        font-size: 17px;
    }
}

/* Layout Fields - Row Container System */
.wppf-row-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.wppf-row-column {
    position: relative;
    box-sizing: border-box;
    min-width: 0; /* Importante para flexbox */
}

/* Asegurar que los inputs dentro de columns no se desborden */
.wppf-row-column .wppf-field {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Ajustes para que los campos no tengan margen inferior dentro de rows */
.wppf-row-column .wppf-field-wrapper {
    margin-bottom: 0;
}

/* Debug temporal - borde para ver los contenedores */
.wppf-row-container {
    border: 1px solid #ddd;
    padding: 10px;
}

.wppf-row-column {
    border: 1px solid #ccc;
    background: rgba(0, 123, 255, 0.1);
    padding: 5px;
}

/* Placeholder solo visible en el constructor */
.wppf-row-placeholder {
    display: none;
}

.wppf-spacer {
    width: 100%;
    min-height: 10px;
}

/* Responsive Row System */
@media screen and (max-width: 768px) {
    .wppf-row-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .wppf-row-column {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .wppf-row-column .wppf-field-wrapper {
        margin-bottom: 15px;
    }
    
    .wppf-row-column:last-child .wppf-field-wrapper {
        margin-bottom: 0;
    }
}

/* Utilidades */
.wppf-hidden {
    display: none;
}

.wppf-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}