/**
 * NotifyWise Divi Edition - Frontend Styles
 * Ottimizzato per integrazione con tema Divi
 */

/* ============================================
   BOTTONE NOTIFICA - Stili Base
   ============================================ */
.notifywise-divi-button {
    display: inline-block;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Stile Default */
body #page-container .et_pb_section button.notifywise-divi-button.notifywise-style-default,
button.notifywise-divi-button.notifywise-style-default {
    color: #FFFFFF !important;
    border: none !important;
    border-width: 0px !important;
    border-radius: 50px !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    background-color: #fdb822 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
}

body #page-container .et_pb_section button.notifywise-divi-button.notifywise-style-default:hover,
button.notifywise-divi-button.notifywise-style-default:hover {
    color: #FFFFFF !important;
    background-color: #fdb822;
    border-radius: 50px !important;
}

/* Stile Minimal */
.notifywise-style-minimal {
    background-color: transparent;
    color: #333333;
    border: 2px solid #333333;
}

.notifywise-style-minimal:hover {
    background-color: #333333;
    color: #ffffff;
}

/* Stile Divi (compatibile con tema Divi) */
.notifywise-style-divi {
    background-color: #2EA3F2;
    color: #ffffff;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 3px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.notifywise-style-divi:hover {
    background-color: rgba(46, 163, 242, 0.8);
}

/* ============================================
   MODAL - Container
   ============================================ */
.notifywise-divi-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483647 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    isolation: isolate;
}

/* Force page content below the modal while open (Divi stacking contexts). */
body.notifywise-modal-open {
    overflow: hidden !important;
}

body.notifywise-modal-open #page-container {
    position: relative !important;
    z-index: 1 !important;
}

body.notifywise-modal-open #page-container,
body.notifywise-modal-open #main-header,
body.notifywise-modal-open #top-header,
body.notifywise-modal-open .et-l--header,
body.notifywise-modal-open .et-l--footer {
    filter: blur(6px);
    transform: translateZ(0);
    pointer-events: none !important;
    user-select: none;
    transition: filter 0.25s ease, opacity 0.25s ease;
}

/*
 * Nasconde tutti gli elementi fixed/sticky di terze parti che restano
 * visibili sopra l'overlay (carrello fluttuante, chat, cookie bar, ecc.).
 * I selettori coprono i plugin più comuni; aggiungi altri se necessario.
 */
body.notifywise-modal-open .woofc-area,
body.notifywise-modal-open #woofc-area,
body.notifywise-modal-open .woofc-icon-area,
body.notifywise-modal-open #woofc-count,
body.notifywise-modal-open .woofc-count,
body.notifywise-modal-open [class*="woofc"],
body.notifywise-modal-open [id*="woofc"],
body.notifywise-modal-open [class*="floating-cart"],
body.notifywise-modal-open [id*="floating-cart"],
body.notifywise-modal-open [class*="sticky-cart"],
body.notifywise-modal-open [class*="side-cart"],
body.notifywise-modal-open [class*="woosq"],
body.notifywise-modal-open .tawkchat-container,
body.notifywise-modal-open #tidio-chat,
body.notifywise-modal-open #tidio-chat-iframe,
body.notifywise-modal-open [id*="tidio"],
body.notifywise-modal-open [id*="crisp"],
body.notifywise-modal-open [class*="crisp"],
body.notifywise-modal-open [id*="tawk"],
body.notifywise-modal-open [class*="tawk"],
body.notifywise-modal-open .cookielaw-banner,
body.notifywise-modal-open #cookie-law-info-bar,
body.notifywise-modal-open .cli-bar-container,
body.notifywise-modal-open .cc-window,
body.notifywise-modal-open #cookie-notice,
body.notifywise-modal-open .cn-container {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.notifywise-modal-open .notifywise-divi-modal {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    z-index: 2147483647 !important;
}

body.notifywise-modal-open .notifywise-divi-modal,
body.notifywise-modal-open .notifywise-divi-modal * {
    pointer-events: auto;
    visibility: visible !important;
    opacity: 1 !important;
}

.notifywise-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 12, 16, 0.72);
    backdrop-filter: blur(10px) saturate(80%);
    -webkit-backdrop-filter: blur(10px) saturate(80%);
    z-index: 2147483646;
}

