/* ==========================================================================
   Newsletter Component - Design Moderno "Big Site"
   Mobile-first, coerente con search-component.css
   ========================================================================== */

/* ===== Container ===== */
.newsletter-box {
    background: linear-gradient(135deg, #fff8f2 0%, #fff 100%);
    border: 1px solid #ffe0c0;
    border-radius: 12px;
    padding: 28px 24px;
    margin: 20px 0;
    text-align: center;
}

/* ===== Header ===== */
.newsletter-box__header {
    margin-bottom: 20px;
}

.newsletter-box__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #ff8d00 0%, #ff6b00 100%);
    border-radius: 50%;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(255, 141, 0, 0.3);
}

.newsletter-box__icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

.newsletter-box__title {
    font-size: 26px;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px;
    line-height: 1.3;
}

.newsletter-box__description {
    font-size: 17px;
    color: #666;
    line-height: 1.5;
    margin: 0;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Form ===== */
.newsletter-box__form {
    margin-top: 20px;
}

.newsletter-box__input-wrapper {
    display: flex;
    max-width: 420px;
    margin: 0 auto;
}

.newsletter-box__input {
    flex: 1;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-right: none;
    border-radius: 8px 0 0 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
    min-height: 52px;
    box-sizing: border-box;
}

.newsletter-box__input:focus {
    border-color: #ff8d00;
    box-shadow: 0 0 0 3px rgba(255, 141, 0, 0.15);
}

.newsletter-box__input::placeholder {
    color: #999;
}

.newsletter-box__btn {
    padding: 14px 24px;
    border-radius: 0 8px 8px 0;
    background: #ff8d00;
    border: 2px solid #ff8d00;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
    min-height: 52px;
    box-sizing: border-box;
}

.newsletter-box__btn:hover,
.newsletter-box__btn:focus {
    background: #e67e00;
    border-color: #e67e00;
    color: #fff;
}

.newsletter-box__btn:active {
    transform: scale(0.98);
}

.newsletter-box__btn:disabled {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

.newsletter-box__btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Spinner CSS */
.newsletter-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: newsletter-spin 0.8s linear infinite;
}

@keyframes newsletter-spin {
    to { transform: rotate(360deg); }
}

/* ===== Privacy Discreto ===== */
.newsletter-box__privacy {
    margin-top: 14px;
    font-size: 11pt;
    color: #888;
    margin-bottom: 0;
}

.newsletter-box__privacy a {
    color: #ff8d00;
    text-decoration: none;
    font-weight: 500;
}

.newsletter-box__privacy a:hover {
    text-decoration: underline;
}

/* ===== Success State ===== */
.newsletter-box__success {
    display: none;
    padding: 20px;
    text-align: center;
}

.newsletter-box__success.show {
    display: block;
}

.newsletter-box__success-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.newsletter-box__success-icon svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.newsletter-box__success-text {
    font-size: 16px;
    font-weight: 600;
    color: #28a745;
    margin: 0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 576px) {
    .newsletter-box {
        padding: 24px 18px;
        border-radius: 10px;
    }

    .newsletter-box__icon {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }

    .newsletter-box__icon svg {
        width: 20px;
        height: 20px;
    }

    .newsletter-box__title {
        font-size: 22px;
    }

    .newsletter-box__description {
        font-size: 15px;
    }

    .newsletter-box__input-wrapper {
        flex-direction: column;
    }

    .newsletter-box__input {
        border-radius: 8px;
        border-right: 2px solid #ddd;
        margin-bottom: 12px;
    }

    .newsletter-box__input:focus {
        border-right-color: #ff8d00;
    }

    .newsletter-box__btn {
        border-radius: 8px;
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .newsletter-box {
        padding: 26px 20px;
    }

    .newsletter-box__title {
        font-size: 20px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.newsletter-box__input:focus-visible,
.newsletter-box__btn:focus-visible {
    outline: 2px solid #ff8d00;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .newsletter-box__input,
    .newsletter-box__btn {
        transition: none;
    }
}

/* Screen reader only */
.newsletter-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Newsletter Modal Popup
   ========================================================================== */

.newsletter-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.newsletter-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.newsletter-modal {
    background: linear-gradient(135deg, #fff8f2 0%, #fff 100%);
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 520px;
    width: 90%;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    text-align: center;
    box-sizing: border-box;
}

.newsletter-modal-overlay.active .newsletter-modal {
    transform: scale(1) translateY(0);
}

/* Input wrapper dentro modale non deve mai uscire */
.newsletter-modal .newsletter-box__input-wrapper {
    max-width: 100%;
}

.newsletter-modal .newsletter-box__input {
    min-width: 0;
}

.newsletter-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.newsletter-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Responsive modale */
@media (max-width: 576px) {
    .newsletter-modal {
        padding: 24px 20px;
        margin: 16px;
        width: calc(100% - 32px);
    }

    .newsletter-modal .newsletter-box__input-wrapper {
        flex-direction: column;
    }

    .newsletter-modal .newsletter-box__input {
        border-radius: 8px;
        border-right: 2px solid #ddd;
        margin-bottom: 12px;
    }

    .newsletter-modal .newsletter-box__input:focus {
        border-right-color: #ff8d00;
    }

    .newsletter-modal .newsletter-box__btn {
        border-radius: 8px;
        width: 100%;
    }
}
