/**
 * LICENCE
 *
 * ALL RIGHTS RESERVED.
 * YOU ARE NOT ALLOWED TO COPY/EDIT/SHARE/WHATEVER.
 *
 *  @author    Jan Kołodziej (contact@modules4presta.io)
 *  @copyright modules4presta.io
 *  @license   ALL RIGHTS RESERVED
 */

/* Paleta sklepu — ta sama, co w custom/checkout-opc.scss:
   akcent #FF6B00, hover #cc5500, ink #1D1D1B, obramowania #e5e5e3. */
:root {
    --m4p-nl-accent: #ff6b00;
    --m4p-nl-accent-hover: #cc5500;
    --m4p-nl-dark: #1d1d1b;
    --m4p-nl-muted: #6b6b66;
    --m4p-nl-border: #e5e5e3;
    --m4p-nl-tint: #fff7f0;
    --m4p-nl-tint-strong: #fff1e6;
}

/* ------------------------------------------------------------------ */
/* Sekcja                                                              */
/* ------------------------------------------------------------------ */

/* Sekcja siedzi w STOPCE (`#footer-container-main`, pierwszy wiersz) — czarne
   tło motywu, jasny tekst. Bez własnego tła i ramki, żeby wtopiła się w resztę
   stopki. Styl nagłówka skopiowany z `.block-title` motywu
   (_dev/css/components/footers.scss), żeby stał w jednej linii z „Informacje",
   „Kontakt" itd. */
.m4p-newsletter-section {
    margin: 0 0 32px;
    padding: 0 16px;
    border: 0;
    background: none;
}

.m4p-newsletter-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 32px;
}

.m4p-newsletter-intro {
    flex: 1 1 340px;
    min-width: 260px;
}

.m4p-newsletter-title {
    color: var(--m4p-nl-dark);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 10px;
}

.m4p-newsletter-subtitle {
    color: var(--m4p-nl-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
}

.m4p-newsletter-section .m4p-newsletter-form {
    flex: 1 1 420px;
    min-width: 280px;
}

/* ------------------------------------------------------------------ */
/* Formularz (wspólny dla sekcji i popupu)                             */
/* ------------------------------------------------------------------ */

.m4p-newsletter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.m4p-newsletter-input {
    flex: 1 1 220px;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--m4p-nl-border);
    border-radius: 10px;
    background: #fff;
    color: var(--m4p-nl-dark);
    font-size: 0.95rem;
}

.m4p-newsletter-input:focus {
    border-color: var(--m4p-nl-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.18);
}

.m4p-newsletter-btn {
    position: relative;
    flex: 0 0 auto;
    height: 46px;
    min-width: 150px;
    padding: 0 24px;
    border: 0;
    border-radius: 10px;
    background: var(--m4p-nl-accent);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.m4p-newsletter-btn:hover:not(:disabled) {
    background: var(--m4p-nl-accent-hover);
}

.m4p-newsletter-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.m4p-newsletter-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: m4p-nl-spin 0.7s linear infinite;
}

.m4p-newsletter-form.is-loading .m4p-newsletter-btn-label {
    visibility: hidden;
}

.m4p-newsletter-form.is-loading .m4p-newsletter-spinner {
    display: block;
}

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

.m4p-newsletter-consent {
    margin-top: 14px;
}

.m4p-newsletter-consent label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0;
    color: var(--m4p-nl-muted);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.45;
    cursor: pointer;
}

.m4p-newsletter-consent input[type='checkbox'] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--m4p-nl-accent);
    cursor: pointer;
}

