/* Jamal Form Builder - Frontend Styles */
/* Matches the design from sifaris-slayderi.php */

.jfb-form-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.jfb-form-wrapper * {
    box-sizing: border-box;
}

.jfb-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

.jfb-form-fields {
    display: flex;
    flex-direction: column;
}

.jfb-form-group {
    position: relative;
    border-bottom: 1px solid #E5E7EB;
}

.jfb-form-group:last-child {
    border-bottom: 1px solid #E5E7EB;
}

/* Form Inputs */
.jfb-form-select,
.jfb-form-input {
    display: block;
    width: 100%;
    padding: 20px 30px 20px 0 !important;
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    color: #83888F !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    text-align: left !important;
    line-height: 1.4 !important;
}

.jfb-form-input::placeholder {
    color: #83888F !important;
    font-weight: 400 !important;
    opacity: 1 !important;
}

.jfb-form-input:focus,
.jfb-form-select:focus {
    color: #1a1a1a !important;
}

.jfb-form-input.has-value,
.jfb-form-select.has-value {
    color: #1a1a1a !important;
}

/* Select Dropdown */
.jfb-form-select {
    cursor: pointer;
    padding-right: 30px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2383888F' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0 center !important;
    background-color: transparent !important;
}

.jfb-form-select option {
    color: #1a1a1a;
    padding: 15px;
    font-size: 15px;
    text-align: left;
}

/* Textarea */
.jfb-form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Phone Group */
.jfb-phone-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jfb-phone-group .jfb-country-code {
    max-width: 100px;
    flex-shrink: 0;
}

.jfb-phone-group .jfb-form-input {
    flex: 1;
}

/* Form Buttons */
.jfb-form-buttons {
    margin-top: auto;
    padding-top: 30px;
}

