/**
 * Stili per plg_system_cwmemorial & com_cwmemorial - Il Ponte dei Ricordi (v1.2.8)
 * Copyright (C) 2026 ConsulentiWeb.com S.r.l. Tutti i diritti riservati.
 */

/* ==========================================================================
   0. Sfondo Etereo Tenue a Tutta Pagina - Il Ponte dei Ricordi
   ========================================================================== */

/* Applica lo sfondo all'intero viewport (body, html, tm-page, #tm-main) sostituendo il bianco su tutta la pagina anche ai lati */
html:has(.cw-memorial-page-wrapper),
html:has(.cw-memorial-single-wrapper),
html:has(.cw-memorial-submit-page),
body:has(.cw-memorial-page-wrapper),
body:has(.cw-memorial-single-wrapper),
body:has(.cw-memorial-submit-page),
html.cw-memorial-fullbg,
body.cw-memorial-fullbg {
    background-color: #fbfcfe !important;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.93)),
        url('/images/Sfondo%20ponte%20arcobaleno%20.jpg'),
        url('../images/sfondo-ponte-arcobaleno.jpg') !important;
    background-repeat: no-repeat !important;
    background-position: center top !important;
    background-size: cover !important;
    background-attachment: fixed !important;
    min-height: 100vh !important;
}

/* Rendi trasparenti i wrapper intermedi di YOOtheme Pro e del layout per evitare bande bianche laterali */
body:has(.cw-memorial-page-wrapper) .tm-page,
body:has(.cw-memorial-page-wrapper) #tm-main,
body:has(.cw-memorial-page-wrapper) .tm-main,
body:has(.cw-memorial-page-wrapper) .uk-section-default,
body:has(.cw-memorial-single-wrapper) .tm-page,
body:has(.cw-memorial-single-wrapper) #tm-main,
body:has(.cw-memorial-single-wrapper) .tm-main,
body:has(.cw-memorial-single-wrapper) .uk-section-default,
body:has(.cw-memorial-submit-page) .tm-page,
body:has(.cw-memorial-submit-page) #tm-main,
body:has(.cw-memorial-submit-page) .tm-main,
body:has(.cw-memorial-submit-page) .uk-section-default,
body.cw-memorial-fullbg .tm-page,
body.cw-memorial-fullbg #tm-main,
body.cw-memorial-fullbg .tm-main,
body.cw-memorial-fullbg .uk-section-default {
    background-color: transparent !important;
    background: transparent !important;
    background-image: none !important;
}

.cw-memorial-page-wrapper,
.cw-memorial-single-wrapper,
.cw-memorial-submit-page {
    position: relative;
    background-color: transparent !important;
    background: transparent !important;
    background-image: none !important;
    min-height: 80vh;
}

@media (max-width: 960px) {
    html:has(.cw-memorial-page-wrapper),
    html:has(.cw-memorial-single-wrapper),
    html:has(.cw-memorial-submit-page),
    body:has(.cw-memorial-page-wrapper),
    body:has(.cw-memorial-single-wrapper),
    body:has(.cw-memorial-submit-page),
    html.cw-memorial-fullbg,
    body.cw-memorial-fullbg {
        background-attachment: scroll !important;
    }
}

/* ==========================================================================
   1. Cero Virtuale Interattivo & Animazione Fiamma
   ========================================================================== */

.cw-candle-widget {
    display: flex;
    align-items: center;
    gap: 24px;
    background: linear-gradient(135deg, #fffbf2 0%, #fef7e6 100%);
    border: 1px solid #fde68a;
    border-radius: 16px;
    padding: 24px 28px;
    margin: 30px 0;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.08);
    transition: all 0.3s ease;
}

.cw-candle-widget.is-lit {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #f59e0b;
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.22);
}

.cw-candle-visual {
    position: relative;
    width: 48px;
    height: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Corpo Candela */
.cw-candle-body {
    width: 30px;
    height: 48px;
    background: linear-gradient(to right, #fef3c7, #fde68a, #fcd34d);
    border-radius: 4px 4px 6px 6px;
    position: relative;
    box-shadow: inset 0 -4px 6px rgba(0, 0, 0, 0.08);
}

/* Stoppino */
.cw-candle-body::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 7px;
    background-color: #451a03;
    border-radius: 2px;
}

/* Fiamma */
.cw-candle-flame {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 24px;
    opacity: 0.2;
    filter: grayscale(1);
    transition: opacity 0.6s ease, filter 0.6s ease;
}

.cw-candle-widget.is-lit .cw-candle-flame {
    opacity: 1;
    filter: grayscale(0);
    animation: cwFlameFlicker 1.8s infinite ease-in-out alternate;
}

.flame-glow {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 32px;
    height: 40px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.7) 0%, rgba(245, 158, 11, 0) 70%);
    border-radius: 50%;
    animation: cwGlowPulse 2.2s infinite ease-in-out;
}

