/**
 * WPFAQBlock – Admin Builder Styles
 *
 * Styles for the FAQ Builder admin page.
 *
 * @package WPFAQBlock
 * @since   2.0.0
 */

/* ─────────────────────────────────────────────
   1. CSS Custom Properties (Design Tokens)
───────────────────────────────────────────── */
:root {
    --faq-primary: #FE8512;
    --faq-primary-hover: #E67600;
    --faq-primary-light: #FFF5EB;
    --faq-success: #10B981;
    --faq-danger: #EF4444;
    --faq-warning: #F59E0B;
    --faq-gray-50: #F9FAFB;
    --faq-gray-100: #F3F4F6;
    --faq-gray-200: #E5E7EB;
    --faq-gray-300: #D1D5DB;
    --faq-gray-400: #9CA3AF;
    --faq-gray-500: #6B7280;
    --faq-gray-700: #374151;
    --faq-gray-900: #111827;
    --faq-white: #FFFFFF;
    --faq-radius: 8px;
    --faq-radius-sm: 4px;
    --faq-radius-lg: 12px;
    --faq-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 1px 2px rgba(0, 0, 0, .06);
    --faq-shadow-md: 0 4px 6px rgba(0, 0, 0, .07), 0 2px 4px rgba(0, 0, 0, .06);
    --faq-shadow-lg: 0 10px 15px rgba(0, 0, 0, .10), 0 4px 6px rgba(0, 0, 0, .05);
    --faq-transition: 150ms ease;
    --faq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

/* ─────────────────────────────────────────────
   2. Page Shell
───────────────────────────────────────────── */
#wpfaqblock-builder {
    font-family: var(--faq-font);
    color: var(--faq-gray-700);
    max-width: 1400px;
    padding: 0;
    margin: 0;
}

/* ─────────────────────────────────────────────
   3. Top Bar
───────────────────────────────────────────── */
.faqb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--faq-white);
    border-bottom: 1px solid var(--faq-gray-200);
    padding: 14px 24px;
    margin-bottom: 0;
    gap: 16px;
}

.faqb-topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--faq-gray-900);
    letter-spacing: -0.3px;
}

.faqb-topbar__brand-icon {
    width: 32px;
    height: 32px;
    background: var(--faq-primary);
    border-radius: var(--faq-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--faq-white);
    font-size: 16px;
}

.faqb-topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.faqb-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--faq-gray-100);
    border: 1px solid var(--faq-gray-200);
    border-radius: 20px;
    padding: 0 12px;
    width: 240px;
    height: 36px;
    transition: all var(--faq-transition);
    box-sizing: border-box;
}

.faqb-search-wrap:focus-within {
    width: 320px;
    background: var(--faq-white);
    border-color: var(--faq-primary);
    box-shadow: 0 0 0 3px rgba(254, 133, 18, .1);
}

.faqb-search-wrap .dashicons {
    color: var(--faq-gray-400);
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
}

#faqb-builder-search {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--faq-gray-900) !important;
    width: 100% !important;
    height: 100% !important;
    outline: none !important;
    box-shadow: none !important;
}

#faqb-builder-search::placeholder {
    color: var(--faq-gray-400);
}

/* ─────────────────────────────────────────────
   4. Buttons
───────────────────────────────────────────── */
.faqb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--faq-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--faq-transition), color var(--faq-transition), border-color var(--faq-transition), box-shadow var(--faq-transition);
    text-decoration: none;
    line-height: 1.4;
}

.faqb-btn--primary {
    background: var(--faq-primary);
    color: var(--faq-white);
    border-color: var(--faq-primary);
}

.faqb-btn--primary:hover {
    background: var(--faq-primary-hover);
    border-color: var(--faq-primary-hover);
    color: var(--faq-white);
}

.faqb-btn--outline {
    background: var(--faq-white);
    color: var(--faq-gray-700);
    border-color: var(--faq-gray-300);
}

.faqb-btn--outline:hover {
    background: var(--faq-gray-50);
    border-color: var(--faq-gray-400);
    color: var(--faq-gray-900);
}

