/* ==========================================================================
   Artwork AI Editorial — style.css v2.0
   ========================================================================== */

/* --- ADMIN: GENERALI --- */
.artwork-ai-box { position: relative; padding: 5px; }
.artwork-ai-box textarea { background: #fafafa; border: 1px solid #ddd; }

/* --- ADMIN: PANELS --- */
.aw-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}
.aw-panel-title {
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    font-weight: 700;
}
.aw-field {
    margin-bottom: 12px;
}
.aw-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
}
.aw-field input[type="text"],
.aw-field textarea,
.aw-field input[type="password"] {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}
.aw-field textarea {
    min-height: 70px;
}
.aw-btn-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.aw-btn-orange {
    border-color: #e65100 !important;
    background-color: #e65100 !important;
    color: #fff !important;
}
.aw-success-badge {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 10px;
}

/* --- ADMIN: FAQ DRAG & DROP --- */
.aw-faq-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.aw-faq-count {
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #50575e;
}
.aw-faq-sortable {
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 50px;
    padding: 6px;
    background: #fafafa;
    max-height: 400px;
    overflow-y: auto;
}
.aw-faq-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 6px;
    cursor: default;
    transition: background 0.15s;
}
.aw-faq-item:last-child { margin-bottom: 0; }
.aw-faq-item:hover { background: #f5f9ff; }
.aw-faq-item.aw-faq-dragging {
    background: #e8f0fe !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0.9;
}
.aw-faq-handle {
    cursor: grab;
    color: #aaa;
    font-size: 18px;
    line-height: 1;
    padding-top: 2px;
    user-select: none;
    flex-shrink: 0;
}
.aw-faq-handle:active { cursor: grabbing; }
.aw-faq-content { flex: 1; min-width: 0; }
.aw-faq-q {
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aw-faq-a {
    font-size: 12px;
    color: #646970;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aw-faq-empty {
    color: #aaa;
    font-style: italic;
    font-size: 13px;
    padding: 10px;
    text-align: center;
}
.aw-save-indicator {
    display: inline-block;
    color: #00a32a;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

/* --- ADMIN: LOADING OVERLAY --- */
#artwork-loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(6px);
    z-index: 999999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}
.artwork-loader-content {
    background: #fff;
    padding: 40px 60px;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    border: 1px solid #e0e0e0;
}
.artwork-spinner {
    width: 56px; height: 56px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #232323;
    border-radius: 50%;
    animation: aw-spin 0.9s linear infinite;
    margin: 0 auto 18px auto;
}
.artwork-loading-text {
    font-size: 18px;
    font-weight: 700;
    color: #232323;
    font-family: sans-serif;
}
@keyframes aw-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================================================
   FRONTEND
   ========================================================================== */

/* --- SIDEBAR OVERLAY & DRAWER --- */
.artwork-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}
.artwork-sidebar {
    position: fixed;
    top: 0;
    right: -440px;
    width: 420px;
    max-width: 95vw;
    height: 100%;
    background: #121212;
    color: #ffffff;
    z-index: 9999;
    box-shadow: -2px 0 30px rgba(0,0,0,0.4);
    padding: 30px 28px;
    transition: right 0.3s cubic-bezier(0.4,0,0.2,1);
    overflow-y: auto;
    box-sizing: border-box;
}
.artwork-sidebar.active { right: 0; }
.artwork-sidebar h3 { color: #ffffff; margin-top: 0; }

#artwork-close-sidebar {
    float: right;
    font-size: 28px;
    line-height: 1;
    border: none;
    background: none;
    cursor: pointer;
    color: rgba(255,255,255,0.6);
    padding: 0;
    margin: -5px -5px 0 0;
}
#artwork-close-sidebar:hover { color: #ffffff; }

/* --- APPROFONDIMENTO SIDEBAR (dark bg) --- */
.artwork-deepening-content {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255,255,255,0.8);
}
.artwork-deepening-content h3,
.artwork-deepening-content h4 { margin-top: 24px; margin-bottom: 10px; color: #ffffff; }
.artwork-deepening-content p { color: rgba(255,255,255,0.75); }
.artwork-deepening-content strong { color: #ffffff; }
.artwork-deepening-content a { color: rgba(255,255,255,0.9); text-decoration: underline; }
.artwork-deepening-content a:hover { color: #ffffff; }
.artwork-deepening-content ul { padding-left: 20px; }
.artwork-deepening-content li { margin-bottom: 6px; color: rgba(255,255,255,0.75); }

/* --- FAQ ACCORDION SIDEBAR (dark bg) --- */
.artwork-accordion details {
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 14px;
}
.artwork-accordion details:last-child { border-bottom: none; }
.artwork-accordion summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    font-size: 15px;
    color: #ffffff;
    outline: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}
.artwork-accordion summary::-webkit-details-marker { display: none; }
.artwork-accordion details:not([open]) .artwork-arrow-icon { transform: rotate(180deg); }
.artwork-accordion details[open] .artwork-arrow-icon { transform: rotate(0deg); }
.artwork-arrow-icon { transition: transform 0.25s ease; color: rgba(255,255,255,0.5); flex-shrink: 0; }
.details-content { margin-top: 10px; font-size: 14px; color: rgba(255,255,255,0.75); line-height: 1.65; }
.details-content strong { color: #ffffff; }

/* --- CONTATTACI TAB (dark) --- */
#artwork-tab-contact h3 { color: #ffffff; }
.artwork-global-content { color: rgba(255,255,255,0.8); }
.artwork-global-content h1, .artwork-global-content h2,
.artwork-global-content h4 { color: #ffffff; }
.artwork-global-content p { color: rgba(255,255,255,0.75); }
.artwork-global-content a { color: rgba(255,255,255,0.9); }
.artwork-global-content input, .artwork-global-content textarea {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2) !important;
    color: #ffffff !important;
}
.artwork-global-content input::placeholder, .artwork-global-content textarea::placeholder {
    color: rgba(255,255,255,0.4);
}
.artwork-global-content label { color: rgba(255,255,255,0.7); }
.artwork-global-content .wpcf7-list-item-label { color: rgba(255,255,255,0.7) !important; }
.artwork-global-content .wpcf7-list-item-label a { color: rgba(255,255,255,0.9) !important; }

/* --- FAQ E APPROFONDIMENTO INIETTATI NEL BODY CONTENT --- */
.aw-deepening-block {
    margin-top: 40px;
    padding: 28px 32px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
}
.aw-deepening-title {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 16px;
    color: #1d2327;
}
.aw-faq-body-block {
    margin-top: 40px;
    padding: 28px 32px;
    background: #f8f9fa;
    border-radius: 4px;
}
.aw-faq-body-title {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    color: #1d2327;
}

/* --- FLOATING BAR (CSS Variables per colori configurabili) --- */
:root {
    --aw-btn-bg:     #ffffff;
    --aw-btn-text:   #232323;
    --aw-btn-border: #EAEAEA;
    --aw-btn-radius: 6px;
}

.artwork-floating-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999;
    width: auto;
    max-width: 92%;
}

.artwork-bar-inner {
    display: flex;
    gap: 0;
    border: 1px solid var(--aw-btn-border);
    border-radius: var(--aw-btn-radius);
    background-color: var(--aw-btn-bg);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}

.artwork-floating-bar .art-btn {
    white-space: nowrap;
    padding: 12px 24px;
    text-decoration: none;
    transition: background-color 0.2s ease;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    background-color: transparent;
    color: var(--aw-btn-text) !important;
    border: none;
    border-right: 1px solid var(--aw-btn-border);
    line-height: 1;
    text-decoration: none !important;
}
.artwork-floating-bar .art-btn:last-child {
    border-right: none;
}
.artwork-floating-bar .art-btn:hover {
    background-color: rgba(0,0,0,0.04);
    color: var(--aw-btn-text) !important;
    text-decoration: none !important;
}

@media (max-width: 600px) {
    .artwork-floating-bar .art-btn { padding: 10px 14px; font-size: 12px; }
}

/* ==========================================================================
   METABOX — PANNELLO SELETTIVO (v2.1)
   ========================================================================== */

/* Badge */
.aw-panel-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.aw-panel-title-row .aw-panel-title { margin: 0; }
.aw-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.6;
}
.aw-badge-blue   { background: #e8f0fe; color: #1a73e8; }
.aw-badge-gray   { background: #f0f0f1; color: #50575e; }
.aw-badge-ok     { background: #e8f5e9; color: #2e7d32; }

/* Griglia selettiva */
.aw-selective-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.aw-selective-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}
.aw-selective-item:hover { background: #f5f9ff; border-color: #c5d9ed; }
.aw-selective-item.aw-sel-done { border-color: #a5d6a7; background: #f1f8f1; }

.aw-sel-label-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
}
.aw-sel-label-wrap input[type="checkbox"] {
    margin: 0;
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}
.aw-sel-icon { font-size: 15px; line-height: 1; }
.aw-sel-name { flex: 1; }

.aw-sel-status {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}
.aw-sel-ok    { color: #2e7d32; }
.aw-sel-empty { color: #bbb; }

.aw-sel-desc {
    font-size: 11px;
    color: #888;
    margin: 0;
    line-height: 1.4;
    padding-left: 22px;
}

/* Selezione rapida */
.aw-sel-shortcuts {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #646970;
    padding-top: 2px;
}
.aw-sel-shortcuts span { font-size: 12px; }
.aw-sel-shortcut {
    color: #0073aa;
    text-decoration: none;
    font-size: 12px;
    padding: 2px 8px;
    border: 1px solid #c5d9ed;
    border-radius: 3px;
    background: #f0f6fc;
    transition: background 0.15s;
}
.aw-sel-shortcut:hover { background: #dce8f5; color: #005a8c; text-decoration: none; }

/* Summary */
.aw-sel-summary { color: #50575e; font-size: 12px; }
.aw-sel-summary strong { color: #1d2327; }

/* Collapsible */
.aw-collapsible-trigger { cursor: pointer; user-select: none; }
.aw-collapse-icon { font-size: 16px; color: #888; margin-left: auto; }

/* ==========================================================================
   CANNIBALIZZAZIONE
   ========================================================================== */
.aw-field-row { display: flex; gap: 10px; align-items: flex-end; }
.aw-field-grow { flex: 1; }
.aw-field-shrink { flex-shrink: 0; }

.aw-cannib-box {
    padding: 10px 14px;
    border-radius: 5px;
    font-size: 13px;
    line-height: 1.6;
    margin-top: 8px;
    margin-bottom: 4px;
}
.aw-cannib-box a { color: inherit; text-decoration: underline; }
.aw-cannib-safe    { background: #edfaee; border: 1px solid #a5d6a7; color: #1b5e20; }
.aw-cannib-warning { background: #fff8e1; border: 1px solid #ffe082; color: #5d4037; }
.aw-cannib-danger  { background: #fdecea; border: 1px solid #f5c6c6; color: #b71c1c; }
.aw-cannib-badge-exact {
    display: inline-block;
    background: #d63638;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 600;
}
.aw-cannib-type { color: #888; font-size: 11px; }

/* ==========================================================================
   STORICO VERSIONI
   ========================================================================== */
.aw-versions-list { display: flex; flex-direction: column; gap: 8px; }

.aw-version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    gap: 10px;
    flex-wrap: wrap;
}
.aw-version-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.aw-version-date { font-weight: 600; font-size: 12px; color: #1d2327; }
.aw-version-kw   { font-size: 11px; color: #0073aa; background: #e8f0fe; padding: 2px 7px; border-radius: 3px; }
.aw-version-len  { font-size: 11px; color: #888; }
.aw-version-actions { display: flex; gap: 6px; align-items: center; }
.aw-version-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #d63638;
    font-size: 14px;
    padding: 2px 4px;
    line-height: 1;
}
.aw-version-delete:hover { color: #a00; }

/* Modale versione */
#aw-version-preview-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 100000; }
.aw-modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
.aw-modal-box {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    width: 680px;
    max-width: 95vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.aw-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
}
.aw-modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #555; }
.aw-modal-body  { padding: 18px; font-size: 14px; line-height: 1.7; }

/* ==========================================================================
   A/B TEST META SEO
   ========================================================================== */
.aw-badge-purple { background: #f3e8ff; color: #6d28d9; }

.aw-ab-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
}
.aw-ab-card.aw-ab-applied {
    border-color: #00a32a;
    background: #f0fff3;
}
.aw-ab-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.aw-ab-label {
    font-weight: 700;
    font-size: 13px;
    color: #1d2327;
    background: #f0f0f1;
    padding: 3px 10px;
    border-radius: 20px;
}
.aw-ab-field { margin-bottom: 8px; }
.aw-ab-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}
.aw-ab-len { font-weight: 600; }
.aw-ab-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a0dab;
    line-height: 1.4;
}
.aw-ab-preview-desc {
    font-size: 13px;
    color: #4d5156;
    line-height: 1.5;
}

/* ==========================================================================
   LISTA POST — COLONNE AI
   ========================================================================== */
.aw-col-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.column-ai_content, .column-ai_faq, .column-ai_seo,
.column-ai_deepening, .column-ai_actions { width: 70px; text-align: center; }
.column-ai_actions { width: 160px; text-align: left; }

.aw-status-dot { font-size: 14px; line-height: 1; display: inline-block; }
.aw-dot-ok    { color: #2e7d32; }
.aw-dot-empty { color: #ccc; }
.aw-col-count { display: block; font-size: 10px; color: #888; line-height: 1; margin-top: 2px; }

/* Quick actions nella lista */
.aw-quick-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.aw-quick-select  { font-size: 11px; max-width: 105px; padding: 2px 4px; }
.aw-quick-run     { font-size: 11px; padding: 2px 6px !important; min-width: 24px; }
.aw-quick-status  { font-size: 10px; font-weight: 600; display: block; margin-top: 2px; width: 100%; }

/* ==========================================================================
   SCROLL TARGET HIGHLIGHT
   Lampeggio temporaneo quando si scrolla a FAQ o Approfondimento
   ========================================================================== */
@keyframes aw-highlight-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(0,115,170,0); }
    30%  { box-shadow: 0 0 0 8px rgba(0,115,170,0.3); }
    100% { box-shadow: 0 0 0 0 rgba(0,115,170,0); }
}
.aw-block-highlight {
    animation: aw-highlight-pulse 1.8s ease-out;
    border-radius: 4px;
}

/* ==========================================================================
   BLOCCHI NEL BODY CONTENT (Approfondimento + FAQ)
   Stile pulito, coerente con il tema, leggibile da Google e LLM
   ========================================================================== */
.aw-deepening-block {
    margin-top: 48px;
    padding: 32px 36px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    border-radius: 0 4px 4px 0;
    scroll-margin-top: 90px; /* offset per header fisso */
}
.aw-deepening-title {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 18px;
    color: #1d2327;
}
.aw-deepening-block h3,
.aw-deepening-block h4 { margin-top: 22px; margin-bottom: 10px; }
.aw-deepening-block p  { line-height: 1.75; }
.aw-deepening-block ul { padding-left: 22px; }
.aw-deepening-block li { margin-bottom: 6px; line-height: 1.65; }
.aw-deepening-block a  { color: #0073aa; }

.aw-faq-body-block {
    margin-top: 48px;
    padding: 32px 36px;
    background: #f8f9fa;
    border-radius: 4px;
    scroll-margin-top: 90px;
}
.aw-faq-body-title {
    font-size: 20px;
    margin-top: 0;
    margin-bottom: 22px;
    color: #1d2327;
}

/* FAQ accordion nel body: stile chiaro (non dark come la sidebar) */
.aw-faq-body-block .artwork-accordion details {
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 0;
    padding: 0;
}
.aw-faq-body-block .artwork-accordion details:last-child { border-bottom: none; }
.aw-faq-body-block .artwork-accordion summary {
    color: #1d2327;
    padding: 14px 0;
    font-size: 15px;
}
.aw-faq-body-block .artwork-accordion .artwork-arrow-icon { color: #999; }
.aw-faq-body-block .artwork-accordion .details-content {
    color: #444;
    padding-bottom: 14px;
    font-size: 14px;
    line-height: 1.7;
}
.aw-faq-body-block .artwork-accordion .details-content strong { color: #1d2327; }

@media (max-width: 600px) {
    .aw-deepening-block,
    .aw-faq-body-block { padding: 20px 18px; }
}

/* ==========================================================================
   AW-SEO-BLOCK — Contenuto nel DOM per Google/LLM, nascosto visivamente
   Tecnica sr-only standard (Bootstrap/Tailwind) — NON penalizzata da Google
   perché è pratica legittima di accessibilità, non keyword stuffing nascosto
   Il contenuto è leggibile da screen reader e crawler, invisibile all'occhio
   ========================================================================== */
.aw-seo-block {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
