/* =============================================================================
   FAQ Module — Module.css
   All selectors scoped to .faq to avoid conflicts with DNN core styles.
   ============================================================================= */

/* ----- Shared / utility ---------------------------------------------------- */
.faq {
    font-family: inherit;
    box-sizing: border-box;
}

.faq *,
.faq *::before,
.faq *::after {
    box-sizing: border-box;
}

.faq-btn {
    display: inline-block;
    padding: 9px 20px;
    background: #6c757d;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    transition: background 0.15s ease;
}

.faq-btn:hover {
    background: #565e64;
    color: #fff;
    text-decoration: none;
}

.faq-btn--primary {
    background: #1a6fc4;
}

.faq-btn--primary:hover {
    background: #155a9e;
}

.faq-btn--secondary {
    background: #6c757d;
}

.faq-btn--secondary:hover {
    background: #565e64;
}

.faq-success {
    padding: 10px 14px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    border-radius: 5px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.faq-errors {
    padding: 10px 14px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 5px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.faq-errors ul {
    margin: 4px 0 0 16px;
    padding: 0;
}

/* ----- Admin list ---------------------------------------------------------- */
.faq-adminlist {
    padding: 16px 0;
}

.faq-admin-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* Add Category inline panel */
.faq-add-cat-panel {
    background: #eef3fb;
    border: 1px solid #c3d4ee;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.faq-add-cat-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.faq-add-cat-form .faq-input {
    max-width: 320px;
    margin-bottom: 0;
}

/* Category section blocks */
.faq-cat-list {
    margin-top: 4px;
}

.faq-cat-section {
    margin-bottom: 22px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

/* Category header — strong navy background to make each category prominent */
.faq-cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    background: #2d4a7a;
    color: #fff;
}

.faq-cat-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    flex: 1;
    letter-spacing: 0.01em;
}

/* Drag handle — light on dark (category header) */
.faq-drag-handle {
    color: rgba(255, 255, 255, 0.55);
    cursor: grab;
    font-size: 1.2rem;
    line-height: 1;
    user-select: none;
    padding: 0 2px;
    flex-shrink: 0;
}

/* Drag handle — dark on light (question rows) */
.faq-drag-handle--item {
    color: #b0bac5;
}

.faq-drag-handle:active,
.faq-drag-handle--item:active {
    cursor: grabbing;
}

/* Delete category button inside header */
.faq-cat-delete-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    padding: 4px 11px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.faq-cat-delete-btn:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
    text-decoration: none;
}

/* Item list within a category */
.faq-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
    min-height: 10px; /* keeps empty categories droppable */
}

.faq-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border-bottom: 1px solid #edf0f3;
    background: #fff;
    transition: background 0.1s ease;
}

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

.faq-item-row:hover {
    background: #f4f8ff;
}

.faq-item-question {
    flex: 1;
    font-size: 0.9rem;
    color: #2d3748;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.faq-item-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    font-size: 0.875rem;
}

.faq-item-actions a {
    color: #1a6fc4;
    text-decoration: none;
}

.faq-item-actions a:hover {
    text-decoration: underline;
}

/* Category footer with add-question link */
.faq-cat-footer {
    padding: 10px 16px;
    border-top: 1px solid #edf0f3;
    background: #f7f9fc;
}

.faq-add-question-btn {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a6fc4;
    text-decoration: none;
}

.faq-add-question-btn:hover {
    text-decoration: underline;
    color: #155a9e;
}

/* jQuery UI sortable feedback */
.ui-sortable-helper {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    opacity: 0.97;
    border-radius: 8px;
}

.ui-sortable-placeholder {
    border: 2px dashed #7baad9 !important;
    background: #e8f0fc !important;
    visibility: visible !important;
    border-radius: 8px;
    min-height: 52px;
}

/* ----- Admin edit ---------------------------------------------------------- */
.faq-adminedit {
    max-width: 720px;
    padding: 20px 0;
}

.faq-edit-title {
    margin: 0 0 24px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1d23;
    padding-bottom: 16px;
    border-bottom: 2px solid #e9ecef;
}

.faq-field {
    margin-bottom: 22px;
}

.faq-field label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: #344054;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.faq-field--required label::after {
    content: " *";
    color: #d92d20;
}

.faq-input,
.faq-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d0d5dd;
    border-radius: 5px;
    font-size: 0.9375rem;
    color: #101828;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    line-height: 1.5;
}

.faq-input:focus,
.faq-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    outline: none;
}

.faq-input--short {
    width: 100px;
}

.faq-textarea {
    resize: vertical;
    min-height: 140px;
}

.faq-hint {
    display: block;
    font-size: 0.8125rem;
    color: #667085;
    margin-top: 5px;
    line-height: 1.45;
}

/* Read-only category display on the edit form */
.faq-category-display {
    display: inline-block;
    padding: 8px 12px;
    background: #f1f3f5;
    border: 1.5px solid #d0d5dd;
    border-radius: 5px;
    font-size: 0.9375rem;
    color: #344054;
    min-width: 200px;
}

.faq-field--checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1.5px solid #e4e7ec;
    border-radius: 5px;
}

.faq-field--checkbox input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #3b82f6;
}

.faq-field--checkbox label {
    font-weight: 500;
    font-size: 0.9375rem;
    color: #344054;
    margin: 0;
    cursor: pointer;
}

.faq-actions {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px solid #e9ecef;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ----- Public display ------------------------------------------------------ */
.faq-display {
    padding: 8px 0;
}

.faq-filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: #f0f4fa;
    border: 1px solid #d0daea;
    border-radius: 4px;
    margin-bottom: 14px;
}

.faq-filter-bar label {
    font-size: .8125rem;
    font-weight: 600;
    color: #444;
    white-space: nowrap;
    margin: 0;
}

.faq-filter-search {
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: .875rem;
    min-width: 220px;
}

.faq-filter-select {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: .875rem;
    background: #fff;
}

.faq-filter-note {
    font-size: .8125rem;
    color: #555;
    font-style: italic;
    margin-bottom: 12px;
    margin-top: 0;
}

.faq-empty {
    color: #6c757d;
    font-style: italic;
}

.faq-category {
    margin-bottom: 32px;
}

.faq-category-title {
    font-size: 1.2rem;
    font-weight: 700;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 6px;
    margin-bottom: 16px;
}

.faq-list {
    margin: 0;
    padding: 0;
}

.faq-item {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.faq-question {
    font-weight: 600;
    padding: 12px 16px;
    margin: 0;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
}

.faq-question::before {
    content: "+ ";
    color: #0066cc;
    font-weight: 700;
}

.faq-item.is-open .faq-question::before {
    content: "- ";
}

.faq-answer {
    overflow: hidden;
    height: 0;
    margin: 0;
}

.faq-answer-inner {
    display: block;
    padding: 12px 16px;
    line-height: 1.6;
}
