/* ==========================================================================
   LeadForge Pro - UI Design System (Dynamic)
   Mapped explicitly to Database Customization Modules
   ========================================================================== */

:root {
    /* Fallbacks natively matching Phase 4 Defaults, overriden by wp_head injections */
    --lf-primary: #3b82f6;
    --lf-bg: #ffffff;
    --lf-text: #334155;
    --lf-border: #e2e8f0;
    --lf-overlay: rgba(15, 23, 42, 0.7);
    --lf-headline-size: 24px;
    --lf-body-size: 15px;
    --lf-btn-size: 16px;
    --lf-radius: 12px;
    --lf-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --lf-align: left;

    --lf-transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    --lf-error-color: #EF4444;
    --lf-success-color: #10B981;
    --lf-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Base Styles
   -------------------------------------------------------------------------- */

.lf-wrapper {
    font-family: var(--lf-font-family);
    color: var(--lf-text);
    line-height: 1.5;
    box-sizing: border-box;
}

.lf-wrapper *,
.lf-wrapper *::before,
.lf-wrapper *::after {
    box-sizing: inherit;
}

/* Typography */
.lf-headline {
    margin: 0 0 10px 0;
    font-size: var(--lf-headline-size);
    font-weight: 700;
    color: var(--lf-text);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.lf-subtext {
    margin: 0 0 20px 0;
    font-size: var(--lf-body-size);
    color: var(--lf-text);
    opacity: 0.8;
}

/* Forms */
.lf-form-group {
    margin-bottom: 20px;
}

.lf-label {
    display: block;
    margin-bottom: 5px;
    font-size: var(--lf-body-size);
    font-weight: 600;
    color: var(--lf-text);
}

.lf-input {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--lf-body-size);
    font-family: inherit;
    color: var(--lf-text);
    background-color: transparent;
    border: 1px solid var(--lf-border);
    border-radius: var(--lf-radius);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.lf-input::placeholder {
    color: var(--lf-text);
    opacity: 0.5;
}

.lf-input:focus {
    border-color: var(--lf-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lf-input.lf-error {
    border-color: var(--lf-error-color);
}

/* Button */
.lf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    font-size: var(--lf-btn-size);
    font-weight: 600;
    font-family: inherit;
    color: #FFFFFF;
    background-color: var(--lf-primary);
    border: none;
    border-radius: var(--lf-radius);
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
    text-align: center;
    white-space: nowrap;
}

.lf-btn:hover:not(:disabled) {
    filter: brightness(0.9);
}

.lf-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.lf-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading Spinner */
.lf-spinner {
    display: none;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: lf-spin 0.8s linear infinite;
}

.lf-btn.lf-is-loading .lf-spinner {
    display: inline-block;
}

@keyframes lf-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Messages */
.lf-message {
    display: none;
    margin-top: 16px;
    padding: 12px;
    font-size: var(--lf-body-size);
    border-radius: var(--lf-radius);
    text-align: center;
}

.lf-message.lf-show-success {
    display: block;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--lf-success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.lf-message.lf-show-error {
    display: block;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--lf-error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --------------------------------------------------------------------------
   Inline Component
   -------------------------------------------------------------------------- */

.lf-inline-container {
    background: var(--lf-bg);
    padding: 40px;
    border-radius: var(--lf-radius);
    box-shadow: var(--lf-shadow);
    max-width: 800px;
    width: 100%;
    margin: 24px auto;
    border: 1px solid var(--lf-border);
    text-align: var(--lf-align);
}

.lf-inline-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lf-inline-layout .lf-form-group {
    margin-bottom: 0;
    flex: 1;
}

@media (min-width: 768px) {
    .lf-inline-layout {
        flex-direction: row;
        align-items: flex-end;
    }

    .lf-inline-layout .lf-btn-group {
        flex: 0 0 auto;
    }

    .lf-inline-layout .lf-btn {
        width: auto;
    }
}

/* --------------------------------------------------------------------------
   Popup Component
   -------------------------------------------------------------------------- */

.lf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--lf-overlay);
    z-index: 999999;
    display: flex;
    align-items: center;
    /* pos-center */
    justify-content: center;
    padding: 16px;

    opacity: 0;
    visibility: hidden;
    transition: opacity var(--lf-transition), visibility var(--lf-transition);
}

.lf-overlay.lf-pos-bottom {
    align-items: flex-end;
    padding-bottom: 40px;
}

.lf-overlay.lf-active {
    opacity: 1;
    visibility: visible;
}

.lf-overlay.lf-hidden {
    display: none !important;
}

.lf-popup-card {
    position: relative;
    background: var(--lf-bg);
    border-radius: var(--lf-radius);
    box-shadow: var(--lf-shadow);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: var(--lf-align);
    border: 1px solid var(--lf-border);
    will-change: transform, opacity;
    /* For .lf-dialog JS bridging */
}

/* Close Button */
.lf-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--lf-text);
    opacity: 0.5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.2s ease, background 0.2s ease;
    padding: 0;
}

.lf-close-btn:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Popup Animations */
.lf-dialog {
    will-change: transform, opacity;
}

/* Note: JS bridges the animation class explicitly */
.lf-anim-fade {
    animation: lf-fade-in var(--lf-transition) forwards;
}

.lf-anim-scale {
    animation: lf-scale-in var(--lf-transition) forwards;
}

.lf-anim-slide {
    animation: lf-slide-in var(--lf-transition) forwards;
}

body.lf-popup-open {
    overflow: hidden;
}

/* Specific Anim Frames */
@keyframes lf-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes lf-scale-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes lf-slide-in {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   Floating Persistent Button
   -------------------------------------------------------------------------- */

.lf-floating-trigger {
    position: fixed;
    z-index: 999990;
    padding: 14px 24px;
    border-radius: 50px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--lf-font-family);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lf-floating-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.lf-floating-trigger:active {
    transform: translateY(1px);
}