/**
* 2007-2022 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author    PrestaShop SA <contact@prestashop.com>
*  @copyright 2007-2022 PrestaShop SA
*  @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*
* Don't forget to prefix your containers with your own identifier
* to avoid any conflicts with others containers.
*/

/**
 * Notifications drawer — pede WhatsApp (prioritário) ou email para avisar o
 * cliente de reentrada de stock / queda de preço. Tudo com prefixo `ntf-` para
 * não colidir com o tema. Drawer lateral no desktop, bottom-sheet no telemóvel.
 */

/* ---- Trigger em TEXTO (página de produto, acima da quantidade) ---- */
.ntf-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: -6px 0 10px;
    padding: 10px 0;
    border-radius: 10px;
    background: transparent;
    color: #111827;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: color 0.15s ease;
}
.ntf-trigger:hover {
    text-decoration: underline;
}
.ntf-trigger:focus-visible {
    outline: none;
    text-decoration: underline;
}
.ntf-trigger svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* ---- Overlay + estrutura ---- */
.ntf-drawer {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    justify-content: flex-end;
    font-family: inherit;
}
.ntf-drawer * { box-sizing: border-box; }

.ntf-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.ntf-drawer.is-open .ntf-drawer__overlay { opacity: 1; }

.ntf-drawer__panel {
    position: relative;
    width: 420px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
}
.ntf-drawer.is-open .ntf-drawer__panel { transform: translateX(0); }

/* ---- Botão fechar ---- */
.ntf-drawer__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: #4b5563;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
    z-index: 2;
}
.ntf-drawer__close:hover { background: rgba(0, 0, 0, 0.1); }

/* ---- Cabeçalho (produto) ---- */
.ntf-drawer__head {
    padding: 26px 24px 18px;
    border-bottom: 1px solid #f1f1f4;
}
.ntf-drawer__question {
    margin: 0 0 16px;
    padding-right: 40px; /* deixa espaço para o botão de fechar (canto sup. dir.) */
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}
.ntf-drawer__product-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #f1f1f4;
    border-radius: 12px;
}
.ntf-drawer__img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}
.ntf-drawer__product {
    margin: 0;
    font-size: 13.5px;
    font-weight: 600;
    color: #374151;
    line-height: 1.35;
}

/* ---- Corpo ---- */
.ntf-drawer__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 20px 24px 26px;
}
/* O formulário preenche a altura e distribui as secções de cima a baixo
   (botão de submit ancorado ao fundo). Em overflow, os espaços colapsam e
   o painel faz scroll normalmente. */
