/* === XTRADEV FORM COMPONENT === */

/* Wrapper */
.xf-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.xf-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 900;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}
.xf-subtitle {
    font-size: 15px;
    margin-bottom: 2rem;
    opacity: 0.6;
}

/* Theme: Light */
.xf-theme-light .xf-title { color: #1a2744; }
.xf-theme-light .xf-subtitle { color: #1a2744; }
.xf-theme-light .xf-label { color: #1a2744; }
.xf-theme-light .xf-input {
    background: #fff;
    border-color: rgba(26, 39, 68, 0.15);
    color: #1a2744;
}
.xf-theme-light .xf-input::placeholder { color: rgba(26, 39, 68, 0.35); }
.xf-theme-light .xf-input:focus {
    border-color: #2a9d8f;
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}
.xf-theme-light .xf-checkbox-label { color: #1a2744; }

/* Theme: Dark */
.xf-theme-dark .xf-title { color: #fff; }
.xf-theme-dark .xf-subtitle { color: rgba(255,255,255,0.5); }
.xf-theme-dark .xf-label { color: rgba(255,255,255,0.8); }
.xf-theme-dark .xf-input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.15);
    color: #fff;
}
.xf-theme-dark .xf-input::placeholder { color: rgba(255,255,255,0.3); }
.xf-theme-dark .xf-input:focus {
    border-color: #2a9d8f;
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.15);
}
.xf-theme-dark .xf-checkbox-label { color: rgba(255,255,255,0.8); }
.xf-theme-dark .xf-success-title { color: #fff; }
.xf-theme-dark .xf-success-message { color: rgba(255,255,255,0.6); }
.xf-theme-dark .xf-error-global { background: rgba(220, 38, 38, 0.15); border-color: rgba(220, 38, 38, 0.3); color: #fca5a5; }

/* Fields grid */
.xf-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.xf-field {
    width: 100%;
}
.xf-field-half {
    width: calc(50% - 0.5rem);
}
@media (max-width: 640px) {
    .xf-field-half { width: 100%; }
}

/* Label */
.xf-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.xf-required {
    color: #2a9d8f;
    font-weight: 700;
}

/* Inputs */
.xf-input {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 15px;
    font-family: inherit;
    border: 1.5px solid;
    border-radius: 0.75rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.xf-textarea {
    resize: vertical;
    min-height: 100px;
}

.xf-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.xf-file {
    padding: 0.5rem;
    font-size: 14px;
}

/* Checkbox */
.xf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.4;
    padding: 0.5rem 0;
}
.xf-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.xf-checkbox-box {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(42, 157, 143, 0.4);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.xf-checkbox:checked + .xf-checkbox-box {
    background: #2a9d8f;
    border-color: #2a9d8f;
}
.xf-checkbox:checked + .xf-checkbox-box::after {
    content: '';
    display: block;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

/* Field errors */
.xf-field-error {
    font-size: 13px;
    color: #dc2626;
    margin-top: 0.3rem;
    font-weight: 500;
}
.xf-has-error .xf-input {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1) !important;
}

/* Global error */
.xf-error-global {
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #dc2626;
    font-size: 14px;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin-top: 1rem;
}

/* Submit button */
.xf-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.85rem 2rem;
    background: #2a9d8f;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.xf-submit:hover:not(:disabled) {
    background: #34b8a8;
}
.xf-submit:active:not(:disabled) {
    transform: scale(0.98);
}
.xf-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.xf-submit.xf-loading {
    opacity: 0.85;
}

.xf-submit-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Spinner */
@keyframes xf-spin {
    to { transform: rotate(360deg); }
}
.xf-spinner {
    width: 20px;
    height: 20px;
    animation: xf-spin 0.8s linear infinite;
}

/* Success state */
.xf-success {
    text-align: center;
    padding: 2rem 1rem;
}
.xf-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(42, 157, 143, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}
.xf-success-icon svg {
    width: 32px;
    height: 32px;
    color: #2a9d8f;
}
.xf-success-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1a2744;
    margin-bottom: 0.5rem;
}
.xf-success-message {
    font-size: 15px;
    color: rgba(26, 39, 68, 0.6);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}
.xf-success-cta {
    display: inline-flex;
    align-items: center;
    padding: 0.7rem 2rem;
    background: #2a9d8f;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 999px;
    text-decoration: none;
    transition: background 0.2s;
}
.xf-success-cta:hover {
    background: #34b8a8;
}

/* Animation entrance */
@keyframes xf-fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.xf-success {
    animation: xf-fadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* === MODAL POPUP === */
.xf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(26, 39, 68, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.xf-modal-overlay.xf-modal-open {
    opacity: 1;
    visibility: visible;
}
.xf-modal-container {
    background: #fff;
    border-radius: 1.5rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(30px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
}
.xf-modal-open .xf-modal-container {
    transform: translateY(0) scale(1);
}
.xf-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(26, 39, 68, 0.06);
    color: #1a2744;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
    z-index: 1;
}
.xf-modal-close:hover {
    background: rgba(26, 39, 68, 0.12);
}
@media (max-width: 640px) {
    .xf-modal-container {
        padding: 1.5rem;
        border-radius: 1rem;
        max-height: 95vh;
    }
}
