/**
 * WP FormFloat Forge - Frontend Stylesheet
 * High Performance, Zero-CLS, Glassmorphic & SEO-Friendly
 */

:root {
    --wfff-bg-color: #0052cc;
    --wfff-text-color: #ffffff;
    --wfff-offset-bottom: 95px; /* Stacks gracefully right above WhatsApp */
    --wfff-offset-side: 20px;
    --wfff-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --wfff-modal-bg: #ffffff;
    --wfff-card-radius: 16px;
    --wfff-shadow-floating: 0 8px 24px -4px rgba(0, 0, 0, 0.22), 0 4px 10px -2px rgba(0, 0, 0, 0.12);
}

/* Floating Root Container */
.wfff-floating-root {
    position: fixed;
    z-index: 99998; /* Below modal, above ordinary elements */
    font-family: var(--wfff-font);
    box-sizing: border-box;
}

.wfff-floating-root * {
    box-sizing: border-box;
}

/* Screen Positions */
.wfff-pos-bottom-right {
    bottom: var(--wfff-offset-bottom);
    right: var(--wfff-offset-side);
}

.wfff-pos-bottom-left {
    bottom: var(--wfff-offset-bottom);
    left: var(--wfff-offset-side);
}

/* Trigger Wrap */
.wfff-floating-trigger-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.wfff-pos-bottom-left .wfff-floating-trigger-wrap {
    align-items: flex-start;
}

/* Badge / Tooltip Callout */
.wfff-floating-badge {
    background: #1e293b;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    animation: wfff-badge-float 3s ease-in-out infinite;
    transform-origin: bottom right;
}

.wfff-badge-dismiss {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: 2px;
}

.wfff-badge-dismiss:hover {
    color: #ffffff;
}

/* Main Floating Button */
.wfff-floating-btn {
    height: 56px;
    min-width: 56px;
    padding: 0 20px;
    background-color: var(--wfff-bg-color);
    color: var(--wfff-text-color);
    border: none;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--wfff-shadow-floating);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    user-select: none;
}

.wfff-floating-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.28);
}

.wfff-floating-btn:active {
    transform: translateY(1px) scale(0.97);
}

.wfff-floating-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
}

.wfff-floating-btn-text {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Button Animations */
.wfff-anim-pulse .wfff-floating-btn {
    animation: wfff-pulse 2.8s infinite;
}

.wfff-anim-bounce .wfff-floating-btn {
    animation: wfff-bounce 3.5s infinite;
}

@keyframes wfff-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 82, 204, 0.6), var(--wfff-shadow-floating);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(0, 82, 204, 0), var(--wfff-shadow-floating);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 82, 204, 0), var(--wfff-shadow-floating);
    }
}

@keyframes wfff-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-9px);
    }
    60% {
        transform: translateY(-4px);
    }
}

@keyframes wfff-badge-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Modal Backdrop */
.wfff-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 16px;
}

.wfff-modal-backdrop.wfff-modal-open {
    opacity: 1;
    visibility: visible;
}