.faqb-btn--success {
    background: var(--faq-success);
    color: var(--faq-white);
    border-color: var(--faq-success);
}

.faqb-btn--danger {
    background: transparent;
    color: var(--faq-danger);
    border-color: transparent;
    padding: 4px 8px;
}

.faqb-btn--danger:hover {
    background: #FEF2F2;
    border-color: #FECACA;
}

.faqb-btn--ai {
    color: #FE8512;
    border-color: #FFD6A5;
    background: #FFF7ED;
    padding: 6px 12px;
}

.faqb-btn--ai:hover {
    background: #FFEDD5;
    border-color: #FE8512;
    color: #EA580C;
    box-shadow: 0 2px 8px rgba(254, 133, 18, 0.15);
}

.faqb-btn--ai svg {
    transition: transform 0.3s ease;
}

.faqb-btn--ai:hover svg {
    transform: rotate(15deg) scale(1.1);
}

.faqb-btn--ghost {
    background: transparent;
    color: var(--faq-gray-500);
    border-color: transparent;
    padding: 4px 8px;
}

.faqb-btn--ghost:hover {
    background: var(--faq-gray-100);
    color: var(--faq-gray-700);
}

.faqb-btn--sm {
    padding: 5px 11px;
    font-size: 12px;
}

.faqb-btn--icon-only {
    padding: 6px;
    border-radius: var(--faq-radius-sm);
}

/* ─────────────────────────────────────────────
   5. Main Layout: Two-Column
───────────────────────────────────────────── */
.faqb-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    min-height: calc(100vh - 130px);
    background: var(--faq-gray-50);
}

/* ─────────────────────────────────────────────
   6. Builder Column (Left)
───────────────────────────────────────────── */
.faqb-builder-col {
    padding: 24px;
    overflow-y: auto;
    border-right: 1px solid var(--faq-gray-200);
}

.faqb-builder-col__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.faqb-builder-col__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--faq-gray-900);
    margin: 0;
}

/* ─────────────────────────────────────────────
   7. FAQ Group (Accordion)
───────────────────────────────────────────── */
.faqb-group {
    background: var(--faq-white);
    border: 1px solid var(--faq-gray-200);
    border-radius: var(--faq-radius-lg);
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.faqb-group:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
    border-color: var(--faq-gray-300);
}

.faqb-group__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--faq-white);
    transition: background 0.3s ease;
}

.faqb-group__header:hover {
    background: #F8FAFC;
}

