/**
 * Apex Schema & Freshness Booster - Frontend Master Stylesheet
 * High performance, accessible, responsive, and 100% AMP compliant.
 */

/* =========================================
   1. Freshness Notice Badge
   ========================================= */
.apex-updated-notice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: #334155;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin: 12px 0 20px 0;
    border: 1px solid #e2e8f0;
    line-height: 1.4;
}

.apex-updated-icon {
    font-size: 14px;
    line-height: 1;
}

.apex-updated-label {
    font-weight: 600;
    color: #0f172a;
}

.apex-updated-time {
    color: #2563eb;
    font-weight: 600;
}

/* =========================================
   2. Table of Contents Box (TOC - AMP & Mobile Ready)
   ========================================= */
.apex-toc-container {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px 20px;
    margin: 24px 0 32px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.apex-toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.apex-toc-header::-webkit-details-marker {
    display: none;
}

.apex-toc-icon {
    margin-inline-end: 6px;
}

.apex-toc-title {
    flex: 1;
}

.apex-toc-toggle-badge {
    background: #e2e8f0;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.apex-toc-container[open] .apex-toc-header {
    margin-bottom: 12px;
}

.apex-toc-list {
    margin: 0;
    padding-inline-start: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    line-height: 1.6;
}

.apex-toc-item {
    color: #334155;
}

.apex-toc-link {
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.apex-toc-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* =========================================
   3. Reddit-Style Truth & Rating Widget
   ========================================= */
.apex-rating-widget {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin: 36px 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border-top: 4px solid #10b981;
}

.apex-rating-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.apex-rating-badge {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.apex-rating-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

/* Credibility Progress Meter */
.apex-truth-meter {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 20px;
}

.apex-truth-progress-bar {
    background: #e2e8f0;
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.apex-truth-progress-fill {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    height: 100%;
    border-radius: 8px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.apex-truth-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #475569;
    flex-wrap: wrap;
    gap: 8px;
}

.apex-val-pct {
    color: #059669;
    font-size: 15px;
    font-weight: 700;
}

.apex-truth-stars-info {
    font-weight: 600;
    color: #1e293b;
}

.apex-val-rating {
    color: #d97706;
}

/* Interactive Voting Area */
.apex-interactive-vote-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px dashed #e2e8f0;
}

.apex-truth-question-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.apex-truth-question {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.apex-truth-buttons {
    display: flex;
    gap: 8px;
}

.apex-truth-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
    transition: all 0.2s ease;
}

.apex-truth-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.apex-truth-btn.active,
.apex-truth-yes:hover {
    border-color: #10b981;
    background: #ecfdf5;
    color: #065f46;
}

.apex-truth-no:hover {
    border-color: #ef4444;
    background: #fef2f2;
    color: #991b1b;
}

/* Star Rating Section */
.apex-star-rating-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.apex-star-label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.apex-stars {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 4px;
}

.apex-star-input {
    display: none;
}

.apex-star-label-icon {
    font-size: 26px;
    color: #cbd5e1;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
    line-height: 1;
    padding: 2px;
}

.apex-star-label-icon:hover,
.apex-star-label-icon:hover ~ .apex-star-label-icon,
.apex-star-label-icon.selected {
    color: #f59e0b;
    transform: scale(1.1);
}

.apex-rating-feedback {
    width: 100%;
    margin-top: 8px;
    font-size: 13px;
    color: #059669;
    font-weight: 600;
}

.apex-feedback-error {
    color: #dc2626;
}

.apex-rating-thankyou {
    width: 100%;
    text-align: center;
    padding: 12px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #065f46;
}

/* AMP Fallback Badge */
.apex-amp-vote-box {
    width: 100%;
    text-align: center;
}

.apex-amp-badge {
    display: inline-block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* =========================================
   4. FAQ Accordion (Native & AMP Details/Summary)
   ========================================= */
.apex-faq-container {
    margin: 30px 0;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.apex-faq-main-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.apex-faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.apex-faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.apex-faq-item:hover {
    border-color: #cbd5e1;
}

.apex-faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: none;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    text-align: inherit;
    cursor: pointer;
    list-style: none;
    user-select: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.apex-faq-question::-webkit-details-marker {
    display: none;
}

.apex-faq-question:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.apex-faq-question-text {
    flex: 1;
    margin-inline-end: 12px;
}

.apex-faq-icon {
    font-size: 20px;
    font-weight: bold;
    color: #64748b;
    transition: transform 0.25s ease;
    line-height: 1;
}

.apex-faq-item[open] .apex-faq-question {
    background: #eff6ff;
    color: #1d4ed8;
}

.apex-faq-item[open] .apex-faq-icon {
    transform: rotate(45deg);
    color: #2563eb;
}

.apex-faq-answer {
    padding: 0 20px 16px 20px;
    background: #ffffff;
    border-top: 1px solid #f1f5f9;
}

.apex-faq-answer-inner {
    padding-top: 14px;
    font-size: 15px;
    line-height: 1.7;
    color: #334155;
}

.apex-faq-answer-inner p:last-child {
    margin-bottom: 0;
}

/* =========================================
   5. How-To Steps Container
   ========================================= */
.apex-howto-container {
    margin: 32px 0;
    padding: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.apex-howto-title {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.apex-howto-desc {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: #64748b;
    line-height: 1.6;
}

.apex-howto-main-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 8px;
}

.apex-howto-steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.apex-howto-step-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.apex-step-badge {
    background: #2563eb;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.apex-step-content {
    flex: 1;
}

.apex-step-heading {
    margin: 0 0 8px 0;
    font-size: 17px;
    font-weight: 600;
    color: #1e293b;
}

.apex-step-text {
    font-size: 15px;
    line-height: 1.6;
    color: #475569;
}

.apex-step-text p:last-child {
    margin-bottom: 0;
}

.apex-step-image img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin-top: 12px;
}

/* =========================================
   6. Mobile-First Responsiveness (< 640px)
   ========================================= */
@media (max-width: 640px) {
    .apex-rating-widget,
    .apex-faq-container,
    .apex-howto-container {
        padding: 16px;
        margin: 20px 0;
    }

    .apex-interactive-vote-box {
        flex-direction: column;
        align-items: stretch;
    }

    .apex-truth-buttons {
        width: 100%;
    }

    .apex-truth-btn {
        flex: 1;
        text-align: center;
    }

    .apex-star-rating-wrap {
        justify-content: space-between;
        width: 100%;
    }
}
