/*
 * QA Manager – Frontend Styles
 * Version: 1.0.0
 *
 * Keep neutral and override-friendly.
 * Elementor style controls can safely overwrite any rule below.
 */

/* =============================================================================
   Custom property defaults
   ============================================================================= */

:root {
    --qa-primary:        #0073aa;
    --qa-primary-hover:  #005a87;
    --qa-text:           #333333;
    --qa-text-muted:     #666666;
    --qa-border:         #e0e0e0;
    --qa-bg-card:        #ffffff;
    --qa-bg-answer:      #f5f5f5;
    --qa-border-answer:  #0073aa;
    --qa-radius-card:    8px;
    --qa-radius-button:  4px;
    --qa-card-gap:       24px;
}

/* =============================================================================
   Layout utilities
   ============================================================================= */

.qa-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* =============================================================================
   Grid wrapper
   ============================================================================= */

.qa-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(var(--qa-columns, 3), 1fr);
    gap: var(--qa-card-gap, 24px);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Column helpers (used by shortcode class + archive template) */
.qa-columns-1 { --qa-columns: 1; }
.qa-columns-2 { --qa-columns: 2; }
.qa-columns-3 { --qa-columns: 3; }
.qa-columns-4 { --qa-columns: 4; }
.qa-columns-5 { --qa-columns: 5; }
.qa-columns-6 { --qa-columns: 6; }

/* List layout: single column regardless of --qa-columns */
.qa-layout-list {
    grid-template-columns: 1fr !important;
}

/* =============================================================================
   Q&A Card
   ============================================================================= */

.qa-card {
    display:        flex;
    flex-direction: column;
    background:     var(--qa-bg-card);
    border:         1px solid var(--qa-border);
    border-radius:  var(--qa-radius-card);
    overflow:       hidden;
    transition:     box-shadow 0.2s ease, transform 0.2s ease;
}

.qa-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10);
    transform:  translateY(-2px);
}

/* --- Image --- */
.qa-card-image-link {
    display:  block;
    overflow: hidden;
    flex-shrink: 0;
}

.qa-card-image {
    width:       100%;
    height:      200px;
    object-fit:  cover;
    display:     block;
    transition:  transform 0.3s ease;
}

.qa-card:hover .qa-card-image {
    transform: scale(1.03);
}

/* --- Content area --- */
.qa-card-content {
    padding:        20px;
    display:        flex;
    flex-direction: column;
    flex:           1;
}

/* --- Title (always H2 in card context) --- */
.qa-card-title {
    font-size:   1.1rem;
    font-weight: 600;
    margin:      0 0 10px;
    line-height: 1.4;
}

.qa-card-title a {
    color:           inherit;
    text-decoration: none;
}

.qa-card-title a:hover {
    color:           var(--qa-primary);
    text-decoration: underline;
}

/* --- Short answer text --- */
.qa-card-short-answer {
    font-size:   0.9rem;
    color:       var(--qa-text-muted);
    margin:      0 0 16px;
    line-height: 1.6;
    flex:        1;
}

/* --- Read-more button --- */
.qa-card-button {
    display:         inline-block;
    padding:         8px 18px;
    background:      var(--qa-primary);
    color:           #ffffff;
    text-decoration: none;
    border-radius:   var(--qa-radius-button);
    font-size:       0.875rem;
    font-weight:     500;
    align-self:      flex-start;
    margin-top:      auto;
    transition:      background 0.2s ease, color 0.2s ease;
    border:          none;
    cursor:          pointer;
}

.qa-card-button:hover,
.qa-card-button:focus {
    background:      var(--qa-primary-hover);
    color:           #ffffff;
    text-decoration: none;
    outline:         none;
}

/* =============================================================================
   Single Q&A page
   ============================================================================= */

.qa-single {
    max-width: 900px;
    margin:    0 auto;
}

/* Featured image */
.qa-single-image {
    margin-bottom: 24px;
}

.qa-featured-image {
    width:         100%;
    height:        auto;
    display:       block;
    border-radius: var(--qa-radius-card);
}

/* Page title (H1) */
.qa-single-title {
    font-size:     2rem;
    font-weight:   700;
    margin:        0 0 20px;
    line-height:   1.3;
    color:         var(--qa-text);
}