/* Modal Dialog */
.wfff-modal-dialog {
    background: var(--wfff-modal-bg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    border-radius: var(--wfff-card-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.94) translateY(12px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wfff-modal-backdrop.wfff-modal-open .wfff-modal-dialog {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.wfff-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    background: #ffffff;
}

.wfff-modal-title {
    margin: 0 0 4px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.wfff-modal-subtitle {
    margin: 0;
    font-size: 13.5px;
    color: #64748b;
    line-height: 1.4;
}

.wfff-modal-close {
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.wfff-modal-close:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

/* Modal Body */
.wfff-modal-body {
    padding: 22px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Modal Footer */
.wfff-modal-footer {
    padding: 12px 24px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Reason picker (Contacto / Solicitar cotización) */
.wfff-motive {
    margin: 0 0 18px;
    padding: 0;
    border: none;
}

.wfff-motive-title {
    margin-bottom: 10px;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.wfff-motive-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .wfff-motive-options {
        grid-template-columns: 1fr;
    }
}

.wfff-motive-option {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    color: #1e293b;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.wfff-motive-option:hover,
.wfff-motive-option:focus-visible {
    border-color: #94a3b8;
}

.wfff-motive-option.is-active {
    border-color: var(--wfff-bg-color);
    background: #f1f5ff;
}

.wfff-motive-icon {
    font-size: 22px;
    line-height: 1;
}

.wfff-motive-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wfff-motive-text strong {
    font-size: 14px;
}

.wfff-motive-text small {
    font-size: 12px;
    color: #64748b;
}

.wfff-motive-option .wfff-tab-count {
    position: absolute;
    top: -8px;
    right: -8px;
}

.wfff-motive-hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: #b45309;
}

.wfff-tab-count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--wfff-bg-color);
    color: var(--wfff-text-color);
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

.wfff-motive-panel[hidden],
.wfff-motive-hint[hidden],
.wfff-tab-count[hidden] {
    display: none;
}

/* YITH quote list inside quote forms */
.wfff-quote-list:empty {
    display: none;
}

.wfff-quote-list {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 14px;
}

.wfff-quote-title {
    margin: 0 0 8px;
    font-weight: 700;
    color: #1e293b;
}

.wfff-quote-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wfff-quote-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid #edf2f7;
}

.wfff-quote-item:first-child {
    border-top: none;
}

.wfff-quote-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.wfff-quote-item a {
    flex: 1;
    color: #1e293b;
    text-decoration: none;
}

.wfff-quote-price {
    color: #1e293b;
    font-weight: 600;
    white-space: nowrap;
}

.wfff-quote-qty {
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
}

.wfff-quote-edit {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
}

.wfff-quote-empty {
    margin: 0;
    color: #64748b;
}

/* WhatsApp shortcut (shown when a WhatsApp button is merged into the modal) */
.wfff-wa-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 10px;
    background: #25D366;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.wfff-wa-link:hover,
.wfff-wa-link:focus {
    background: #1ebe5a;
    color: #ffffff;
}

.wfff-wa-link[hidden] {
    display: none;
}

.wfff-secure-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* Forms General Layout */
.wfff-form {
    display: block;
    width: 100%;
}

.wfff-form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 0;
    margin: 0 -8px;
}

.wfff-field-wrap {
    padding: 0 8px;
    box-sizing: border-box;
    transition: opacity 0.3s ease, max-height 0.35s ease, margin 0.3s ease, padding 0.3s ease;
}

/* Conditional Logic Hidden Class */
.wfff-field-wrap.wfff-hidden {
    opacity: 0 !important;
    max-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.wfff-field-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.wfff-required-star {
    color: #ef4444;
}

/* Section / Heading Divider */
.wfff-section-header {
    width: 100%;
    padding: 10px 0 6px 0;
    margin-top: 6px;
    border-bottom: 1.5px solid #e2e8f0;
}

.wfff-section-title {
    margin: 0 0 4px 0;
    font-size: 15.5px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.wfff-section-desc {
    margin: 0;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.4;
}

/* Inputs */
.wfff-input {
    width: 100%;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    padding: 11px 14px;
    font-size: 14.5px;
    font-family: inherit;
    color: #1e293b;
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.wfff-input:focus {
    border-color: var(--wfff-bg-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.15);
}

.wfff-input.wfff-input-error {
    border-color: #ef4444;
    background-color: #fffaf0;
}

.wfff-field-error-msg {
    display: none;
    color: #ef4444;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}

.wfff-field-wrap.has-error .wfff-field-error-msg {
    display: block;
}

/* Select */
.wfff-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='18' height='18' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

/* Radio & Checkbox */
.wfff-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wfff-radio-label,
.wfff-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: #334155;
    cursor: pointer;
}

.wfff-radio-label input,
.wfff-checkbox-label input {
    cursor: pointer;
    accent-color: var(--wfff-bg-color);
}

/* Actions & Submit Button */
.wfff-form-actions {
    margin-top: 20px;
}

.wfff-submit-btn {
    width: 100%;
    padding: 13px 24px;
    background-color: var(--wfff-bg-color);
    color: var(--wfff-text-color);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: filter 0.2s ease, transform 0.15s ease;
}

.wfff-submit-btn:hover {
    filter: brightness(1.08);
}

.wfff-submit-btn:active {
    transform: scale(0.99);
}

.wfff-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
.wfff-btn-spinner {
    display: none;
    animation: wfff-spin 0.8s linear infinite;
}

.wfff-submit-btn.wfff-loading .wfff-btn-spinner {
    display: inline-flex;
}

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

/* Feedback Notice */
.wfff-form-notice {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 15px;
    line-height: 1.4;
}

.wfff-form-notice.success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.wfff-form-notice.error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Embedded Form (Shortcode in Content) */
.wfff-is-embedded {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--wfff-card-radius);
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin: 20px 0;
}

/* Responsive */
@media (max-width: 600px) {
    .wfff-modal-dialog {
        max-height: 94vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .wfff-modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }
}
