/* Settings Page Layout */
.ipb-settings-page {
    margin: 20px;
}

.ipb-settings-wrapper {
    margin-top: 20px;
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

/* Navigation Tabs */
.nav-tab-wrapper {
    border-bottom: 1px solid #ccd0d4;
    padding: 0;
    margin: 0;
    background: #fff;
}

.nav-tab {
    margin: 0;
    padding: 10px 20px;
    font-size: 14px;
    line-height: 2;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: #555;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.nav-tab:hover {
    background: #f8f9fa;
    border-bottom-color: #007cba;
    color: #007cba;
}

.nav-tab-active,
.nav-tab-active:hover {
    border-bottom-color: #007cba;
    background: #f8f9fa;
    color: #007cba;
    font-weight: 600;
}

.nav-tab i {
    margin-right: 8px;
    font-size: 16px;
}

/* Settings Content */
.ipb-settings-content {
    padding: 20px;
}

.ipb-settings-section {
    margin-bottom: 30px;
}

/* .ipb-section-header {
    margin-bottom: 15px;
} */

.ipb-section-header h2 {
    margin: 0;
    padding: 0;
    font-size: 1.3em;
    font-weight: 600;
    color: #23282d;
}

.ipb-section-content {
    background: #fff;
    border: 1px solid #e9ecef;
    padding: 30px;
}

.rules{
    align-items: center !important;
}
.rules h2 {
    font-size: 16px;
    font-weight: 400;
}

/* Form Elements */
.form-table {
    margin-top: 0;
    background: transparent;
}

.form-table th {
    padding: 20px 10px 20px 0;
    width: 200px;
    font-weight: 600;
    color: #23282d;
}

.form-table td {
    padding: 15px 10px;
    vertical-align: top;
}

.form-table label {
    vertical-align: middle;
}

.form-table input[type="text"],
.form-table input[type="number"],
.form-table input[type="email"],
.form-table input[type="url"],
.form-table input[type="password"],
.form-table select {
    min-height: 30px;
    padding: 5px 8px;
    border-radius: 4px;
    border: 1px solid #8c8f94;
}

.form-table input[type="text"]:focus,
.form-table input[type="number"]:focus,
.form-table input[type="email"]:focus,
.form-table input[type="url"]:focus,
.form-table input[type="password"]:focus,
.form-table select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
}

.form-table .description {
    font-size: 13px;
    margin: 5px 0 0;
    color: #646970;
}

/* Submit Button */
.submit {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    margin: 0;
    clear: both;
}

.submit .button-primary {
    min-height: 32px;
    line-height: 2.30769231;
    padding: 0 12px;
}

/* Notices */
.notice {
    margin: 15px 0;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-left-width: 4px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    padding: 1px 12px;
}

.notice-success {
    border-left-color: #00a32a;
}

.notice-error {
    border-left-color: #d63638;
}

/* Grid Position Selector */
.ipb-position-grid {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 5px;
    margin-bottom: 15px;
    background: #fff;
    padding: 10px;
    border-radius: 4px;
}

.ipb-grid-cell {
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ipb-grid-cell:hover {
    border-color: #007cba;
    background-color: rgba(0, 124, 186, 0.1);
}

.ipb-grid-cell.selected {
    border-color: #007cba;
    background-color: rgba(0, 124, 186, 0.2);
}

/* Responsive Design */
@media screen and (max-width: 782px) {
    .form-table th {
        padding: 15px 10px 0;
        width: auto;
        display: block;
    }

    .form-table td {
        padding: 10px;
        display: block;
    }

    .form-table input[type="text"],
    .form-table input[type="number"],
    .form-table input[type="email"],
    .form-table input[type="url"],
    .form-table input[type="password"],
    .form-table select {
        width: 100%;
        max-width: none;
        font-size: 16px;
    }
}

/* Utility Classes */
.ipb-mb-10 {
    margin-bottom: 10px;
}

.ipb-mt-15 {
    margin-top: 15px;
}

.ipb-hidden {
    display: none;
}

/* Conditions Upsell Card (matches core sample) */
.ipb-upsell-card {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 16px;
    max-width: 920px;
}

.ipb-upsell-card__title {
    margin: 0 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.ipb-upsell-card__desc {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #50575e;
}

.ipb-upsell-card__actions .button {
    margin: 0;
}

/* Settings Wrapper */
.ipb-settings-wrapper {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    margin: 20px 0;
    display: flex;
}

/* Settings Tabs */
.ipb-settings-tabs {
    display: flex;
    flex-direction: column;
    background: #fff;
}

#closing .input_fields .fields label {
    color: #000;
    font-weight: 400;
}

#closing .input_fields .fields {
    background: #f4f6f8;
    color: #000;
}