.faqb-group__drag-handle {
    color: var(--faq-gray-300);
    cursor: grab;
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.faqb-group__header:hover .faqb-group__drag-handle {
    color: var(--faq-gray-500);
}

.faqb-group__drag-handle:active {
    cursor: grabbing;
}

.faqb-group__chevron {
    color: var(--faq-gray-400);
    font-size: 16px;
    flex-shrink: 0;
    margin-left: 8px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

.faqb-group.is-open .faqb-group__chevron {
    transform: rotate(180deg);
    color: var(--faq-primary);
}

.faqb-group__name {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
}

.faqb-group__badge {
    background: #FFF7ED;
    color: #EA580C;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 10px;
    border: 1px solid #FFEDD5;
    border-radius: 99px;
    flex-shrink: 0;
}

.faqb-group__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.faqb-group__header:hover .faqb-group__actions {
    opacity: 1;
}

/* ─────────────────────────────────────────────
   8. Group Body (FAQ Items List)
───────────────────────────────────────────── */
.faqb-group__body {
    border-top: 1px solid var(--faq-gray-100);
    padding: 0;
    display: none;
    background: #F8FAFC;
    animation: faqb-slide-down 0.3s ease-out forwards;
}

@keyframes faqb-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.faqb-group.is-open .faqb-group__body {
    display: block;
}

.faqb-group__add-row {
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    background: #F9FAFB;
    border-top: 1px solid var(--faq-gray-100);
}

.faqb-btn-add-faq {
    background: #fff;
    border: 1px solid var(--faq-gray-300);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--faq-gray-700);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.faqb-btn-add-faq:hover {
    border-color: var(--faq-primary);
    color: var(--faq-primary);
    box-shadow: 0 2px 4px rgba(254, 133, 18, 0.1);
    transform: translateY(-1px);
}

/* ─────────────────────────────────────────────
   9. FAQ Item Row
───────────────────────────────────────────── */
.faqb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.3s ease, padding-left 0.3s ease;
    border-bottom: 1px solid var(--faq-gray-100);
    background: var(--faq-white);
}

.faqb-item:last-child {
    border-bottom: none;
}

.faqb-item:hover {
    background: var(--faq-gray-50);
    padding-left: 24px;
}

.faqb-item.is-active {
    background: var(--faq-primary-light);
    border-left: 3px solid var(--faq-primary);
    padding-left: 21px;
    /* Compesates for the 3px border to match 24px total hover/active padding */
}

.faqb-item__drag {
    color: var(--faq-gray-300);
    cursor: grab;
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.3;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.faqb-item:hover .faqb-item__drag {
    opacity: 1;
    color: var(--faq-gray-500);
}

.faqb-item__drag:active {
    cursor: grabbing;
}

.faqb-item__question {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--faq-gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.faqb-item.is-active .faqb-item__question {
    color: var(--faq-primary);
    font-weight: 600;
}

/* Toggle Switch */
.faqb-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.faqb-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.faqb-toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--faq-gray-300);
    border-radius: 20px;
    cursor: pointer;
    transition: background var(--faq-transition);
}

.faqb-toggle__slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: var(--faq-white);
    border-radius: 50%;
    transition: transform var(--faq-transition);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}

.faqb-toggle input:checked+.faqb-toggle__slider {
    background: var(--faq-success);
}

.faqb-toggle input:checked+.faqb-toggle__slider::before {
    transform: translateX(16px);
}

.faqb-item__actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--faq-transition);
}

.faqb-item:hover .faqb-item__actions {
    opacity: 1;
}

/* ─────────────────────────────────────────────
   10. Empty State
───────────────────────────────────────────── */
.faqb-empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--faq-gray-400);
}

.faqb-empty-state__icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.faqb-empty-state__text {
    font-size: 14px;
    margin-bottom: 16px;
    display: block;
}

/* ─────────────────────────────────────────────
   11. Edit Panel (Right Column)
───────────────────────────────────────────── */
.faqb-edit-col {
    background: var(--faq-white);
    display: flex;
    flex-direction: column;
}

.faqb-edit-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Panel: No Selection State */
.faqb-edit-panel__placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    color: var(--faq-gray-400);
}

.faqb-edit-panel__placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    opacity: .5;
}

.faqb-edit-panel__placeholder-text {
    font-size: 13px;
    line-height: 1.5;
}

/* Panel Header */
.faqb-edit-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--faq-gray-100);
    flex-shrink: 0;
}

.faqb-edit-panel__header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--faq-gray-900);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 85%;
}

/* Panel Body */
.faqb-edit-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Panel Footer */
.faqb-edit-panel__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--faq-gray-100);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   12. Form Fields
───────────────────────────────────────────── */
.faqb-field {
    margin-bottom: 24px;
}

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

.faqb-field__label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--faq-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
}

.faqb-field__input,
.faqb-field__select,
.faqb-field__textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--faq-gray-300);
    border-radius: var(--faq-radius);
    font-size: 14px;
    color: var(--faq-gray-900);
    background: var(--faq-gray-50);
    transition: all var(--faq-transition);
    box-sizing: border-box;
    font-family: var(--faq-font);
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.faqb-field__input:hover,
.faqb-field__select:hover,
.faqb-field__textarea:hover {
    border-color: var(--faq-gray-400);
}

.faqb-field__input:focus,
.faqb-field__select:focus,
.faqb-field__textarea:focus {
    border-color: var(--faq-primary);
    background: var(--faq-white);
    box-shadow: 0 0 0 3px rgba(254, 133, 18, .12);
}

