/* ============================================================
   DQE Form Builder — Design System
   Colors : #1B2A8B navy · #2B4EFF cobalt · #F4F6FB page bg
   Font   : Inter (loaded via Google Fonts in base.html)
   ============================================================ */

/* ── Base ─────────────────────────────────────────────────── */
body {
    font-family: 'Inter', sans-serif;
    background: #F4F6FB;
    color: #1a1f36;
    font-size: 14px;
}

/* ── Navbar ────────────────────────────────────────────────── */
.fb-navbar {
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.fb-navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1B2A8B;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.fb-navbar-brand:hover {
    color: #2B4EFF;
}

.fb-navbar-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #1B2A8B;
    color: #fff;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    flex-shrink: 0;
}

.fb-navbar-user {
    font-size: 13px;
    color: #6b7280;
    font-weight: 400;
}

.fb-btn-ghost {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    font-family: inherit;
    line-height: 1.5;
}

.fb-btn-ghost:hover {
    border-color: #1B2A8B;
    color: #1B2A8B;
    background: #f0f2ff;
}

/* ── Page wrap ─────────────────────────────────────────────── */
.fb-page-wrap {
    padding: 0px 24px 20px 24px;
}

/* ── Nav tabs ──────────────────────────────────────────────── */
.nav-tabs {
    border-bottom: 2px solid #e5e7eb;
}

.nav-tabs .nav-link {
    color: #6b7280;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 8px 16px;
    font-weight: 500;
    font-size: 13px;
    transition: color 0.15s;
    border-radius: 0;
}

.nav-tabs .nav-link:hover {
    color: #1B2A8B;
    border-color: transparent;
    background: transparent;
}

.nav-tabs .nav-link.active {
    color: #2B4EFF;
    border-bottom-color: #2B4EFF;
    background: transparent;
    font-weight: 600;
}

/* ── Builder layout ────────────────────────────────────────── */
.builder-area {
    height: calc(100vh - 165px);
    overflow: hidden;
}

.canvas-area {
    height: 100%;
    padding-top: 12px;
    overflow-y: auto;
}

.sidebar-area {
    height: 100%;
    overflow-y: auto;
    padding-top: 8px;
}

/* ── Sidebar section headings ──────────────────────────────── */
.sidebar-area h6 {
    font-size: 10px !important;
    letter-spacing: 0.08em;
    color: #9ca3af !important;
    margin-bottom: 6px;
}

/* ── Palette items ─────────────────────────────────────────── */
.palette-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 4px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    cursor: grab;
    user-select: none;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, color 0.15s;
}

.palette-item:hover {
    border-color: #2B4EFF;
    background: #f0f2ff;
    color: #2B4EFF;
    box-shadow: 0 1px 4px rgba(43, 78, 255, 0.10);
}

.palette-item:active {
    cursor: grabbing;
}

/* API palette items — navy tint */
.api-palette-item {
    border-color: #dde3ff;
    background: #f5f6ff;
    color: #1B2A8B;
}

.api-palette-item:hover {
    border-color: #1B2A8B;
    background: #eaedff;
    color: #1B2A8B;
    box-shadow: 0 1px 4px rgba(27, 42, 139, 0.10);
}

/* UI element palette items — neutral */
.element-item {
    border-color: #e5e7eb;
    background: #fafafa;
    color: #6b7280;
    font-size: 12px;
    font-weight: 400;
}

.element-item:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
    color: #374151;
    box-shadow: none;
}

/* ── Section cards on canvas ───────────────────────────────── */
.section-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.section-card:hover {
    border-color: #c7d0ff;
    box-shadow: 0 4px 12px rgba(43, 78, 255, 0.08);
}

/* ── Section drag handle (reorder sections) ────────────────── */
.section_drag_handle {
    display: inline-flex;
    align-items: center;
    color: #9ca3af;
    cursor: grab;
    flex-shrink: 0;
}

.section_drag_handle:hover {
    color: #1B2A8B;
}

.section_drag_handle:active {
    cursor: grabbing;
}

.section_drag_handle svg {
    width: 16px;
    height: 16px;
}

/* ── Column picker (section header) ───────────────────────── */
.col-picker {
    display: inline-flex;
    align-items: center;
    position: relative;
}

/* Resting state: compact badge showing current value */
.col-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: #f0f2ff;
    border: 1px solid #dde3ff;
    color: #1B2A8B;
    font-size: 11px;
    font-weight: 600;
    cursor: default;
}

/* Options: hidden by default */
.col-options {
    display: none;
    align-items: center;
    gap: 2px;
}