/* Short answer – prominent block below H1 */
.qa-single-content .qa-short-answer {
    font-size:     1.05rem;
    font-weight:   500;
    color:         var(--qa-text);
    background:    var(--qa-bg-answer);
    border-left:   4px solid var(--qa-border-answer);
    padding:       14px 18px;
    margin-bottom: 28px;
    border-radius: 0 4px 4px 0;
    line-height:   1.7;
}

/* RTL sites: flip the border */
[dir="rtl"] .qa-single-content .qa-short-answer {
    border-left:   none;
    border-right:  4px solid var(--qa-border-answer);
    border-radius: 4px 0 0 4px;
}

/* Long answer */
.qa-single-content .qa-long-answer {
    font-size:     1rem;
    line-height:   1.8;
    color:         var(--qa-text);
    margin-bottom: 28px;
}

.qa-single-content .qa-long-answer h2,
.qa-single-content .qa-long-answer h3 {
    margin-top: 1.4em;
}

/* Section headings inside single content */
.qa-single-content .qa-key-points > h3,
.qa-single-content .qa-related-questions > h3,
.qa-single-content .qa-sources > h3 {
    font-size:     1.05rem;
    font-weight:   600;
    margin-bottom: 12px;
    color:         var(--qa-text);
}

/* Key points */
.qa-single-content .qa-key-points {
    margin-bottom: 28px;
}

.qa-single-content .qa-key-points ul {
    padding-left:  20px;
    margin:        0;
    list-style:    disc;
}

[dir="rtl"] .qa-single-content .qa-key-points ul {
    padding-left:  0;
    padding-right: 20px;
}

.qa-single-content .qa-key-points li {
    margin-bottom: 8px;
    line-height:   1.6;
    color:         #444;
}

/* Related questions */
.qa-single-content .qa-related-questions {
    margin-bottom: 28px;
}

.qa-related-list,
.qa-sources-list {
    padding-left:  20px;
    margin:        0;
    list-style:    disc;
}

[dir="rtl"] .qa-related-list,
[dir="rtl"] .qa-sources-list {
    padding-left:  0;
    padding-right: 20px;
}

.qa-related-list li,
.qa-sources-list li {
    margin-bottom: 6px;
}

.qa-related-list a,
.qa-sources-list a {
    color:           var(--qa-primary);
    text-decoration: none;
}

.qa-related-list a:hover,
.qa-sources-list a:hover {
    text-decoration: underline;
}

/* Sources */
.qa-single-content .qa-sources {
    margin-bottom: 28px;
}

/* Last reviewed */
.qa-last-reviewed {
    font-size:     0.85rem;
    color:         var(--qa-text-muted);
    margin-top:    28px;
    padding-top:   16px;
    border-top:    1px solid var(--qa-border);
}

/* =============================================================================
   Archive page
   ============================================================================= */

.qa-archive-main {
    padding: 32px 0;
}

.qa-archive-header {
    margin-bottom: 32px;
}

.qa-archive-title {
    font-size:   1.8rem;
    font-weight: 700;
    margin:      0 0 8px;
}

.qa-archive-description {
    color:       var(--qa-text-muted);
    font-size:   0.95rem;
    margin-top:  8px;
    line-height: 1.6;
}

.qa-archive-pagination {
    margin-top:  32px;
    text-align:  center;
}

.qa-archive-pagination .page-numbers {
    display:         inline-block;
    padding:         6px 12px;
    margin:          0 2px;
    border:          1px solid var(--qa-border);
    border-radius:   4px;
    text-decoration: none;
    color:           var(--qa-primary);
}

.qa-archive-pagination .page-numbers.current {
    background: var(--qa-primary);
    color:      #fff;
    border-color: var(--qa-primary);
}

/* =============================================================================
   Empty-state
   ============================================================================= */

.qa-no-results {
    padding:    24px;
    color:      var(--qa-text-muted);
    text-align: center;
    font-size:  0.95rem;
}

/* =============================================================================
   Responsive breakpoints
   ============================================================================= */

@media (max-width: 1024px) {
    .qa-columns-4,
    .qa-columns-5,
    .qa-columns-6 {
        --qa-columns: 3;
    }
}

@media (max-width: 768px) {
    .qa-columns-3,
    .qa-columns-4,
    .qa-columns-5,
    .qa-columns-6 {
        --qa-columns: 2;
    }

    .qa-single-title {
        font-size: 1.5rem;
    }

    .qa-archive-title {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .qa-grid-wrapper {
        --qa-columns: 1 !important;
    }

    .qa-single-title {
        font-size: 1.3rem;
    }

    .qa-container {
        padding: 0 12px;
    }
}