.ntf-drawer__body > form {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ---- Rótulo de secção ---- */
.ntf-section-label {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 700;
    color: #111827;
}
/* O label do canal e o toggle são um só bloco, para o space-between do
   formulário não abrir espaço entre eles. */
.ntf-channel .ntf-tabs {
    margin-bottom: 0;
}

/* ---- Limiar do alerta de preço ---- */
.ntf-threshold {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f1f4;
}
.ntf-th-opts {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.ntf-th-opt {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 13px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.ntf-th-opt:hover {
    border-color: #d1d5db;
}
.ntf-th-opt input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    accent-color: #25d366;
}
.ntf-th-opt:has(input:checked) {
    border-color: #25d366;
    background: #f0fdf4;
}
.ntf-th-opt__price {
    font-size: 14.5px;
    font-weight: 700;
    color: #111827;
}
.ntf-th-opt__label {
    font-size: 13.5px;
    color: #374151;
}
.ntf-th-opt__badge {
    margin-left: auto;
    padding: 3px 11px;
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    font-size: 12px;
    font-weight: 700;
}
.ntf-th-opt--custom {
    flex-wrap: wrap;
}
.ntf-th-custom {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ntf-th-custom__input {
    width: 84px;
    height: 34px;
    padding: 0 9px;
    text-align: right;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}
.ntf-th-custom__input:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}
.ntf-th-custom__input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
}
.ntf-th-custom__cur {
    font-size: 14px;
    font-weight: 700;
    color: #374151;
}

/* ---- Tabs ---- */
.ntf-tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: #f3f4f6;
    border-radius: 12px;
    margin-bottom: 16px;
}
.ntf-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 8px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
}
.ntf-tab svg { width: 17px; height: 17px; }
.ntf-tab:hover { color: #374151; }
.ntf-tab.is-active {
    background: #fff;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.ntf-tab[data-tab="whatsapp"].is-active { color: #1d8a4e; }

/* ---- Panes ---- */
.ntf-pane { display: none; }
.ntf-pane.is-active { display: block; }

/* ---- Campos ---- */
.ntf-field { display: block; margin-bottom: 16px; }
.ntf-field__label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}
.ntf-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ntf-input:focus {
    outline: none;
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}
.ntf-pane[data-pane="email"] .ntf-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Telefone com prefixo +351 */
.ntf-phone {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ntf-phone:focus-within {
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}
.ntf-phone__cc {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: #f9fafb;
    border-right: 1.5px solid #e5e7eb;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}
.ntf-phone .ntf-input {
    border: 0;
    border-radius: 0;
    height: 46px;
}
.ntf-phone .ntf-input:focus { box-shadow: none; }

/* ---- Consentimento ---- */
.ntf-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 4px 0 18px;
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.45;
    cursor: pointer;
}
.ntf-consent input {
    margin: 2px 0 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: #25d366;
}
.ntf-consent a { color: inherit; text-decoration: underline; }

/* ---- Botão submeter ---- */
.ntf-submit {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 11px;
    background: #25d366;
    color: #fff;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: background 0.15s ease, transform 0.05s ease;
}
.ntf-submit svg { width: 19px; height: 19px; }
.ntf-submit:hover { background: #1eb857; }
.ntf-submit:active { transform: scale(0.99); }
.ntf-submit:disabled { opacity: 0.65; cursor: default; }
.ntf-drawer[data-channel="email"] .ntf-submit { background: #2563eb; }
.ntf-drawer[data-channel="email"] .ntf-submit:hover { background: #1d4ed8; }

.ntf-hint {
    margin: 14px 0 0;
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    line-height: 1.4;
}

/* ---- (i) inline com tooltip ---- */
.ntf-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #9ca3af;
    cursor: help;
}
.ntf-info svg { width: 14px; height: 14px; flex-shrink: 0; }
.ntf-info:hover { color: #6b7280; }
.ntf-info__tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: 260px;
    max-width: 78vw;
    padding: 13px 15px;
    background: #111827;
    color: #fff;
    border-radius: 11px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    gap: 9px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.35;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 5;
}
.ntf-info__tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #111827;
}
.ntf-info__tip span {
    position: relative;
    padding-left: 20px;
}
.ntf-info__tip span::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    color: #4ade80;
    font-weight: 700;
}
.ntf-info:hover .ntf-info__tip,
.ntf-info:focus .ntf-info__tip,
.ntf-info:focus-within .ntf-info__tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ---- Erro ---- */
.ntf-error {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 9px;
    color: #b91c1c;
    font-size: 13px;
}

/* ---- Sucesso ---- */
.ntf-success {
    padding: 40px 24px;
    text-align: center;
}
.ntf-success__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ntf-success__icon svg { width: 32px; height: 32px; }
.ntf-success h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}
.ntf-success p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* ---- Bottom-sheet no telemóvel ---- */
@media (max-width: 640px) {
    .ntf-drawer { align-items: flex-end; justify-content: center; }
    .ntf-drawer__panel {
        width: 100%;
        height: auto;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
    }
    .ntf-drawer.is-open .ntf-drawer__panel { transform: translateY(0); }
    .ntf-drawer__panel::before {
        content: "";
        position: absolute;
        top: 9px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        border-radius: 3px;
        background: #d1d5db;
        z-index: 2;
    }
    .ntf-drawer__head { padding-top: 30px; }
}

/* Bloqueia scroll do body enquanto o drawer está aberto */
body.ntf-lock { overflow: hidden; }
