/* ====================================
   JR FORM BUILDER - PROFESSIONAL STYLES
   Primary: #68615e | Secondary: #FDF7F1
   ==================================== */

/* Reset & Base */
.jr-advance-form-builder-wrap *,
.jr-advance-form-builder-wrap *::before,
.jr-advance-form-builder-wrap *::after {
    box-sizing: border-box;
}

.jr-advance-form-builder-wrap {
    --jr-primary: #68615e;
    --jr-secondary: #FDF7F1;
    --jr-text: #333333;
    --jr-text-light: #9a8f87;
    --jr-border: #e8e0d8;
    --jr-border-light: #f0ebe6;
    --jr-success: #2e7d32;
    --jr-error: #c62828;
    --jr-radius: 8px;
    --jr-transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Container */
.jr-advance-form-container {
    position: relative;
    max-width: 100%;
}

/* ====================================
   FORM HEADER
   ==================================== */
.jr-advance-form-header {
    padding-bottom: 24px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--jr-border-light);
}

.jr-advance-form-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.jr-advance-form-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--jr-secondary);
    border-radius: 10px;
    color: var(--jr-primary);
    flex-shrink: 0;
}

.jr-advance-form-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--jr-primary);
    margin: 0;
    text-transform: uppercase;
}

.jr-advance-form-subtitle {
    font-size: 14px;
    color: var(--jr-text-light);
    margin: 0;
    line-height: 1.5;
}

/* ====================================
   SECTION HEADINGS
   ==================================== */
.jr-section-heading {
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--jr-border-light);
    margin-bottom: 20px;
}

.jr-section-heading:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.jr-section-heading h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--jr-primary);
    margin: 0 0 6px 0;
}

.jr-section-heading p {
    font-size: 13px;
    color: var(--jr-text-light);
    margin: 0;
    line-height: 1.5;
    font-style: italic;
}

/* ====================================
   FIELDS ROW & WRAPPER
   ==================================== */
.jr-fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 0;
}

.jr-field-wrapper {
    margin-bottom: 16px;
    flex-shrink: 0;
}

.jr-field-w-100 { width: 100%; flex: 0 0 100%; }
.jr-field-w-50 { width: calc(50% - 8px); flex: 0 0 calc(50% - 8px); }
.jr-field-w-33 { width: calc(33.333% - 11px); flex: 0 0 calc(33.333% - 11px); }
.jr-field-w-66 { width: calc(66.666% - 5px); flex: 0 0 calc(66.666% - 5px); }
.jr-field-w-25 { width: calc(25% - 12px); flex: 0 0 calc(25% - 12px); }
.jr-field-w-75 { width: calc(75% - 4px); flex: 0 0 calc(75% - 4px); }

@media (max-width: 767px) {
    .jr-field-w-50,
    .jr-field-w-33,
    .jr-field-w-66,
    .jr-field-w-25,
    .jr-field-w-75 {
        width: 100%;
        flex: 0 0 100%;
    }
}

/* ====================================
   LABELS
   ==================================== */
.jr-field-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--jr-primary);
    margin-bottom: 8px;
}

.jr-required {
    color: var(--jr-error);
    margin-left: 2px;
}

/* ====================================
   INPUT FIELDS
   ==================================== */
.jr-field-input,
.jr-field-textarea,
.jr-field-select {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--jr-text);
    background-color: var(--jr-secondary);
    border: 1px solid var(--jr-border);
    border-radius: var(--jr-radius);
    transition: var(--jr-transition);
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.jr-field-input::placeholder,
.jr-field-textarea::placeholder {
    color: #b5ada6;
}

.jr-field-input:focus,
.jr-field-textarea:focus,
.jr-field-select:focus {
    border-color: var(--jr-primary);
    box-shadow: 0 0 0 3px rgba(104, 97, 94, 0.1);
}

.jr-field-input.jr-field-error,
.jr-field-textarea.jr-field-error,
.jr-field-select.jr-field-error {
    border-color: var(--jr-error);
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

.jr-field-textarea {
    resize: vertical;
    min-height: 100px;
}

.jr-field-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2368615e' d='M6 8.825L.35 3.175l.7-.7L6 7.425l4.95-4.95.7.7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

/* ====================================
   CHECKBOX & RADIO
   ==================================== */
.jr-checkbox-group,
.jr-radio-group {
    display: grid;
    gap: 8px 16px;
}

.jr-cols-1 { grid-template-columns: 1fr; }
.jr-cols-2 { grid-template-columns: repeat(2, 1fr); }
.jr-cols-3 { grid-template-columns: repeat(3, 1fr); }
.jr-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 767px) {
    .jr-cols-3,
    .jr-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.jr-checkbox-label,
.jr-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    padding: 8px 12px;
    border-radius: 6px;
    transition: var(--jr-transition);
    background: transparent;
}

.jr-checkbox-label:hover,
.jr-radio-label:hover {
    background: var(--jr-secondary);
}