#closing .input_fields .fields input:before, .video_wrapper input[type="checkbox"]:before {
    position: absolute;
    content: '';
    width: 25px !important;
    height: 25px !important;
    background: #e4e4e4;
    border-radius: 4px;
    left: -1px;
    top: -3px;
}

.ipb-section h3{
   border-bottom: unset !important;
}
.limit_fields .field_l{
    display: block;
}

.input_fields_p input[type="radio"]:before {
    border-radius: 0px;
    top: 10%;
    left: 0;
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    background: #ffffff;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.input_fields_p input[type="radio"]:checked:before {
    border-radius: 5;
    left: -3px;
    top: 0px;
    background: rgb(42 42 42);
    border-color: #007cba;
    background-color: rgba(0, 124, 186, 0.2);
    color: #007cba;
}
div#action .info img {
    top: 0;
}
.ipb-tab {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #646970;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.ipb-tab:hover {
    color: #2271b1;
    background: #f0f0f1;
}

.ipb-tab.active {
    color: #2271b1;
    background: #fff;
    border-left-color: #2271b1;
    font-weight: 600;
}

.ipb-tab.active:after {
    content: '';
    position: absolute;
    right: -1px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #fff;
}

.ipb-tab i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Sections */
.ipb-section {
    margin-bottom: 20px;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
}

/* Add New popup: keep clear outer spacing around selected Design panels */
.ipb-section.ipb-new-popup-panel {
    margin: 0 20px 20px;
}

/* Active Custom Targeting extension wrapper spacing (Add New) */
.ipb-targeting-active-wrap.ipb-new-popup-panel {
    margin: 0 20px 20px;
}

.ipb-targeting-active-wrap.ipb-new-popup-panel .ipb-section {
    margin: 0;
}

/* Active Scheduling extension wrapper spacing (Add New) */
.ipb-scheduling-active-wrap.ipb-new-popup-panel {
    margin: 0 20px 20px;
}

.ipb-scheduling-active-wrap.ipb-new-popup-panel .ipb-section {
    margin: 0;
}

/* Active Geo Targeting extension wrapper spacing (Add New) */
.ipb-location-active-wrap.ipb-new-popup-panel {
    margin: 0 20px 20px;
}

.ipb-location-active-wrap.ipb-new-popup-panel .ipb-section {
    margin: 0;
}

/* Active Language Targeting extension wrapper spacing (Add New) */
.ipb-language-active-wrap.ipb-new-popup-panel {
    margin: 0 20px 20px;
}

.ipb-language-active-wrap.ipb-new-popup-panel .ipb-section {
    margin: 0;
}

/* Align Add New first panel top spacing with General tab */
#design.tab_content .ipb-section.ipb-background-settings-new:first-child,
#design.tab_content .ipb-section.ipb-new-popup-panel:first-child,
#condition.tab_content .ipb-section.ipb-new-popup-panel:first-child,
#condition.tab_content .ipb-targeting-active-wrap.ipb-new-popup-panel:first-child,
#condition.tab_content .ipb-scheduling-active-wrap.ipb-new-popup-panel:first-child,
#condition.tab_content .ipb-location-active-wrap.ipb-new-popup-panel:first-child,
#condition.tab_content .ipb-language-active-wrap.ipb-new-popup-panel:first-child {
    margin-top: -12px;
}