.faqb-field__textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

/* WYSIWYG Editor */
.faqb-editor-container {
    border: 1px solid var(--faq-gray-300);
    border-radius: var(--faq-radius);
    background: var(--faq-white);
    transition: all var(--faq-transition);
    position: relative;
    overflow: hidden;
    /* Ensures toolbar follows border radius */
}

.faqb-editor-container:focus-within {
    border-color: var(--faq-primary);
    box-shadow: 0 0 0 3px rgba(254, 133, 18, 0.12);
}

.faqb-editor-container:focus-within .faqb-editor-toolbar {
    border-bottom-color: rgba(254, 133, 18, 0.3);
}

.faqb-editor-toolbar {
    display: flex;
    align-items: center;
    padding: 8px;
    background: var(--faq-gray-50);
    border-bottom: 1px solid var(--faq-gray-200);
    gap: 6px;
    flex-wrap: wrap;
    position: relative;
    overflow: visible !important;
    z-index: 100;
    /* Ensure it stays above other fields */
}

.faqb-editor-toolbar__group {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
    overflow: visible !important;
}

.faqb-editor-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 4px;
    color: var(--faq-gray-600);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.faqb-editor-btn:hover {
    background: var(--faq-gray-200);
    color: var(--faq-gray-900);
}

.faqb-editor-select {
    border: 1px solid var(--faq-gray-200);
    background: var(--faq-white);
    font-size: 11px;
    font-weight: 600;
    color: var(--faq-gray-700);
    padding: 2px 20px 2px 6px;
    cursor: pointer;
    outline: none;
    font-family: var(--faq-font);
    border-radius: 4px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239CA3AF'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 12px;
    min-width: 70px;
    transition: all 0.2s;
    height: 24px;
    line-height: 20px;
}

.faqb-editor-select:hover {
    border-color: var(--faq-gray-400);
    color: var(--faq-gray-900);
}

.faqb-editor-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.faqb-editor-divider {
    width: 1px;
    height: 16px;
    background: var(--faq-gray-300);
    margin: 0 4px;
}

.faqb-editor-content {
    min-height: 150px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--faq-gray-700);
    outline: none;
}

.faqb-editor-content:empty:before {
    content: attr(placeholder);
    color: var(--faq-gray-400);
}

.faqb-editor-content ul {
    list-style-type: disc !important;
    padding-left: 20px !important;
    margin: 10px 0 !important;
}

.faqb-editor-content ol {
    list-style-type: decimal !important;
    padding-left: 20px !important;
    margin: 10px 0 !important;
}

.faqb-editor-content li {
    margin-bottom: 5px !important;
    display: list-item !important;
}

.faqb-editor-content h1 {
    font-size: 24px !important;
    font-weight: 700 !important;
    margin: 15px 0 10px !important;
    color: var(--faq-gray-900);
}

.faqb-editor-content h2 {
    font-size: 20px !important;
    font-weight: 700 !important;
    margin: 12px 0 8px !important;
    color: var(--faq-gray-900);
}

.faqb-editor-content h3 {
    font-size: 18px !important;
    font-weight: 600 !important;
    margin: 10px 0 6px !important;
    color: var(--faq-gray-900);
}

.faqb-editor-content p {
    margin: 0 0 10px !important;
}

/* Emoji Picker (Minimal Style) */
.faqb-editor-emoji-picker {
    position: fixed;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    display: none;
    flex-direction: column;
    z-index: 99999999;
    width: 220px;
    /* More compact */
    overflow: hidden;
    padding: 8px;
    animation: faqb-emoji-pop 0.15s ease-out;
}

@keyframes faqb-emoji-pop {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.faqb-emoji-content {
    max-height: 180px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
}

/* Minimal Scrollbar */
.faqb-emoji-content::-webkit-scrollbar {
    width: 4px;
}

.faqb-emoji-content::-webkit-scrollbar-track {
    background: transparent;
}

.faqb-emoji-content::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 4px;
}

.faqb-emoji-content::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

.faqb-emoji-item {
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
}

