/* ═══════════════════════════════════════════
   SPB WhatsApp Link Generator — Estilos
   ═══════════════════════════════════════════ */


#spb-wa-wrap,
#spb-wa-wrap *,
#spb-wa-wrap *::before,
#spb-wa-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#spb-wa-wrap {
    font-family: Arial, sans-serif;
    background: #ffffff;
    color: #fff;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

/* ─── CONTAINER ─── */
.container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    max-width: 700px;
    width: 100%;
}

@media (max-width: 680px) {
    .container {
        flex-direction: column;
        align-items: center;
    }
}

/* ─── CARD ─── */
.card {
    width: 350px;
    max-width: 100%;
    background: #1a1a1a;
    padding: 20px !important;
    border-radius: 12px;
}

.card label {
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    margin-bottom: 10px !important;
}

/* ─── PHONE INPUT ─── */
.phone-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.phone-input select,
.phone-input input {
    background: #111;
    border: 1px solid #333;
    padding: 10px;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.phone-input select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23999' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 26px;
    width: 80px;
    /* Tamanho fixo para não espremer o campo do telefone */
    flex-shrink: 0;
    height: 30px;
}

.phone-input input {
    flex: 1;
    width: 100%;
    min-width: 100px;
    min-height: 25px;
    display: block;
}

.phone-input select:focus,
.phone-input input:focus {
    border-color: #e60000 !important;
}

/* ─── MSG HEADER ─── */
.msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px !important;
}

.msg-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai {
    color: red;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: opacity .2s;
}

.ai:hover {
    opacity: .8;
}

.ai[disabled] {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
}

.counter {
    font-size: 12px;
    color: #888;
}

.counter.limit {
    color: #ff4444;
}

/* ─── TEXTAREA ─── */
#spb-wa-wrap textarea {
    width: 100%;
    height: 100px;
    margin: 10px 0;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    padding: 10px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    line-height: 1.5;
}

#spb-wa-wrap textarea:focus {
    border-color: #e60000;
}

#spb-wa-wrap textarea::placeholder {
    color: #666;
}

/* ─── EMOJI ─── */
.emoji-wrap {
    position: relative;
    margin-bottom: 15px !important;
    margin-top: 10px;
}

.emoji {
    background: #222;
    border: none;
    padding: 10px !important;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: background .2s;
}

.emoji:hover {
    background: #333;
}

/* Picker Popup */
.emoji-picker {
    display: none;
    position: absolute;
    top: 44px;
    left: 0;
    z-index: 500;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
    width: 270px;
}

.emoji-picker.open {
    display: block;
}

.emoji-picker input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    padding: 8px 10px;
    margin-bottom: 8px;
    outline: none;
    font-size: 13px;
    font-family: inherit;
}

.emoji-picker input:focus {
    border-color: #e60000;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    max-height: 170px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

.emoji-grid button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    padding: 4px;
    line-height: 1;
    transition: background .12s;
}

.emoji-grid button:hover {
    background: #333;
}

/* ─── BOTÃO PRINCIPAL ─── */
.btn {
    width: 100%;
    background: red;
    border: none;
    padding: 15px !important;
    border-radius: 10px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    font-family: inherit;
    transition: background .2s, transform .15s;
}

.btn:hover:not(:disabled) {
    background: #cc0000;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}

/* ─── SPINNER ─── */
@keyframes spb-spin {
    to {
        transform: rotate(360deg);
    }
}

.spb-spin {
    display: inline-block;
    animation: spb-spin .85s linear infinite;
}

/* ═══════════════════════════════════════════
   PHONE (PREVIEW)
   ═══════════════════════════════════════════ */
.phone {
    width: 260px;
    height: 520px;
    background: #ece5dd;
    border: 8px solid #1f2937;
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

.top {
    background: #075e54;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    height: 60px;
    /* Altura do verde */
}


.top img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.top strong {
    display: block;
    font-size: 14px;
}

.top span {
    display: block;
    font-size: 12px;
    color: #d4f8e8;
}

.chat {
    flex: 1;
    padding: 15px;
    background-color: #ece5dd;
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-size: cover;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
}

.message {
    background: #ffffff;
    /* Fundo branco para mensagem recebida (padrão WhatsApp) */
    padding-left: 10px !important;
    /*padding: 10px;*/
    border-radius: 0 10px 10px 10px;
    /* Bico virado para a esquerda */
    max-width: 90%;
    align-self: flex-start;
    /* Alinhado à esquerda */
    color: #111;
    font-size: 15px !important;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
}

.message p {
    margin: 0;
}

.message em {
    display: block;
    font-style: normal;
    font-size: 10px;
    color: #999;
    text-align: left;
}


.bottom {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 10px 10px 10px !important;
    /* Margem esquerda de 30px para a barra e o texto respirar */
    background: #f0f0f0;
    gap: 12px;
}

.bottom input {
    flex: 1;
    border: none;
    padding: 0 16px !important;
    height: 44px !important;
    border-radius: 22px !important;
    font-size: 14px !important;
    font-family: inherit;
    outline: none !important;
    color: #4a4a4a;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    width: 100%;
}

.bottom input::placeholder {
    color: #8c8c8c;
}

.bottom button {
    border: none;
    background: #25d366;
    color: white;
    border-radius: 50%;
    width: 44px !important;
    height: 44px !important;
    font-size: 18px !important;
    cursor: default;
    flex-shrink: 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
    margin: 0 !important;
    /* Remove qualquer margem direita estranha */
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.spb-wa-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    backdrop-filter: blur(4px);
    z-index: 99999;
    overflow-y: auto;
    padding: 5vh 16px;
}

.spb-wa-modal-overlay.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.spb-wa-modal-box {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
    color: #fff;
    font-family: Arial, sans-serif;
    animation: spb-modal-in .3s ease;
}

@keyframes spb-modal-in {
    from {
        opacity: 0;
        transform: scale(.94) translateY(16px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.spb-wa-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    background: #333;
    border: none;
    border-radius: 50%;
    color: #aaa;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
}

.spb-wa-modal-close:hover {
    background: red;
    color: #fff;
}

.spb-wa-modal-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 0, 0, .1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 24px;
}

.spb-wa-modal-box h3 {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.spb-wa-modal-sub {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-bottom: 20px;
}

.spb-wa-link-box {
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    word-break: break-all;
    color: #fff;
    margin-bottom: 12px;
}

.copy-btn {
    margin-bottom: 20px;
}

.spb-wa-qr-section {
    border-top: 1px solid #333;
    padding-top: 20px;
    text-align: center;
}

.spb-wa-qr-section>p {
    font-size: 14px;
    color: #999;
    margin-bottom: 12px;
}

.spb-wa-qr-box {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
}

.spb-wa-qr-logo {
    position: absolute;
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 4px;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spb-wa-qr-logo img {
    width: 100%;
    height: 100%;
}

.dl-btn {
    background: #333;
    margin-bottom: 8px;
}

.dl-btn:hover:not(:disabled) {
    background: #444;
}

.close-txt {
    width: 100%;
    padding: 10px;
    background: none;
    border: none;
    color: #999;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: color .2s;
}

.close-txt:hover {
    color: #fff;
}

/* ═══════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════ */
#spb-wa-toasts {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.spb-wa-toast {
    background: #1a1a1a;
    color: #fff;
    border: 1px solid #333;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: Arial, sans-serif;
    animation: spb-toast-in .3s ease;
}

.spb-wa-toast.error {
    background: #7f1d1d;
    border-color: #991b1b;
}

@keyframes spb-toast-in {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spb-toast-out {
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}