/**
 * Dotes FAQ Generator - frontend styles.
 * Colours come from --dotes-faq-primary / --dotes-faq-secondary (plugin settings).
 */
.dotes-faq-container {
    margin: 20px 0;
    font-family: inherit;
}

/* List mode: every answer open, no toggle (works without JavaScript) */
.dotes-faq-container[data-toggle="list"] .dotes-faq-answer {
    display: block !important;
}
.dotes-faq-container[data-toggle="list"] .dotes-faq-toggle {
    cursor: default;
}
.dotes-faq-container[data-toggle="list"] .dotes-faq-icon {
    display: none;
}

.dotes-faq-title {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: #333;
    font-weight: 600;
}

.dotes-faq-search-container {
    margin-bottom: 20px;
}

.dotes-faq-search {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.dotes-faq-search:focus {
    border-color: var(--dotes-faq-primary, #075e54);
}

.dotes-faq-item {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.dotes-faq-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dotes-faq-toggle {
    width: 100%;
    padding: 16px 20px;
    background: #f8f9fa;
    border: none;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    transition: background-color 0.3s ease;
}

/* Secondary color: hover tint. Primary color: open question and keyboard focus. */
.dotes-faq-toggle:hover {
    background: #f0f2f5;
    background: color-mix(in srgb, var(--dotes-faq-secondary, #25d366) 12%, #f8f9fa);
}

.dotes-faq-toggle:focus {
    outline: none;
}

.dotes-faq-toggle:focus-visible {
    outline: 2px solid var(--dotes-faq-primary, #075e54);
    outline-offset: -2px;
}

.dotes-faq-item.active > .dotes-faq-question .dotes-faq-toggle {
    color: var(--dotes-faq-primary, #075e54);
}

.dotes-faq-question-text {
    flex: 1;
    margin-right: 16px;
}

.dotes-faq-featured-badge {
    background: var(--dotes-faq-secondary, #25d366);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 12px;
}

/* ---------- Question icons ----------
 * The built-in shapes (and the Pro icon types) are drawn here, so they show without
 * Font Awesome and look the same whatever the theme loads. Only "custom" Pro icons
 * use Font Awesome glyphs. The open/closed class is switched by frontend.js. */
.dotes-faq-icon {
    position: relative;
    display: inline-block;
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--dotes-faq-primary, #075e54);
    font-size: 14px;
    font-style: normal;
    line-height: 16px;
    text-align: center;
}

.dotes-faq-icon:is(.fa-chevron-down, .fa-chevron-up, .fa-angle-down, .fa-angle-up, .fa-caret-down, .fa-caret-up, .fa-arrow-down, .fa-arrow-up, .fa-plus, .fa-minus, .fa-plus-circle, .fa-minus-circle, .fa-plus-square, .fa-minus-square)::before,
.dotes-faq-icon:is(.fa-chevron-down, .fa-chevron-up, .fa-angle-down, .fa-angle-up, .fa-caret-down, .fa-caret-up, .fa-arrow-down, .fa-arrow-up, .fa-plus, .fa-minus, .fa-plus-circle, .fa-minus-circle, .fa-plus-square, .fa-minus-square)::after {
    content: "" !important;
    position: absolute;
    box-sizing: border-box;
    font-family: inherit !important;
}

/* Chevron and angle */
.dotes-faq-icon:is(.fa-chevron-down, .fa-chevron-up, .fa-angle-down, .fa-angle-up)::before {
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translate(-50%, -75%) rotate(45deg);
}

.dotes-faq-icon:is(.fa-chevron-up, .fa-angle-up)::before {
    transform: translate(-50%, -25%) rotate(-135deg);
}

.dotes-faq-icon:is(.fa-angle-down, .fa-angle-up)::before {
    border-width: 0 1.5px 1.5px 0;
}

/* Caret (triangle) */
.dotes-faq-icon:is(.fa-caret-down, .fa-caret-up)::before {
    top: 50%;
    left: 50%;
    border: 5px solid transparent;
    border-top-color: currentColor;
    transform: translate(-50%, -25%);
}

.dotes-faq-icon.fa-caret-up::before {
    border-top-color: transparent;
    border-bottom-color: currentColor;
    transform: translate(-50%, -75%);
}

/* Arrow */
.dotes-faq-icon:is(.fa-arrow-down, .fa-arrow-up)::after {
    top: 2px;
    left: 50%;
    width: 2px;
    height: 12px;
    background: currentColor;
    transform: translateX(-50%);
}

.dotes-faq-icon:is(.fa-arrow-down, .fa-arrow-up)::before {
    left: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.dotes-faq-icon.fa-arrow-down::before {
    bottom: 2px;
    transform: translateX(-50%) rotate(45deg);
}

.dotes-faq-icon.fa-arrow-up::before {
    top: 2px;
    transform: translateX(-50%) rotate(-135deg);
}

/* Plus / minus (plain, circle, square) */
.dotes-faq-icon:is(.fa-plus, .fa-minus, .fa-plus-circle, .fa-minus-circle, .fa-plus-square, .fa-minus-square)::before {
    top: 50%;
    left: 50%;
    width: 10px;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.dotes-faq-icon:is(.fa-plus, .fa-plus-circle, .fa-plus-square)::after {
    top: 50%;
    left: 50%;
    width: 2px;
    height: 10px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.dotes-faq-icon:is(.fa-plus-circle, .fa-minus-circle, .fa-plus-square, .fa-minus-square) {
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

.dotes-faq-icon:is(.fa-plus-square, .fa-minus-square) {
    border-radius: 3px;
}

.dotes-faq-answer {
    background: #fff;
    border-top: 1px solid #e1e5e9;
    animation: dotes-faq-slideDown 0.3s ease;
}

.dotes-faq-answer-content {
    padding: 20px;
    line-height: 1.6;
    color: #555;
}

.dotes-faq-answer-content p {
    margin: 0 0 16px 0;
}

.dotes-faq-answer-content p:last-child {
    margin-bottom: 0;
}

.dotes-faq-helpful {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dotes-faq-helpful-text {
    font-size: 14px;
    color: #666;
}

.dotes-faq-helpful-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.dotes-faq-helpful-btn:hover {
    background: var(--dotes-faq-primary, #075e54);
    color: white;
    border-color: var(--dotes-faq-primary, #075e54);
}

.dotes-faq-helpful-btn.selected {
    background: var(--dotes-faq-primary, #075e54);
    color: white;
    border-color: var(--dotes-faq-primary, #075e54);
}

@keyframes dotes-faq-slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.dotes-faq-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.dotes-faq-search-container {
    margin-bottom: 20px;
}

.dotes-faq-search {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.dotes-faq-search:focus {
    outline: none;
    border-color: var(--dotes-faq-primary, #075e54);
}

.dotes-faq-view-count {
    font-size: 12px;
    color: #888;
    margin-left: 10px;
}

@media (max-width: 768px) {
    .dotes-faq-toggle {
        padding: 14px 16px;
        font-size: 15px;
    }

    .dotes-faq-answer-content {
        padding: 16px;
    }

    .dotes-faq-helpful {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
}