.faqb-emoji-item:hover {
    background: #f3f4f6;
}


.faqb-field__select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239CA3AF'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
    padding-right: 36px;
}

/* Toggle Field Row */
.faqb-field--toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.faqb-field--toggle .faqb-field__label {
    margin-bottom: 0;
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
    color: var(--faq-gray-700);
}

/* ─────────────────────────────────────────────
   13. Add Group Prompt (Inline)
───────────────────────────────────────────── */
.faqb-add-group-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 2px dashed var(--faq-gray-200);
    border-radius: var(--faq-radius);
    background: var(--faq-gray-50);
    cursor: pointer;
    transition: border-color var(--faq-transition), background var(--faq-transition);
    margin-bottom: 16px;
    color: var(--faq-gray-500);
    font-size: 13px;
    font-weight: 600;
}

.faqb-add-group-bar:hover {
    border-color: var(--faq-primary);
    background: var(--faq-primary-light);
    color: var(--faq-primary);
}

/* ─────────────────────────────────────────────
   14. Status Badge
───────────────────────────────────────────── */
.faqb-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.faqb-status--active {
    background: #D1FAE5;
    color: #065F46;
}

.faqb-status--inactive {
    background: var(--faq-gray-100);
    color: var(--faq-gray-500);
}

/* ─────────────────────────────────────────────
   15. Notice / Toast
───────────────────────────────────────────── */
.faqb-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--faq-radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    animation: faqb-slide-in .25s ease;
}

.faqb-notice--success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.faqb-notice--error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

@keyframes faqb-slide-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─────────────────────────────────────────────
   16. Responsive
───────────────────────────────────────────── */
@media (max-width: 1100px) {
    .faqb-layout {
        grid-template-columns: 1fr;
    }

    .faqb-edit-col {
        border-top: 1px solid var(--faq-gray-200);
        border-right: none;
    }
}

/* ─────────────────────────────────────────────
   16. Settings Page Overrides
 ───────────────────────────────────────────── */
#wpfaqblock-builder.faqb-settings-page .form-table th {
    width: 240px;
    padding: 24px 20px 24px 0;
    font-size: 11px;
    font-weight: 800;
    color: var(--faq-gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
    vertical-align: top;
    border: none;
}

#wpfaqblock-builder.faqb-settings-page .form-table td {
    padding: 20px 0;
    border: none;
}

#wpfaqblock-builder .regular-text {
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    border: 1px solid var(--faq-gray-300);
    border-radius: 8px;
    font-size: 14px;
    color: var(--faq-gray-900);
    background: var(--faq-gray-50);
    transition: all var(--faq-transition);
    box-sizing: border-box;
    font-family: var(--faq-font);
    outline: none !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

#wpfaqblock-builder .regular-text:focus {
    border-color: var(--faq-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(254, 133, 18, 0.12);
}

/* Force orange theme on WP buttons in settings */
#wpfaqblock-builder .faqb-settings-page #submit,
#wpfaqblock-builder .button.faqb-btn--primary {
    background: var(--faq-primary) !important;
    border: none !important;
    color: #fff !important;
    padding: 12px 32px !important;
    height: auto !important;
    border-radius: 8px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 6px rgba(254, 133, 18, 0.2) !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

#wpfaqblock-builder .faqb-settings-page #submit:hover {
    background: var(--faq-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(254, 133, 18, 0.3) !important;
}

#wpfaqblock-builder .description {
    font-size: 13px;
    color: var(--faq-gray-500);
    margin-top: 10px;
    line-height: 1.6;
}

#wpfaqblock-builder h3 {
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 16px 0;
}

/* Auto-hide empty state if items exist */
.faqb-group__body:has(.faqb-item) .faqb-empty-state {
    display: none !important;
}

/* ─────────────────────────────────────────────
   17. Modals (Group + AI FAQ Generator)
 ───────────────────────────────────────────── */

/* Shared Overlay */
.faqb-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99998;
    animation: faqb-fade-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes faqb-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Shared Modal Shell */
