.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: none;
}

.modal.is-open {
    display: block;
}

.modal .container {
    background: var(--cor-neutra-escura);
    color: var(--cor-neutra-clara);
    display: flex;
    flex-direction: column;
    padding: .5rem 1.2rem;
    height: 100vh;
}

.modal header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal header h2{
    font-weight: 400;
    letter-spacing: 0.1rem;
    margin-bottom: 2rem;
}

.modal header .fechar {
    background-image: url(../assets/imagens/icone_fechar.svg);
    width: 24px;
    height: 24px;
    background-color: transparent;
    border: none;
    cursor: pointer;
}

.th-produto,
.th-total,
.td-produto,
.td-preco-total {
    display: block;
}

tbody td {
    padding: 0.8rem;
    vertical-align: middle;
    background-color: var(--cor-cinza-escura);
    color: var(--cor-roxa-clara);
    letter-spacing: 0.1rem;
}

thead th {
    padding: 0.8rem;
    letter-spacing: 0.1rem;
}


td.td-preco-unitario {
    color: var(--cor-neutra-clara);
    font-size: 0.9rem;
    font-weight: 300;
    white-space: nowrap;
}

td.td-quantidade input {
    width: 48px;
    padding: 4px;
    background-color: transparent;
    border: 1px solid var(--cor-primaria);
    border-radius: 1px soloid var(--cor-primaria);
    color: var(--cor-neutra-clara);
    font-size: 0.9rem;
    text-align: center;
}

td .btn-remover {
    display: block;
    background-image: url(../assets/imagens/icone_deletar.svg);
    width: 24px;
    height: 24px;
    background-color: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    margin: auto;
}

.container-preco {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
}

.total-carrinho {
    background-color: var(--cor-cinza-escura);
    color: var(--cor-neutra-clara);
    width: 100%;
    padding: 1rem 0.5rem;
    font-size: 2rem;
    letter-spacing: 0.1rem;
}

.finalizar-compra {
    background-color: var(--cor-primaria);
    color: var(--cor-neutra-clara);
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    cursor: pointer;
    letter-spacing: 0.1rem;
    transition: background-color 0.3s ease-in-out;
}

.finalizar-compra:hover {
    background-color: var(--cor-primaria-hover);
}

.container-preco-total{
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    font-size: 1rem;
}

#subtotal-pedidos, #valor-frete{
    color: #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#valor-frete{
    display: none;
}

#subtotal-pedidos .valor, #valor-frete .valor{
    color: #6affb7;
    font-weight: 500;
    margin-left: 8px;
}

#total-carrinho{
    color: #6affb7;
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 8px;
    display: block;
    text-align: right;
}

#input-cep{
    padding: 8px 12px;
    width: 100%;
    max-width:220px;
    border: 1px solid #6affb7;
    border-radius: 6px;
    background-color: transparent;
    color: #6affb7;
    font-size: 1rem;
    font-weight: 400;
    outline: none;
    transition: border-color 0.2;
}

#input-cep::placeholder{
    color:#6affb7;
    opacity: 0.5;
    font-weight: 400;
}

#btn-calcular-frete{
    padding: 8px 20px;
    border: 1px solid #6affb7;
    border-radius: 6px;
    background: transparent;
    color: #6affb7;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s color 0.2s;
    outline: none;
}

#btn-calcular-frete:hover, 
#btn-calcular-frete:focus{
    background: #6affb7;
    color:#1a1a2e;
}

.container-cep-frete{
    display: flex;
    flex-direction: column;
    margin: 16px 0;
    gap: 8px;
}

.container-cep-input{
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

@media (max-width: 430px) {
  .modal {
    overflow-y: auto; /* permite scroll do backdrop, caso necessário */
    background-color: rgba(0, 0, 0, 0.75);
  }

  .modal .container {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    height: auto;
    margin: 0;
    padding: 1rem 1rem 2rem;
    box-sizing: border-box;
    border-radius: 0;
  }

  .modal header {
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .modal header h2 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
  }

  .modal header .fechar {
    width: 28px;
    height: 28px;
  }

  .container-preco {
    align-items: stretch;
  }

  .total-carrinho {
    font-size: 1.5rem;
  }

  .finalizar-compra {
    width: 100%;
    font-size: 0.95rem;
  }

  td .btn-remover {
    padding: 0.3rem;
  }

  td.td-quantidade input {
    width: 40px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    width: 100%;
    display: block;
  }
  th, td {
    text-align: left;
    padding: 0.5rem 0.3rem;
  }
  .th-produto, 
  .th-total, 
  .td-produto, 
  .td-preco-total {
    display: block;
  }
}

@media(min-width: 769px) {
    .modal.is-open{
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: rgba(00, 00, 00, 0.8);
    }
   
    .modal .container {
        background-color: var(--cor-cinza-escura);
        max-width: 720px;
        height: auto;
        padding: 1.5rem;
        margin: 0 auto;
    }

    .th-produto,
    .th-total,
    .td-produto,
    .td-preco-total {
        display: table-cell;
    }

    .td-preco-total{
        white-space: nowrap;
        font-size: 1rem;
        color: var(--cor-neutra-clara);
    }

    td img{
        width: 48px;
        height: auto;
        border-radius: 4px;
    }

    .modal .container th{
        background-color: var(--cor-neutra-escura);
    }

    table{
        border-collapse: collapse;
    }

    tbody td{
        border: 2px solid var(--cor-neutra-escura);
    }

    .container-preco{
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }

    .total-carrinho{
        text-align: right;
    }

    .finalizar-compra{
        width: 369px;
    }

    .td-quantidade{
        text-align: center;
    }
    
}

@media (max-width: 720px) {
    .modal.is-open {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.8);
    }

    .modal .container {
        width: 100%;
        max-width: 720px;
        height: auto;
        max-height: calc(100vh - 20px);
        margin: 0.5rem;
        padding: 1rem;
        border-radius: 12px;
        overflow-y: auto;
    }

    .modal header {
        flex-direction: column;
        align-items: start;
        gap: 0.7rem;
    }

    .modal header h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .th-produto,
    .th-total,
    .td-produto,
    .td-preco-total {
        display: table-cell;
    }

    td img {
        width: 40px;
        height: auto;
    }

    .container-preco {
        align-items: stretch;
    }

    .total-carrinho {
        font-size: 1.7rem;
        text-align: right;
    }

    .finalizar-compra {
        width: 100%;
        font-size: 1rem;
    }

    .td-quantidade input {
        width: 44px;
    }
}

@media (max-width: 765px) {
    .modal.is-open {
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.8);
    }

    .modal .container {
        width: 100%;
        max-width: 720px;
        height: auto;
        max-height: calc(100vh - 20px);
        margin: 0.5rem;
        padding: 1rem;
        border-radius: 12px;
        overflow-y: auto;
    }

    .modal header {
        flex-direction: column;
        align-items: start;
        gap: 0.7rem;
    }

    .modal header h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .th-produto,
    .th-total,
    .td-produto,
    .td-preco-total {
        display: table-cell;
    }

    td img {
        width: 40px;
        height: auto;
    }

    .container-preco {
        align-items: stretch;
    }

    .total-carrinho {
        font-size: 1.7rem;
        text-align: right;
    }

    .finalizar-compra {
        width: 100%;
        font-size: 1rem;
    }

    .td-quantidade input {
        width: 44px;
    }
}