.jr-checkbox-custom,
.jr-radio-custom {
    width: 18px;
    height: 18px;
    accent-color: var(--jr-primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* ====================================
   CONSENT
   ==================================== */
.jr-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    padding: 16px;
    background: var(--jr-secondary);
    border-radius: var(--jr-radius);
    border: 1px solid var(--jr-border-light);
    transition: var(--jr-transition);
}

.jr-consent-label:hover {
    border-color: var(--jr-primary);
}

.jr-consent-label .jr-checkbox-custom {
    margin-top: 2px;
}

/* ====================================
   FILE UPLOAD
   ==================================== */
.jr-file-upload-wrap {
    position: relative;
}

.jr-field-file {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

.jr-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 20px;
    border: 2px dashed var(--jr-border);
    border-radius: var(--jr-radius);
    background: var(--jr-secondary);
    cursor: pointer;
    transition: var(--jr-transition);
    color: var(--jr-text-light);
    font-size: 14px;
}

.jr-file-label:hover {
    border-color: var(--jr-primary);
    background: #fff;
    color: var(--jr-primary);
}

.jr-file-label svg {
    flex-shrink: 0;
}

.jr-file-name {
    font-size: 13px;
    color: var(--jr-primary);
    margin-top: 8px;
    font-weight: 500;
    display: none;
}

.jr-file-name.has-file {
    display: block;
}

.jr-file-info {
    font-size: 11px;
    color: var(--jr-text-light);
    margin-top: 6px;
}

/* ====================================
   SUBMIT BUTTON
   ==================================== */
.jr-submit-wrap {
    margin-top: 32px;
}

.jr-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 40px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--jr-secondary);
    background-color: var(--jr-primary);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--jr-transition);
    width: 100%;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.jr-submit-btn:hover {
    background-color: #574f4c;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(104, 97, 94, 0.3);
}

.jr-submit-btn:active {
    transform: translateY(0);
}

.jr-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.jr-btn-icon {
    display: flex;
    align-items: center;
    font-size: 16px;
}

.jr-btn-icon svg {
    width: 16px;
    height: 16px;
}

.jr-btn-loader {
    display: flex;
    align-items: center;
}

/* Spinner Animation */
@keyframes jr-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.jr-spinner {
    animation: jr-spin 1s linear infinite;
}

/* ====================================
   FOOTER TEXT
   ==================================== */
.jr-advance-form-footer-text {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--jr-text-light);
    line-height: 1.6;
}

/* ====================================
   SUCCESS & ERROR MESSAGES
   ==================================== */
.jr-advance-form-success {
    padding: 20px 24px;
    border-radius: 12px;
    background-color: #e8f5e9;
    margin-top: 20px;
    animation: jr-slideUp 0.4s ease;
}

.jr-success-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.jr-success-icon {
    display: flex;
    align-items: center;
    color: #2e7d32;
    flex-shrink: 0;
}

.jr-success-text {
    font-size: 14px;
    font-weight: 500;
    color: #2e7d32;
    line-height: 1.5;
}

.jr-advance-form-error {
    padding: 16px 20px;
    border-radius: 10px;
    background-color: #fce4ec;
    margin-top: 16px;
    animation: jr-slideUp 0.4s ease;
}

.jr-error-text {
    font-size: 13px;
    color: #c62828;
    line-height: 1.5;
}

@keyframes jr-slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================================
   INLINE SUBSCRIBE LAYOUT
   ==================================== */
.jr-layout-inline_subscribe .jr-advance-form-container {
    padding: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
}

.jr-inline-subscribe-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.jr-inline-field {
    flex: 1;
    position: relative;
}

.jr-inline-field .jr-field-input {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 12px 4px;
    font-size: 15px;
    border-bottom: 1px solid var(--jr-border);
}

.jr-inline-field .jr-field-input:focus {
    border-bottom-color: var(--jr-primary);
    box-shadow: none;
}

.jr-inline-border-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--jr-primary);
    transition: width 0.3s ease;
}

.jr-inline-field .jr-field-input:focus ~ .jr-inline-border-line {
    width: 100%;
}

.jr-subscribe-btn {
    white-space: nowrap;
    width: auto !important;
    flex-shrink: 0;
}

.jr-layout-inline_subscribe .jr-advance-form-success,
.jr-layout-inline_subscribe .jr-advance-form-error {
    margin-top: 12px;
}

@media (max-width: 575px) {
    .jr-inline-subscribe-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .jr-subscribe-btn {
        width: 100% !important;
    }
}

/* ====================================
   SIMPLE SUBMIT LAYOUT
   ==================================== */
.jr-simple-submit-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--jr-border-light);
}

.jr-simple-submit-left .jr-submit-btn {
    width: auto;
    white-space: nowrap;
}

.jr-simple-submit-right {
    font-size: 13px;
    color: var(--jr-text-light);
    line-height: 1.6;
}

.jr-simple-submit-right a {
    color: var(--jr-primary);
    text-decoration: none;
}

.jr-simple-submit-right a:hover {
    text-decoration: underline;
}

@media (max-width: 575px) {
    .jr-simple-submit-wrap {
        flex-direction: column;
        text-align: center;
    }

    .jr-simple-submit-left .jr-submit-btn {
        width: 100%;
    }
}

/* ====================================
   LOADING OVERLAY
   ==================================== */
.jr-form.is-submitting {
    position: relative;
    pointer-events: none;
}

.jr-form.is-submitting::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: inherit;
    z-index: 10;
}

/* ====================================
   FIELD VALIDATION STATE
   ==================================== */
.jr-field-wrapper.has-error .jr-field-input,
.jr-field-wrapper.has-error .jr-field-textarea,
.jr-field-wrapper.has-error .jr-field-select {
    border-color: var(--jr-error);
}

.jr-field-error-msg {
    font-size: 12px;
    color: var(--jr-error);
    margin-top: 4px;
    display: none;
}

.jr-field-wrapper.has-error .jr-field-error-msg {
    display: block;
    animation: jr-slideUp 0.3s ease;
}