.notifywise-modal-content {
    position: relative;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 620px;
    width: calc(100vw - 40px);
    max-height: 90vh;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    animation: notifywiseSlideIn 0.3s ease-out;
    z-index: 2147483647;
}

@keyframes notifywiseSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MODAL - Header
   ============================================ */
.notifywise-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifywise-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333333;
}

.notifywise-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notifywise-modal-close:hover {
    background-color: #f5f5f5;
    color: #333333;
}

/* ============================================
   MODAL - Body
   ============================================ */
.notifywise-modal-body {
    padding: 25px;
}

.notifywise-description {
    margin: 0 0 20px 0;
    color: #666666;
    font-size: 14px;
    line-height: 1.6;
}

.notifywise-product-info {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #2EA3F2;
}

.notifywise-product-info strong {
    display: block;
    color: #333333;
    font-size: 15px;
}

/* ============================================
   FORM - Stili
   ============================================ */
.notifywise-subscription-form {
    width: 100%;
}

.notifywise-form-group {
    margin-bottom: 20px;
}

.notifywise-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333333;
    font-size: 14px;
}

.notifywise-form-group label .required {
    color: #e74c3c;
}

.notifywise-form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
    box-sizing: border-box;
}

.notifywise-form-control:focus {
    outline: none;
    border-color: #2EA3F2;
    box-shadow: 0 0 0 3px rgba(46, 163, 242, 0.1);
}

/* ============================================
   FORM - Checkbox GDPR
   ============================================ */
.notifywise-checkbox-group {
    margin-bottom: 20px;
}

.notifywise-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal;
}

.notifywise-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.notifywise-checkbox-label span {
    font-size: 13px;
    color: #666666;
    line-height: 1.5;
}

.notifywise-checkbox-label a {
    color: #2EA3F2;
    text-decoration: underline;
}

/* ============================================
   FORM - Messaggi
   ============================================ */
.notifywise-form-messages {
    margin-bottom: 15px;
}

.notifywise-success-message,
.notifywise-error-message {
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
}

.notifywise-success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notifywise-error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ============================================
   FORM - Bottone Submit
   ============================================ */
.notifywise-form-actions {
    margin-bottom: 0;
}

.notifywise-submit-button {
    width: 100%;
    padding: 14px 30px;
    background-color: #2EA3F2;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifywise-submit-button:hover:not(:disabled) {
    background-color: #0C71C3;
    box-shadow: 0 4px 10px rgba(46, 163, 242, 0.3);
}

.notifywise-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.notifywise-button-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
}

.notifywise-spinner {
    animation: notifywiseSpin 1s linear infinite;
    width: 100%;
    height: 100%;
}

.notifywise-spinner circle {
    stroke: currentColor;
    stroke-dasharray: 80;
    stroke-dashoffset: 60;
}

@keyframes notifywiseSpin {
    100% {
        transform: rotate(360deg);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .notifywise-divi-modal {
        padding: 8px;
    }

    .notifywise-modal-content {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 12px;
        margin: 0;
    }
    
    .notifywise-modal-header,
    .notifywise-modal-body {
        padding: 16px;
    }

    .notifywise-modal-header h3 {
        font-size: 24px;
    }

    .notifywise-modal-close {
        width: 44px;
        height: 44px;
        font-size: 32px;
    }

    .notifywise-form-group {
        margin-bottom: 16px;
    }

    .notifywise-form-control {
        font-size: 16px;
        min-height: 46px;
    }

    .notifywise-checkbox-label span {
        font-size: 14px;
    }

    .notifywise-submit-button {
        min-height: 50px;
        font-size: 16px;
    }
    
    .notifywise-divi-button {
        width: 100%;
        padding: 14px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .notifywise-divi-modal,
    .notifywise-divi-modal * {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.notifywise-hidden {
    display: none !important;
}

.notifywise-fade-in {
    animation: notifywiseFadeIn 0.3s ease-in;
}

@keyframes notifywiseFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   COMPATIBILITÀ DIVI
   ============================================ */
.et_pb_module .notifywise-divi-button {
    font-family: inherit;
}

.et_pb_section .notifywise-divi-container {
    width: 100%;
}

/* Overrides per evitare conflitti con Divi */
.notifywise-divi-modal * {
    box-sizing: border-box;
}