.faqb-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--faq-white);
    border-radius: var(--faq-radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 99999;
    flex-direction: column;
    animation: faqb-modal-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--faq-gray-200);
}

@keyframes faqb-modal-in {
    from {
        opacity: 0;
        transform: translate(-50%, -45%) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Group Modal sizing */
#faqb-group-modal {
    width: 420px;
    max-width: 95vw;
}

/* AI Modal sizing */
/* ─────────────────────────────────────────────
   17. Modals (Clean & Stable Recovery)
   ───────────────────────────────────────────── */
.faqb-modal {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2) !important;
    background: #fff !important;
    width: 600px !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    display: none;
    flex-direction: column !important;
    font-family: var(--faq-font) !important;
    overflow: hidden !important;
}

/* Header */
.faqb-modal__header {
    padding: 20px 24px !important;
    background: #fff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.faqb-modal__header-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.faqb-modal__title {
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    letter-spacing: -0.02em !important;
}

.faqb-modal__close {
    background: #f1f5f9 !important;
    border: none !important;
    border-radius: 8px !important;
    width: 32px !important;
    height: 32px !important;
    color: #64748b !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
}

.faqb-modal__close:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Body */
.faqb-modal__body {
    padding: 32px !important;
    overflow-y: auto !important;
    flex: 1 !important;
}

/* Footer */
.faqb-modal__footer {
    padding: 20px 32px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
}

/* Buttons inside modals */
.faqb-modal__footer .faqb-btn {
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
}

/* Field Layout */
.faqb-modal__field {
    margin-bottom: 20px !important;
}

.faqb-modal__label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #475569 !important;
    margin-bottom: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.02em !important;
}

.faqb-modal__label .dashicons {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
    color: var(--faq-primary) !important;
}

/* Inputs */
.faqb-modal__input,
.faqb-modal__select {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #1e293b !important;
    transition: all 0.2s !important;
}

.faqb-modal__input:focus,
.faqb-modal__select:focus {
    border-color: var(--faq-primary) !important;
    box-shadow: 0 0 0 3px rgba(254, 133, 18, 0.15) !important;
    outline: none !important;
}

.faqb-choice-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.faqb-choice,
.faqb-import-export-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--faq-gray-200);
    border-radius: var(--faq-radius);
    background: var(--faq-gray-50);
    padding: 10px 12px;
}

.faqb-choice {
    align-items: center;
    cursor: pointer;
}

.faqb-import-export-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--faq-gray-200);
    border-radius: var(--faq-radius);
    background: var(--faq-white);
    padding: 10px;
}

.faqb-import-export-item {
    cursor: pointer;
}

.faqb-import-export-item span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.faqb-import-export-item strong {
    font-size: 13px;
    color: var(--faq-gray-900);
}

.faqb-import-export-item small,
.faqb-import-export-empty,
.faqb-modal__helper {
    font-size: 12px;
    color: var(--faq-gray-500);
}

.faqb-file-input {
    width: 100%;
    border: 1px dashed var(--faq-gray-300);
    border-radius: var(--faq-radius);
    background: var(--faq-gray-50);
    padding: 14px;
}

/* AI Specific Row Layout */
.faqb-modal__row {
    display: flex !important;
    gap: 24px !important;
    margin-bottom: 24px !important;
    align-items: flex-start !important;
}

.faqb-modal__row > .faqb-modal__field {
    flex: 1 !important;
    width: 50% !important;
}