.jfb-form-buttons.jfb-buttons-stacked {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.jfb-form-buttons.jfb-buttons-inline {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.jfb-form-buttons.jfb-buttons-inline .jfb-btn-primary,
.jfb-form-buttons.jfb-buttons-inline .jfb-btn-secondary {
    flex: 1;
}

/* Space-between: buttons push to bottom, fields stay at top */
.jfb-form-buttons.jfb-buttons-spaced {
    margin-top: auto;
    padding-top: 0;
}

/* Attached: buttons close to last field */
.jfb-form-buttons.jfb-buttons-attached {
    margin-top: 0;
    padding-top: 30px;
}

/* Buttons - Base styles for both */
.jfb-form-buttons .jfb-btn-primary,
.jfb-form-buttons .jfb-btn-secondary,
.jfb-form-buttons button.jfb-btn-primary,
.jfb-form-buttons a.jfb-btn-secondary {
    width: 100%;
    padding: 18px 24px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: block !important;
    text-align: center !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Primary Button - Orange background, white text */
.jfb-form-buttons .jfb-btn-primary,
.jfb-form-buttons button.jfb-btn-primary {
    background-color: #F89435 !important;
    background: #F89435 !important;
    border: 2px solid #F89435 !important;
    color: #fff !important;
}

/* Primary Button Hover - White background, orange border, orange text */
.jfb-form-buttons .jfb-btn-primary:hover,
.jfb-form-buttons button.jfb-btn-primary:hover {
    background-color: #fff !important;
    background: #fff !important;
    border: 2px solid #F89435 !important;
    color: #F89435 !important;
}

.jfb-form-buttons .jfb-btn-primary:disabled,
.jfb-form-buttons button.jfb-btn-primary:disabled {
    background-color: #ccc !important;
    background: #ccc !important;
    border-color: #ccc !important;
    color: #fff !important;
    cursor: not-allowed !important;
}

/* Secondary Button - White/transparent background, orange border, orange text */
.jfb-form-buttons .jfb-btn-secondary,
.jfb-form-buttons a.jfb-btn-secondary {
    background-color: transparent !important;
    background: transparent !important;
    border: 2px solid #F89435 !important;
    color: #F89435 !important;
}

/* Secondary Button Hover - Orange background, white text */
.jfb-form-buttons .jfb-btn-secondary:hover,
.jfb-form-buttons a.jfb-btn-secondary:hover {
    background-color: #F89435 !important;
    background: #F89435 !important;
    border: 2px solid #F89435 !important;
    color: #fff !important;
}

/* Form Messages */
.jfb-form-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
}

.jfb-form-message.show {
    display: block;
}

.jfb-form-message.success {
    background: #D1FAE5;
    color: #065F46;
}

.jfb-form-message.error {
    background: #FEE2E2;
    color: #991B1B;
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .jfb-form-select,
    .jfb-form-input {
        padding: 18px 30px 18px 0 !important;
        font-size: 15px !important;
    }
    
    .jfb-form-buttons {
        padding-top: 25px;
    }
    
    .jfb-form-buttons.jfb-buttons-inline {
        flex-direction: column;
    }
    
    .jfb-btn-primary,
    .jfb-btn-secondary {
        padding: 16px 24px;
    }
    
    .jfb-phone-group {
        flex-wrap: wrap;
    }
    
    .jfb-phone-group .jfb-country-code {
        max-width: 100%;
        width: 100%;
    }
}

/* Loading State */
.jfb-form.loading .jfb-btn-primary {
    position: relative;
    color: transparent !important;
}

.jfb-form.loading .jfb-btn-primary::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Validation States */
.jfb-form-input.error,
.jfb-form-select.error {
    border-bottom: 2px solid #dc3545 !important;
}

.jfb-form-input.valid,
.jfb-form-select.valid {
    color: #1a1a1a !important;
}

/* Conditional Fields */
.jfb-conditional-field {
    display: none !important;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

.jfb-conditional-field.show {
    display: block !important;
    visibility: visible;
    height: auto;
    overflow: visible;
    border-bottom: 1px solid #E5E7EB !important;
}

/* Success Popup - Override edilməsin deyə güclü selektorlar */
.jfb-popup-overlay,
.jfb-popup-overlay.jfb-success-popup,
body > .jfb-popup-overlay {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100vw !important;
    min-height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    z-index: 999999 !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
    transform: none !important;
    overflow: hidden !important;
}

.jfb-popup-overlay.jfb-popup-show,
.jfb-popup-overlay.jfb-success-popup.jfb-popup-show,
body > .jfb-popup-overlay.jfb-popup-show {
    display: flex !important;
}

.jfb-popup-overlay .jfb-popup-box,
.jfb-popup-overlay.jfb-success-popup .jfb-popup-box,
body > .jfb-popup-overlay .jfb-popup-box {
    background: #fff !important;
    background-color: #fff !important;
    padding: 50px 60px !important;
    border-radius: 12px !important;
    text-align: center !important;
    max-width: 420px !important;
    width: 90% !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    animation: jfbPopupIn 0.3s ease !important;
    position: relative !important;
    margin: 0 auto !important;
    border: none !important;
    transform: none !important;
    box-sizing: border-box !important;
}

@keyframes jfbPopupIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.jfb-popup-overlay .jfb-popup-icon,
body > .jfb-popup-overlay .jfb-popup-icon {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    min-height: 80px !important;
    max-height: 80px !important;
    margin: 0 auto 25px auto !important;
    padding: 0 !important;
    display: block !important;
    position: relative !important;
    overflow: visible !important;
}

.jfb-popup-overlay .jfb-popup-icon svg,
body > .jfb-popup-overlay .jfb-popup-icon svg {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    display: block !important;
}

.jfb-popup-overlay .jfb-popup-icon svg circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: jfbCircle 0.6s ease-out forwards;
}

.jfb-popup-overlay .jfb-popup-icon svg path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: jfbCheck 0.3s ease-out 0.4s forwards;
}

@keyframes jfbCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes jfbCheck {
    to { stroke-dashoffset: 0; }
}

.jfb-popup-overlay .jfb-popup-title,
body > .jfb-popup-overlay .jfb-popup-title {
    font-size: 24px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
}

.jfb-popup-overlay .jfb-popup-text,
body > .jfb-popup-overlay .jfb-popup-text {
    font-size: 15px !important;
    color: #666 !important;
    margin: 0 0 30px 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
}

.jfb-popup-overlay .jfb-popup-box .jfb-btn-primary,
.jfb-popup-overlay .jfb-popup-box .jfb-popup-close,
body > .jfb-popup-overlay .jfb-popup-box .jfb-btn-primary {
    min-width: 150px !important;
    display: inline-block !important;
    padding: 14px 30px !important;
    background: #F89435 !important;
    background-color: #F89435 !important;
    border: 2px solid #F89435 !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border-radius: 50px !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
}

.jfb-popup-overlay .jfb-popup-box .jfb-btn-primary:hover,
body > .jfb-popup-overlay .jfb-popup-box .jfb-btn-primary:hover {
    background: #fff !important;
    background-color: #fff !important;
    color: #F89435 !important;
}
