/**
 * Netwise AI Connector — εμφάνιση του μπλοκ στο site του πελάτη.
 *
 * Αυστηρή εναρμόνιση με το Brand & τα Χρώματα του εκάστοτε ιστότοπου:
 * 1. Αντλεί αυτόματα το κύριο χρώμα (primary/accent) από το θέμα (WordPress Block Themes,
 *    Elementor, Astra, GeneratePress, Divi κ.α.).
 * 2. Δέχεται το χρώμα που ανίχνευσε ο AI agent κατά τη σάρωση ή αυτό που όρισε ο διαχειριστής
 *    μέσω της CSS μεταβλητής --nw-aeo-accent.
 * 3. Χρησιμοποιεί σύγχρονο, υψηλής αντίθεσης card/accordion design με ενεργή ένδειξη
 *    (active left accent border, χρωματιστό chevron, hover elevation).
 *
 * Τα στυλ φορτώνονται ΜΟΝΟ στις σελίδες που τυπώνουν μπλοκ.
 */

.netwise-ai-snippet,
.netwise-ai-seo-snippet {
    /* --- 1. Αυτόματος εντοπισμός Theme Colors --- */
    --nw-theme-fallback: #1e293b;
    --nw-theme-primary: var(--wp--preset--color--primary,
                        var(--e-global-color-primary,
                        var(--ast-global-color-0,
                        var(--global-palette1,
                        var(--color-primary,
                        var(--primary-color,
                        var(--theme-primary, var(--nw-theme-fallback))))))));

    /* --- 2. Τελικό Brand Accent Color --- */
    --nw-aeo-accent: var(--nw-custom-accent, var(--nw-theme-primary));

    /* --- 3. Επιφάνειες, περιγράμματα & τυπογραφία --- */
    --nw-aeo-line: rgba(0, 0, 0, 0.12);
    --nw-aeo-surface: #ffffff;
    --nw-aeo-title-color: #0f172a;
    --nw-aeo-body-color: #334155;
    --nw-aeo-radius: 10px;

    margin: 2.75rem 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--nw-aeo-body-color);
    box-sizing: border-box;
}

@supports (color: color-mix(in srgb, currentColor 10%, transparent)) {
    .netwise-ai-snippet,
    .netwise-ai-seo-snippet {
        --nw-aeo-line: color-mix(in srgb, var(--nw-aeo-accent) 22%, rgba(0, 0, 0, 0.1));
        --nw-aeo-wash: color-mix(in srgb, var(--nw-aeo-accent) 4%, #ffffff);
    }
}

/* --- Επικεφαλίδα Ενότητας -------------------------------------------- */
.netwise-ai-snippet > h2,
.netwise-ai-snippet > h3,
.netwise-ai-seo-snippet > h2,
.netwise-ai-seo-snippet > h3,
.netwise-ai-snippet .nw-faq-heading {
    margin: 0 0 1.25rem;
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 700;
    color: var(--nw-aeo-title-color);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 0.85rem;
    border-left: 4px solid var(--nw-aeo-accent);
}

.netwise-ai-snippet .nw-faq-intro,
.netwise-ai-seo-snippet .nw-faq-intro {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--nw-aeo-body-color);
    margin: 0 0 1.5rem;
    max-width: 80ch;
}

/* --- Λίστα ερωτήσεων (Cards / Accordions) ---------------------------- */
.netwise-ai-snippet .nw-faq-list,
.netwise-ai-seo-snippet .nw-faq-list {
    display: grid;
    gap: 0.85rem;
}

.netwise-ai-snippet details,
.netwise-ai-seo-snippet details {
    border: 1px solid var(--nw-aeo-line);
    border-left: 4px solid transparent;
    border-radius: var(--nw-aeo-radius);
    background: var(--nw-aeo-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    transition: border-color 0.2s ease, border-left-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

/* Hover: φωτίζει διακριτικά το περίγραμμα με το χρώμα του brand */
.netwise-ai-snippet details:hover,
.netwise-ai-seo-snippet details:hover {
    border-color: color-mix(in srgb, var(--nw-aeo-accent) 45%, rgba(0, 0, 0, 0.15));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Open: ένδειξη brand χρώματος στην αριστερή λωρίδα, ανύψωση & καθαρό contrast */
.netwise-ai-snippet details[open],
.netwise-ai-seo-snippet details[open] {
    border-color: color-mix(in srgb, var(--nw-aeo-accent) 35%, rgba(0, 0, 0, 0.12));
    border-left: 4px solid var(--nw-aeo-accent);
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

/* --- Ερώτηση (Summary) ----------------------------------------------- */
.netwise-ai-snippet summary,
.netwise-ai-seo-snippet summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.1rem 1.4rem;
    cursor: pointer;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--nw-aeo-title-color);
    list-style: none;
    user-select: none;
    line-height: 1.45;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.netwise-ai-snippet summary::-webkit-details-marker,
.netwise-ai-seo-snippet summary::-webkit-details-marker { display: none; }
.netwise-ai-snippet summary::marker,
.netwise-ai-seo-snippet summary::marker { content: ""; }

/* Όταν είναι ανοιχτό, ο τίτλος της ερώτησης υιοθετεί το brand χρώμα */
.netwise-ai-snippet details[open] > summary,
.netwise-ai-seo-snippet details[open] > summary {
    color: var(--nw-aeo-accent);
    border-bottom: 1px solid color-mix(in srgb, var(--nw-aeo-accent) 15%, rgba(0, 0, 0, 0.07));
    padding-bottom: 0.95rem;
    margin-bottom: 0.95rem;
}

/* Chevron δείκτης στο χρώμα του brand */
.netwise-ai-snippet summary::after,
.netwise-ai-seo-snippet summary::after {
    content: "";
    flex: none;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2.5px solid var(--nw-aeo-accent);
    border-bottom: 2.5px solid var(--nw-aeo-accent);
    transform: rotate(45deg);
    opacity: 0.8;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
    margin-left: auto;
}

.netwise-ai-snippet details[open] > summary::after,
.netwise-ai-seo-snippet details[open] > summary::after {
    transform: rotate(-135deg);
    opacity: 1;
}

.netwise-ai-snippet summary:focus-visible,
.netwise-ai-seo-snippet summary:focus-visible {
    outline: 2px solid var(--nw-aeo-accent);
    outline-offset: -2px;
}

/* --- Απάντηση -------------------------------------------------------- */
.netwise-ai-snippet details > :not(summary),
.netwise-ai-seo-snippet details > :not(summary) {
    margin: 0;
    padding: 0 1.4rem 1.25rem;
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--nw-aeo-body-color);
}

.netwise-ai-snippet details > p:not(:last-child),
.netwise-ai-seo-snippet details > p:not(:last-child) {
    margin-bottom: 0.75rem;
}

/* --- Dark Theme Support ---------------------------------------------- */
@media (prefers-color-scheme: dark) {
    body.dark-mode .netwise-ai-snippet,
    body.dark-theme .netwise-ai-snippet,
    [data-theme="dark"] .netwise-ai-snippet {
        --nw-aeo-surface: rgba(255, 255, 255, 0.04);
        --nw-aeo-title-color: #f8fafc;
        --nw-aeo-body-color: #cbd5e1;
        --nw-aeo-line: rgba(255, 255, 255, 0.12);
    }
}

@media (prefers-reduced-motion: reduce) {
    .netwise-ai-snippet summary::after,
    .netwise-ai-seo-snippet summary::after,
    .netwise-ai-snippet details,
    .netwise-ai-seo-snippet details {
        transition: none !important;
    }
}