.faqb-modal__label {
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

/* AI Extra Controls */
.faqb-ai-extra-controls {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 20px !important;
    margin: 24px 0 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
}

/* AI Generate Button */
.faqb-modal__generate-btn {
    width: 100% !important;
    padding: 16px !important;
    background: var(--faq-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    transition: background 0.2s !important;
}

.faqb-modal__generate-btn:hover {
    background: var(--faq-primary-hover) !important;
}

/* Notices */
.faqb-modal__notices .faqb-notice {
    padding: 12px 16px !important;
    border-radius: 8px !important;
    margin-bottom: 20px !important;
    font-size: 14px !important;
    border: 1px solid transparent !important;
}

.faqb-notice--error { background: #fef2f2 !important; color: #991b1b !important; border-color: #fecaca !important; }
.faqb-notice--success { background: #f0fdf4 !important; color: #166534 !important; border-color: #bbf7d0 !important; }

.faqb-notice--error {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #B91C1C;
}

.faqb-notice--success {
    background: #F0FDF4;
    border-color: #BBF7D0;
    color: #15803D;
}

/* Results Area */
.faqb-ai-results {
    margin-top: 24px;
    display: none;
    padding-top: 24px;
    border-top: 1px solid var(--faq-gray-100);
    animation: faqb-slide-up 0.4s ease;
}

@keyframes faqb-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.faqb-ai-results__label {
    font-size: 11px;
    font-weight: 700;
    color: var(--faq-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* Individual generated FAQ item */
.faqb-ai-result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--faq-gray-200);
    border-radius: var(--faq-radius);
    margin-bottom: 12px;
    background: var(--faq-white);
    transition: all 0.25s ease;
    cursor: pointer;
}

.faqb-ai-result-item:hover {
    border-color: var(--faq-gray-300);
    background: var(--faq-gray-50);
    transform: translateX(4px);
}

.faqb-ai-result-item.is-selected {
    border-color: var(--faq-primary);
    background: var(--faq-primary-light);
    box-shadow: 0 4px 6px -1px rgba(254, 133, 18, 0.1);
}

.faqb-ai-result-item input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--faq-primary);
    cursor: pointer;
}

.faqb-ai-result-item__text {
    flex: 1;
}

.faqb-ai-result-item__q {
    font-size: 14px;
    font-weight: 700;
    color: var(--faq-gray-900);
    margin-bottom: 4px;
    line-height: 1.4;
}

.faqb-ai-result-item__a {
    font-size: 13px;
    color: var(--faq-gray-600);
    line-height: 1.6;
}

/* Insert Selected Button */
.faqb-ai-insert-btn {
    margin-top: 16px;
    padding: 12px 24px;
    background: var(--faq-gray-900);
    color: var(--faq-white);
    border: none;
    border-radius: var(--faq-radius);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.faqb-ai-insert-btn:hover {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Utility classes to replace inline styles */
.faqb-text-muted {
    color: var(--faq-gray-400) !important;
}

.faqb-text-xs {
    font-size: 10px !important;
}

.faqb-text-sm {
    font-size: 12px !important;
}

.faqb-ml-2 {
    margin-left: 8px !important;
}

.faqb-font-normal {
    font-weight: 400 !important;
}

.faqb-required-star {
    color: var(--faq-primary);
}

.faqb-group__empty-state {
    padding: 16px 20px;
}

/* ─────────────────────────────────────────────
   18. Global WP Admin Overrides (Focus Rings)
 ───────────────────────────────────────────── */
#wpfaqblock-builder input[type=checkbox]:focus,
#wpfaqblock-builder input[type=color]:focus,
#wpfaqblock-builder input[type=date]:focus,
#wpfaqblock-builder input[type=datetime-local]:focus,
#wpfaqblock-builder input[type=datetime]:focus,
#wpfaqblock-builder input[type=email]:focus,
#wpfaqblock-builder input[type=month]:focus,
#wpfaqblock-builder input[type=number]:focus,
#wpfaqblock-builder input[type=password]:focus,
#wpfaqblock-builder input[type=radio]:focus,
#wpfaqblock-builder input[type=search]:focus,
#wpfaqblock-builder input[type=tel]:focus,
#wpfaqblock-builder input[type=text]:focus,
#wpfaqblock-builder input[type=time]:focus,
#wpfaqblock-builder input[type=url]:focus,
#wpfaqblock-builder input[type=week]:focus,
#wpfaqblock-builder select:focus,
#wpfaqblock-builder textarea:focus {
    border-color: #FE8512;
    box-shadow: 0 0 0 1px #E67600;
    outline: 1px solid transparent;
}