/* Contact Form active tab: keep panel margins consistent */
.instant_popup_setting #contact_form.tab_content .ipb-section,
.instant_popup_setting #ipb_contact_form.tab_content .ipb-section {
    margin: 0 20px 20px;
}

.instant_popup_setting #contact_form.tab_content .ipb-section:first-child,
.instant_popup_setting #ipb_contact_form.tab_content .ipb-section:first-child {
    margin-top: -12px;
}

/* Section Headers */
.ipb-section h3 {
    margin: 0;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 600;
    background: #f0f0f1;
    border-bottom: 1px solid #f0f0f1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.ipb_top_bar ul.list li a:hover, .ipb_top_bar ul.list li a.active, .instant_popup_setting .tabs_list ul li.active{
    background: transparent;
}
.instant_popup_setting .tabs_list{
    margin-bottom: 5px;
}
.instant_popup_setting{
    width: 100%;
}
.ipb-section h3:after {
    content: '';
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s ease;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.ipb-section.active h3:after {
    transform: translateY(-50%) rotate(180deg);
}

.ipb-section-description {
    font-size: 12px;
    font-weight: normal;
    color: #646970;
    display: block;
}

.ipb-section-content {
    padding: 30px;
}

.ipb-section.active .ipb-section-content {
    display: block;
}

/* Form Fields */
.ipb-field-row {
    margin-bottom: 15px;
}

.ipb-field-row:last-child {
    margin-bottom: 0;
}

.ipb-field-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.ipb-field-row input[type="text"],
.ipb-field-row input[type="url"],
.ipb-field-row input[type="number"],
.ipb-field-row select,
.ipb-field-row textarea {
    width: 100%;
    max-width: 400px;
    padding: 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
}

.ipb-field-row textarea {
    min-height: 100px;
}

/* Range Slider */
.ipb-range-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.ipb-range-slider input[type="range"] {
    flex: 1;
}

.ipb-range-value {
    min-width: 50px;
    text-align: right;
}

/* Color Picker */
.ipb-color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 400px;
}

.ipb-color-picker-wrapper input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 0;
    border: 1px solid #8c8f94;
    border-radius: 4px;
}

.ipb-color-preview {
    width: 30px;
    height: 30px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
}

/* Checkbox Groups */
.ipb-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.ipb-checkbox-group label {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Integration Settings */
.ipb-integration-settings {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
}

/* Code Editor */
.ipb-code-editor {
    font-family: monospace;
    min-height: 200px;
}

/* Help Text */
.ipb-help-text {
    margin-top: 5px;
    color: #646970;
    font-size: 12px;
}

/* Buttons */
.ipb-refresh-lists,
.ipb-refresh-forms {
    margin-left: 10px;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .ipb-settings-wrapper {
        flex-direction: column;
    }

    .ipb-settings-tabs {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #ccd0d4;
    }

    .ipb-tab {
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 12px 15px;
    }

    .ipb-tab.active {
        border-left: none;
        border-bottom: 3px solid #2271b1;
    }

    .ipb-tab.active:after {
        display: none;
    }

    .ipb-field-row input[type="text"],
    .ipb-field-row input[type="url"],
    .ipb-field-row input[type="number"],
    .ipb-field-row select,
    .ipb-field-row textarea {
        max-width: 100%;
    }

    .ipb-range-slider {
        max-width: 100%;
    }

    .ipb-color-picker-wrapper {
        max-width: 100%;
    }
}
.input_fields_p {
    display: grid;
    grid-template-columns: repeat(3, 60px);
    grid-template-rows: repeat(3, 60px);
    gap: 8px;
    margin-bottom: 15px;
    width: auto !important;
}
.fields_p {
    width: auto !important;
}
.input_fields_p input[type="radio"]{
    height: 60px !important;
}
.input_fields_p label{
    bottom: -20px !important;
}
.input_fields_p input[type="radio"]:checked:before {
    top: 4px !important;
}