/* On hover: swap badge → buttons */
.col-picker:hover .col-current  { display: none; }
.col-picker:hover .col-options  { display: flex; }

.col-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 1px solid #d1d5db;
    background: #fff;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.1s, background 0.1s, color 0.1s;
}

.col-btn:hover {
    border-color: #2B4EFF;
    background: #f0f2ff;
    color: #2B4EFF;
}

.col-btn.active {
    border-color: #2B4EFF;
    background: #2B4EFF;
    color: #fff;
}

/* ── Field drop zones ──────────────────────────────────────── */
/* Fields stacked vertically, as in the final form */
.field-drop-zone {
    min-height: 60px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 6px;
}

.field-drop-zone.drag-over {
    background: #f0f2ff;
    border-radius: 8px;
    outline: 2px dashed #2B4EFF;
    outline-offset: -2px;
}

/* ── Field chips ───────────────────────────────────────────── */
.field-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    /* long labels (ex. raw link URL) wrap inside the zone instead of overflowing */
    max-width: 100%;
    overflow-wrap: anywhere;
    transition: border-color 0.1s, background 0.1s, box-shadow 0.1s, color 0.1s;
}

.field-chip:hover {
    border-color: #2B4EFF;
    background: #f0f2ff;
    color: #2B4EFF;
    box-shadow: 0 1px 4px rgba(43, 78, 255, 0.10);
}

.field-chip.is-required::after {
    content: " *";
    color: #ef4444;
}

.field-chip.is-disabled {
    opacity: 0.55;
    font-style: italic;
}

/* ── Header / footer drop zones ────────────────────────────── */
.footer-zone {
    background: #fff;
    border: 1px solid #e5e7eb !important;
    border-radius: 10px !important;
}

.footer-col-zone {
    min-height: 48px;
    padding: 6px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    align-content: flex-start;
    gap: 4px;
    background: #fafafa;
    transition: border-color 0.15s, background 0.15s;
}

/* Header columns: elements stacked vertically, as in the final form */
.header_col_zone {
    flex-direction: column;
    flex-wrap: nowrap;
}

/* Header field chips take the full column width (UI element chips stay compact) */
.header_col_zone > .field-chip:not(.element-chip) {
    align-self: stretch;
}

.footer-col-zone.drag-over {
    background: #f0f2ff;
    border-color: #2B4EFF;
}

.footer-col-zone.sortable-ghost-zone,
.footer-col-zone:empty {
    background: #fafafa;
}

/* ── Drag ghost ─────────────────────────────────────────────── */
.sortable-ghost {
    opacity: 0.35;
    background: #dde3ff;
    border-radius: 6px;
}

.sortable-chosen {
    box-shadow: 0 4px 12px rgba(43, 78, 255, 0.15);
}

/* ── Add section button ─────────────────────────────────────── */
#btn-add-section {
    width: 100%;
    border-style: dashed;
    color: #6b7280;
    border-color: #d1d5db;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    padding: 8px;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

#btn-add-section:hover {
    border-color: #2B4EFF;
    color: #2B4EFF;
    background: #f0f2ff;
}

/* ── Save status ─────────────────────────────────────────────── */
#save-status {
    font-size: 12px;
    color: #9ca3af;
}

/* ── Bootstrap overrides ────────────────────────────────────── */

/* Primary button → cobalt */
.btn-primary {
    background-color: #2B4EFF;
    border-color: #2B4EFF;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #1B2A8B;
    border-color: #1B2A8B;
}

/* Outline primary → cobalt */
.btn-outline-primary {
    color: #2B4EFF;
    border-color: #2B4EFF;
}

.btn-outline-primary:hover {
    background-color: #2B4EFF;
    border-color: #2B4EFF;
    color: #fff;
}

/* Success button (Save) → navy */
.btn-success {
    background-color: #1B2A8B;
    border-color: #1B2A8B;
}

.btn-success:hover,
.btn-success:focus {
    background-color: #2B4EFF;
    border-color: #2B4EFF;
}

/* Focus rings */
.form-control:focus,
.form-select:focus {
    border-color: #2B4EFF;
    box-shadow: 0 0 0 3px rgba(43, 78, 255, 0.12);
}

/* Form switch accent */
.form-check-input:checked {
    background-color: #2B4EFF;
    border-color: #2B4EFF;
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(43, 78, 255, 0.12);
    border-color: #2B4EFF;
}