.flame-core {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 20px;
    background: linear-gradient(to bottom, #fffbeb 0%, #fde047 30%, #f97316 75%, #ea580c 100%);
    border-radius: 50% 50% 35% 35% / 60% 60% 40% 40%;
    box-shadow: 0 0 10px #fbbf24, 0 0 20px #f59e0b;
}

@keyframes cwFlameFlicker {
    0%   { transform: translateX(-50%) scale(1) rotate(-1deg); }
    25%  { transform: translateX(-50%) scale(1.08, 0.95) rotate(1deg); }
    50%  { transform: translateX(-50%) scale(0.95, 1.05) rotate(-2deg); }
    75%  { transform: translateX(-50%) scale(1.04, 0.98) rotate(1.5deg); }
    100% { transform: translateX(-50%) scale(1) rotate(0deg); }
}

@keyframes cwGlowPulse {
    0%   { transform: scale(0.9); opacity: 0.6; }
    50%  { transform: scale(1.15); opacity: 0.95; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

/* Meta & Contatore Cero */
.cw-candle-meta {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.cw-candle-counter {
    display: flex;
    flex-direction: column;
}

.cw-candle-count-num {
    font-size: 28px;
    font-weight: 800;
    color: #92400e;
    line-height: 1;
}

.cw-candle-count-label {
    font-size: 13px;
    font-weight: 600;
    color: #b45309;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.cw-btn-light-candle {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 30px !important;
    padding: 10px 24px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35) !important;
    transition: all 0.25s ease !important;
}

.cw-btn-light-candle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.5) !important;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
}

/* ==========================================================================
   2. Bacheca Messaggi di Cordoglio
   ========================================================================== */

.cw-messages-widget {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px;
    margin-top: 40px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.cw-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 20px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
}

.cw-messages-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 6px;
}

.cw-message-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    transition: background-color 0.2s ease;
}

.cw-message-card:hover {
    background: #f1f5f9;
}

.cw-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #334155;
    margin-bottom: 6px;
}

.cw-msg-date {
    font-size: 12px;
    color: #94a3b8;
}

.cw-msg-body {
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

.cw-no-messages {
    text-align: center;
    color: #94a3b8;
    padding: 24px;
    font-style: italic;
}

/* ==========================================================================
   3. Hub & Card Memoriali
   ========================================================================== */

.cw-memorial-hub-card {
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid #e2e8f0;
}

.cw-memorial-hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.cw-hub-card-media {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #f1f5f9;
}

.cw-hub-card-media img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

.cw-memorial-hub-card:hover .cw-hub-card-media img {
    transform: scale(1.03);
}

.cw-hub-card-media-placeholder {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    color: #94a3b8;
    position: relative;
}

.cw-badge-candle-active {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 2;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fef3c7;
    border: 1px solid rgba(245, 158, 11, 0.5);
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    line-height: 1;
}

@keyframes cwCandlePulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.7));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 6px rgba(251, 191, 36, 1));
    }
}

.cw-candle-svg {
    animation: cwCandlePulse 2.4s infinite ease-in-out;
}

.cw-hub-snippet {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 8px 0;
}

/* ==========================================================================
   4. Form Caricamento Proprietario
   ========================================================================== */

.cw-submission-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.cw-dropzone {
    border: 2px dashed #cbd5e1 !important;
    background: #f8fafc !important;
    padding: 24px !important;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.cw-dropzone:hover {
    border-color: #2563eb !important;
    background: #eff6ff !important;
}

/* ==========================================================================
   5. Galleria Fotografica & Lightbox (Issue #1)
   ========================================================================== */

.cw-gallery-thumb {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid #e2e8f0;
}

.cw-gallery-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   6. Badge & Banner Servizio Gratuito Onoranze Funebri Marchetti
   ========================================================================== */

.cw-memorial-badge-free {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.cw-memorial-badge-free:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