.m4p-newsletter-legal {
    margin: 10px 0 0;
    color: var(--m4p-nl-muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.m4p-newsletter-msg {
    display: none;
    margin-top: 14px;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 0.875rem;
    line-height: 1.45;
}

.m4p-newsletter-msg.is-success {
    background: #e7f6ec;
    border: 1px solid #b7e2c4;
    color: #1e6b38;
}

.m4p-newsletter-msg.is-error {
    background: #fdecea;
    border: 1px solid #f5c2be;
    color: #a3261d;
}

/* reCAPTCHA wstrzykiwana przez m4precaptchanewsletter */
.m4p-newsletter-form .m4p-recaptcha-wrap {
    margin-top: 14px;
}

/* ------------------------------------------------------------------ */
/* Sekcja w stopce — wersja na ciemnym tle                             */
/* Wszystko scope'owane pod `.m4p-newsletter-section`, bo popup dzieli */
/* te same klasy formularza i musi zostać jasny.                       */
/* ------------------------------------------------------------------ */

.m4p-newsletter-section .m4p-newsletter-inner {
    gap: 24px 40px;
}

/* Nagłówek zbudowany jak `.block-title` pozostałych kolumn stopki (ta sama
   ramka, wersaliki, waga), ale ŚWIADOMIE większy: 16px zamiast 13px —
   newsletter ma się wybijać z rzędu nagłówków stopki (decyzja 2026-08-03).
   Reszta stopki żyje w `_dev/css/components/footers.scss:170`; jeśli kiedyś
   wyrównujesz nagłówki z powrotem, zmieniaj OBA miejsca. */
.m4p-newsletter-section .m4p-newsletter-title {
    margin: 0 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    line-height: 1.3;
}

.m4p-newsletter-section .m4p-newsletter-subtitle,
.m4p-newsletter-section .m4p-newsletter-consent label,
.m4p-newsletter-section .m4p-newsletter-legal {
    color: #c4c4c1;
}

/* Teksty sekcji są większe niż nagłówek (13px), bo nagłówek trzyma rozmiar
   `.block-title` pozostałych kolumn stopki i nie może się od nich odkleić —
   czytelność dokładamy w treści, nie w tytule. */
.m4p-newsletter-section .m4p-newsletter-subtitle {
    font-size: 15px;
    line-height: 1.55;
}

.m4p-newsletter-section .m4p-newsletter-consent label {
    font-size: 14px;
    line-height: 1.5;
}

.m4p-newsletter-section .m4p-newsletter-input,
.m4p-newsletter-section .m4p-newsletter-btn {
    font-size: 15px;
}

.m4p-newsletter-section .m4p-newsletter-input {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.m4p-newsletter-section .m4p-newsletter-input::placeholder {
    color: #8f8f8b;
}

.m4p-newsletter-section .m4p-newsletter-input:focus {
    border-color: var(--m4p-nl-accent);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.25);
}

.m4p-newsletter-section .m4p-newsletter-legal {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.8;
}

/* Komunikaty na ciemnym tle — przygaszone, żeby nie krzyczały ze stopki. */
.m4p-newsletter-section .m4p-newsletter-msg.is-success {
    background: rgba(46, 125, 50, 0.16);
    border-color: rgba(122, 205, 132, 0.4);
    color: #a5e0ad;
}

.m4p-newsletter-section .m4p-newsletter-msg.is-error {
    background: rgba(211, 47, 47, 0.16);
    border-color: rgba(245, 194, 190, 0.4);
    color: #f3aaa4;
}

/* ------------------------------------------------------------------ */
/* Popup                                                               */
/* ------------------------------------------------------------------ */

.m4p-newsletter-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.m4p-newsletter-popup.is-open {
    opacity: 1;
}

.m4p-newsletter-popup[hidden] {
    display: none;
}

.m4p-newsletter-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 20, 26, 0.62);
}

.m4p-newsletter-popup-dialog {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 36px 32px 30px;
    border-radius: 14px;
    border-top: 4px solid var(--m4p-nl-accent);
    background: #fff;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
    text-align: center;
    transform: translateY(14px);
    transition: transform 0.25s ease;
}

.m4p-newsletter-popup.is-open .m4p-newsletter-popup-dialog {
    transform: translateY(0);
}

.m4p-newsletter-popup-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--m4p-nl-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.m4p-newsletter-popup-close:hover {
    color: var(--m4p-nl-dark);
}

.m4p-newsletter-popup-logo {
    margin-bottom: 18px;
}

.m4p-newsletter-popup-logo img {
    max-width: 200px;
    max-height: 70px;
    height: auto;
}

.m4p-newsletter-popup-title {
    margin: 0 0 10px;
    color: var(--m4p-nl-dark);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.25;
}

.m4p-newsletter-popup-subtitle {
    margin: 0 0 20px;
    color: var(--m4p-nl-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.m4p-newsletter-popup .m4p-newsletter-consent label,
.m4p-newsletter-popup .m4p-newsletter-legal {
    text-align: left;
}

.m4p-newsletter-popup .m4p-recaptcha-wrap > div {
    display: flex;
    justify-content: center;
}

/* Wariant dwukolumnowy: formularz z lewej, grafika z prawej                */

.m4p-newsletter-popup-dialog--split {
    display: flex;
    align-items: stretch;
    max-width: 860px;
    padding: 0;
    overflow: hidden;
}

.m4p-newsletter-popup-dialog--split .m4p-newsletter-popup-body {
    flex: 1 1 55%;
    min-width: 0;
    padding: 36px 32px 30px;
    max-height: 92vh;
    overflow-y: auto;
}

.m4p-newsletter-popup-media {
    flex: 1 1 45%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

/* `contain`, nie `cover` — grafika ma wtopiony tekst, kadrowanie ucięłoby napis */
.m4p-newsletter-popup-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
}

body.m4p-newsletter-popup-open {
    overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Mobile                                                              */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {
    .m4p-newsletter-section {
        margin: 0 0 24px;
        padding: 0 16px;
    }

    .m4p-newsletter-inner {
        gap: 22px;
    }

    .m4p-newsletter-title {
        font-size: 1.35rem;
    }

    .m4p-newsletter-input,
    .m4p-newsletter-btn {
        flex: 1 1 100%;
        min-width: 0;
    }

    .m4p-newsletter-popup-dialog {
        padding: 32px 20px 24px;
    }

    .m4p-newsletter-popup-dialog--split {
        display: block;
        padding: 0;
        max-height: 92vh;
        overflow-y: auto;
    }

    .m4p-newsletter-popup-dialog--split .m4p-newsletter-popup-body {
        padding: 24px 20px 24px;
        max-height: none;
        overflow: visible;
    }

    /* Na mobile grafika ląduje pod formularzem, przycięta do rozsądnej wysokości */
    .m4p-newsletter-popup-dialog--split .m4p-newsletter-popup-media img {
        max-height: 30vh;
    }
}