/* ── Icon buttons (builder header actions) ──────────────────── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.btn-icon-navy {
    background: #1B2A8B;
    border-color: #1B2A8B;
    color: #fff;
}

.btn-icon-navy svg {
    stroke: #fff;
}

.btn-icon-navy:hover {
    background: #2B4EFF;
    border-color: #2B4EFF;
}

.btn-icon-outline {
    color: #374151;
    border-color: #d1d5db;
    background: #fff;
}

.btn-icon-outline svg {
    stroke: #374151;
}

.btn-icon-outline:hover {
    border-color: #2B4EFF;
    color: #2B4EFF;
    background: #f0f2ff;
}

.btn-icon-outline:hover svg {
    stroke: #2B4EFF;
}

/* Primary outline icon button (e.g. dashboard View) */
.btn_icon_primary {
    color: #2B4EFF;
    border-color: #2B4EFF;
    background: #fff;
}

.btn_icon_primary svg {
    stroke: #2B4EFF;
}

.btn_icon_primary:hover {
    background-color: #2B4EFF;
    border-color: #2B4EFF;
    color: #fff;
}

.btn_icon_primary:hover svg {
    stroke: #fff;
}

/* Toggle icons — solid when active, dashed stroke when inactive */
.toggle-icon {
    color: #9ca3af;
    border-color: transparent;
    background: none;
}

.toggle-icon svg {
    stroke: #9ca3af;
    stroke-dasharray: 3 2;
}

.toggle-icon:hover {
    border-color: #e5e7eb;
    background: #f9fafb;
}

.toggle-icon:hover svg {
    stroke: #6b7280;
}

.toggle-icon.active {
    background: #f0f2ff;
    border-color: #dde3ff;
    color: #1B2A8B;
}

.toggle-icon.active svg {
    stroke: #1B2A8B;
    stroke-dasharray: none;
}

.btn-icon-danger {
    color: #9ca3af;
    border-color: transparent;
    background: none;
}

.btn-icon-danger svg {
    stroke: #9ca3af;
}

.btn-icon-danger:hover {
    border-color: #fecaca;
    background: #fff1f2;
    color: #ef4444;
}

.btn-icon-danger:hover svg {
    stroke: #ef4444;
}

/* ── Form Info two-column layout ───────────────────────────── */
.fb-info-layout {
    align-items: flex-start;
}

.fb-info-left {
    flex: 1;
    min-width: 0;
}

.fb-info-right {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 210px); /* 56px navbar + 58px sub-header + 40px tabs + 56px padding */
}

/* ── CSV data panel ─────────────────────────────────────────── */

.csv_viewer_wrap {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 4px;
    overflow: hidden;
}

