/* ===================================================================
   MODAL PADRÃO RENTMTM  (SP20-026 / SP20-036 / SP20-042)
   -------------------------------------------------------------------
   Componente único de mensagem/confirmação. Substitui os alert() e
   confirm() nativos do navegador, que apareciam com o domínio cru
   ("rentmtm.shop diz — Clear entire cart?") e não seguiam o visual da
   plataforma.

   A linguagem visual reaproveita a do .custom-modal-content já usada na
   tela registerDetailsAndId (mesmo gradiente, raio e sombra), mas aqui
   fica num arquivo próprio para poder ser carregada em TODAS as telas.
   =================================================================== */

.mtm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.mtm-modal-overlay.is-open {
    display: flex;
    animation: mtmModalFadeIn 0.2s ease-in-out;
}

@keyframes mtmModalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.mtm-modal {
    background: linear-gradient(180deg, #ffffff, #f0f0f0, #d4d4d4);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    padding: 24px;
    width: 100%;
    max-width: 460px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: mtmModalPop 0.2s ease-in-out;
}

@keyframes mtmModalPop {
    from { transform: scale(0.96); }
    to   { transform: scale(1); }
}

.mtm-modal__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0b2a5b;
    text-align: center;
}

.mtm-modal__message {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    text-align: center;
}

.mtm-modal__actions {
    margin-top: 8px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.mtm-modal__btn {
    flex: 1 1 130px;
    min-height: 44px; /* alvo de toque acessível */
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.mtm-modal__btn--confirm {
    background-color: #0d6efd;
    color: #fff;
}

.mtm-modal__btn--confirm:hover {
    background-color: #0b5ed7;
}

.mtm-modal__btn--cancel {
    background-color: #e0e0e0;
    color: #333;
}

.mtm-modal__btn--cancel:hover {
    background-color: #d0d0d0;
}

.mtm-modal__btn--danger {
    background-color: #dc3545;
    color: #fff;
}

.mtm-modal__btn--danger:hover {
    background-color: #bb2d3b;
}

/* Bloqueia o scroll do fundo enquanto a modal está aberta */
body.mtm-modal-open {
    overflow: hidden;
}

/* -------------------------------------------------------------------
   Tema escuro. O marketplace troca de tema via body[data-theme="dark"]
   (theme.js) e também servindo dark.css direto no primeiro render — por
   isso as duas âncoras abaixo. Sem isto a modal aparecia branca sobre a
   tela escura.
   ------------------------------------------------------------------- */
body[data-theme="dark"] .mtm-modal {
    background: linear-gradient(180deg, #2b2b2b, #1f1f1f);
}

body[data-theme="dark"] .mtm-modal__title {
    color: #6ea8fe;
}

body[data-theme="dark"] .mtm-modal__message {
    color: #e6e6e6;
}

body[data-theme="dark"] .mtm-modal__btn--cancel {
    background-color: #444;
    color: #f0f0f0;
}

body[data-theme="dark"] .mtm-modal__btn--cancel:hover {
    background-color: #555;
}

@media (max-width: 480px) {
    .mtm-modal {
        padding: 20px 16px;
    }

    .mtm-modal__actions {
        flex-direction: column-reverse; /* ação primária fica embaixo, ao alcance do polegar */
    }

    .mtm-modal__btn {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* ===================================================================
   EXTENSÕES PARA MODAIS DECLARADAS NO HTML  (SP20-046 / SP20-047)
   -------------------------------------------------------------------
   A busca e a seleção de endereço do mobile não caem no formato
   message/confirm (têm formulário e lista), então declaram o markup na
   própria página reaproveitando .mtm-modal-overlay / .mtm-modal.
   =================================================================== */

.mtm-modal__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mtm-modal__input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #aaa;
    border-radius: 8px;
    /* 16px evita o zoom automático do input no Safari iOS */
    font-size: 16px;
    color: #222;
    background: #fff;
}

.mtm-modal__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 45vh;
    overflow-y: auto;
}

.mtm-modal__list-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.mtm-modal__list-btn:hover {
    background: #f0f0f0;
}

/* Endereço padrão em uso. Sem esta marca a modal parecia uma lista sem nada
   selecionado, e o usuário não sabia para onde a compra iria. Ele não é
   clicável (é um <div>, não <button>): redefinir o que já é padrão não faz
   nada, e um clique sem efeito passa a impressão de que a tela travou. */
.mtm-modal__list-btn.is-current {
    border-color: #0B93F2;
    box-shadow: inset 0 0 0 1px #0B93F2;
    background: #eaf5ff;
    color: #0a3d62;
    cursor: default;
    font-weight: 600;
}

.mtm-modal__badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: #0B93F2;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

body[data-theme="dark"] .mtm-modal__list-btn.is-current {
    background: #10344f;
    border-color: #0B93F2;
    color: #d6ecff;
}

/* Botão de ação que é link (<a>) precisa parecer botão. */
a.mtm-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

body[data-theme="dark"] .mtm-modal__input,
body[data-theme="dark"] .mtm-modal__list-btn {
    background: #333;
    border-color: #555;
    color: #f0f0f0;
}

body[data-theme="dark"] .mtm-modal__list-btn:hover {
    background: #444;
}

/* ===================================================================
   BARRA DE AÇÕES DO HEADER MOBILE  (SP20-046 / 047 / 048 / 049)
   -------------------------------------------------------------------
   Uma única linha com lupa, localização, carrinho e hambúrguer; abaixo
   dela, apenas o Categories centralizado. Substitui o empilhamento de
   busca larga + "Select Address" + carrinho que consumia a viewport.
   =================================================================== */

.mtm-mobile-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.mtm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* 44px = alvo de toque acessível */
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 20px;
    text-decoration: none;
    cursor: pointer;
}

.mtm-icon-btn:hover,
.mtm-icon-btn:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    outline: none;
}

.mtm-icon-btn .navbar-toggler-icon {
    width: 22px;
    height: 22px;
}

/* O badge do carrinho acompanha o ícone novo. */
.mtm-cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background-color: #0b93f2;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
}

@media only screen and (max-width: 991px) {
    /* SP20-046/047: busca inline e dropdown de endereço saem do header —
       agora vivem nas modais abertas pelos ícones. */
    .navbar .navbar-collapse form.d-flex,
    .navbar .navbar-collapse .mtm-address-dropdown {
        display: none !important;
    }

    /* SP20-058: a área direita do header inteira sai do menu — carrinho,
       "Hi there, <email>" e o link **Login**.

       O menu de 3 barras passa a ter só Categories. Login continua a um
       toque de distância em dois lugares: o ícone de pessoa, ao lado do
       hambúrguer, e "Login and Signup" na drawer. Tê-lo também aqui dava
       três caminhos para a mesma tela e enchia o menu.

       Esconder o contêiner (e não item por item) evita que a próxima ação
       adicionada à área direita reapareça sozinha no menu. */
    .navbar .navbar-collapse > .d-flex.align-items-center {
        display: none !important;
    }

    /* SP20-048: abaixo da linha de ícones fica só o Categories, centralizado. */
    .navbar .navbar-collapse .navbar-nav {
        width: 100%;
        justify-content: center;
    }

    .navbar .navbar-collapse #categoriesDropdown {
        margin-left: 0 !important;
        text-align: center;
    }
}