.csv_line_numbers {
    width: 2.5rem;
    padding: 0.25rem 0.4rem;
    background: var(--bs-secondary-bg, #f8f9fa);
    color: var(--bs-secondary-color, #6c757d);
    overflow: hidden;
    user-select: none;
    white-space: pre;
    font-size: 11px;
    line-height: 1.5;
    text-align: right;
    border-right: 1px solid var(--bs-border-color, #dee2e6);
}

.csv_editor_area {
    flex: 1;
    font-size: 11px;
    line-height: 1.5;
    border: none;
    border-radius: 0;
    resize: none;
    overflow-y: auto;
}

.csv_editor_area:focus {
    box-shadow: none;
}

.csv_file_name_badge {
    background-color: #1B2A8B;
    font-size: 1em;
    font-weight: 500;
}

.csv_expand_btn {
    font-size: 0.8rem;
}

.csv_expand_btn i,
.csv-expand-btn i {
    transition: transform 0.2s;
}

/* ── Builder page sub-header (form title + action buttons) ──── */
.fb-builder-header {
    background-color: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 0 12px 0;
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
    margin-bottom: 0 !important;
}

/* ── Dashboard client cards ─────────────────────────────────── */
.client-card {
    background: #fff;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.client-card .card-header {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 16px;
}

.client-card .table {
    font-size: 13px;
    margin-bottom: 0;
}

.client-card .table thead th {
    background: #f9fafb;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid #e5e7eb;
    padding: 8px 16px;
}

.client-card .table tbody td {
    padding: 10px 16px;
    vertical-align: middle;
    border-color: #f3f4f6;
}

.client-card .table tbody tr:hover td {
    background: #f9fafb;
}

.client-card .table tbody tr[data-edit-url] {
    cursor: pointer;
}

.client-card .table tbody tr[data-edit-url]:hover td {
    background: #eef1ff;
}

/* Dashboard table column widths */
.client-card .col_label { width: 33%; }
.client-card .col_type { width: 10%; }
.client-card .col_product { width: 10%; }
.client-card .col_creator { width: 20%; }
.client-card .col_last_modified { width: 15%; }
.client-card .col_actions { width: 12%; }


/* URL Constructor modal */
.uc_col_headers {
    position: sticky;
    top: 0;
    background-color: var(--bs-body-bg);
    z-index: 1;
}

/* ── Small icon button (used inside compact blocs) ──────────────── */
.btn-icon-sm {
    width: 22px;
    height: 22px;
    border-radius: 4px;
}

.btn-icon-sm svg {
    width: 12px;
    height: 12px;
}

/* ── Disabled palette item ──────────────────────────────────────── */
.palette-item-disabled {
    pointer-events: none;
    opacity: 0.5;
    cursor: default;
}

/* ── Address section — field mini-bloc ──────────────────────────── */
.adr_field_bloc {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
}

.adr_field_bloc_header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.adr_field_id_badge {
    font-family: monospace;
    font-size: 11px;
    color: #374151;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adr_required_badge {
    font-size: 9px;
}

.adr_field_bloc_body {
    padding: 8px 10px;
}

/* ── Address section — ghost placeholder for removed optional fields */
.adr_field_bloc_ghost {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #fafafa;
    min-height: 88px;
    height: 100%;
}

/* ── Address section — funnel mode strip ────────────────────────── */
.adr_funnel_strip {
    background: #f0f2ff;
    border: 1px solid #dde3ff;
    border-radius: 8px;
    padding: 8px 12px;
}

/* ── Address section — canvas bloc ─────────────────────────────── */
.adr_canvas_bloc {
    width: 100%;
    background: #eaedff;
    border: 1px solid #b8c4ff;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color 0.1s, box-shadow 0.1s;
}

.adr_canvas_bloc:hover {
    border-color: #1B2A8B;
    box-shadow: 0 2px 8px rgba(27, 42, 139, 0.12);
}

.adr_canvas_bloc_header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #1B2A8B;
    margin-bottom: 6px;
}

.adr_canvas_bloc_header svg {
    width: 14px;
    height: 14px;
    stroke: #1B2A8B;
}

.adr_canvas_bloc_fields {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.adr_canvas_field_tag,
.date_group_tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #fff;
    border: 1px solid #c7d0ff;
    color: #374151;
}

.adr_canvas_field_tag.is_required {
    border-color: #fca5a5;
    background: #fff1f2;
    color: #dc2626;
}

/* ── Date group — canvas chip ───────────────────────────────────── */
.date_group_chip {
    flex-wrap: wrap;
}

/* ── Date group — modal cards ───────────────────────────────────── */
.date_cards_container {
    display: flex;
    gap: 8px;
}

.date_field_card {
    flex: 1 1 0;
    min-width: 160px;
}

.date_card_header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
}

.date_card_drag_handle {
    cursor: grab;
    color: #9ca3af;
    display: inline-flex;
}

.date_card_drag_handle svg {
    width: 14px;
    height: 14px;
}

.date_card_body {
    padding: 8px;
}

.date_card_field_id {
    min-height: 1.2em;
    word-break: break-all;
}

/* ── Address section — canvas layout rows ───────────────────────── */
.adr_canvas_layout {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.adr_canvas_row {
    display: flex;
    gap: 4px;
}

/* Tags inside a layout row stretch equally */
.adr_canvas_row .adr_canvas_field_tag {
    flex: 1;
    text-align: center;
}

/* ── Multiselect — validation alert (shared: funnel mode, check settings…) ── */
.multiselect_alert {
    margin-top: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ── Multiselect — selected value pill (shared: funnel mode, check settings…) */
.multiselect_pill {
    background: #1B2A8B;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
}

.multiselect_pill_remove {
    background: none;
    border: none;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 0 0 0 4px;
    cursor: pointer;
    opacity: 0.8;
}

.multiselect_pill_remove:hover {
    opacity: 1;
}

.builder_modal_section_alert {
    /*
    margin-top: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: inherit;

    display: none;  */
}

.invalid-feedback.builder_modal_section_alert{
    display: block;
  }

.dqe_warning{
    color: orange;
    font-size: 0.7rem;
}


/* ── Canvas dual-mode sub-blocs ─────────────────────── */
.adr_canvas_sub_bloc {
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 5px 7px;
    margin-bottom: 5px;
    background: #fff;
}

.adr_canvas_sub_bloc:last-child {
    margin-bottom: 0;
}

.adr_canvas_sub_mode_label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 3px;
}

/* ── Check settings modal — tooltip trigger button ── */
.tooltip_info_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0 2px;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
}

.tooltip_info_btn:hover {
    color: #1B2A8B;
}

.dqe_modal_link{
    margin-top: 0.10rem;
}