/* =========================
   CONFIGURAÇÕES GERAIS
========================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #deb9ee4d;
    color: #333;
}


/* CABEÇALHO */
header {
    background: linear-gradient(135deg, #67088f, #8d45aa);
    color: white;
    text-align: center;
    padding: 30px 15px;
    box-shadow: 0 4px 14px rgba(103, 8, 143, 0.16);
}

header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

header p {
    font-size: 15px;
    opacity: 0.94;
    line-height: 1.5;
}


/* =========================
   CONTEÚDO PRINCIPAL
========================= */


main {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    padding: 28px;
}


/* =========================
   BARRA DE PESQUISA
========================= */


.barra-pesquisa {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    align-items: stretch;
}

.barra-pesquisa input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: 14px;
    background-color: #ffffff;
}


input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e4d4ec;
    border-radius: 12px;
    font-size: 15px;
    background-color: #fffaff;
    color: #44364b;
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease;
}


input:focus,
select:focus,
textarea:focus {
    border-color: #b985d2;
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.12);
}


/* =========================
   BOTÕES
========================= */

button {
    background-color: hwb(289 83% 2% / 0.8156862745098039);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 15px;
}


#btn-adicionar {
    background: linear-gradient(135deg, #67088f, #8d45aa);
    color: #ffffff;
    border: 1px solid #67088f;
    border-radius: 14px;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(103, 8, 143, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#btn-adicionar:hover {
    background: linear-gradient(135deg, #570579, #793594);
    box-shadow: 0 6px 14px rgba(103, 8, 143, 0.25);
    transform: translateY(-2px);
}


/* =========================
   FILTROS
========================= */

.filtros {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: stretch;
}

.filtros select {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 14px;
    background-color: #fffaff;
    cursor: pointer;
}



/* =========================
   RESUMO
========================= */

.resumo {
    display: flex;
    gap: 16px;
    margin-bottom: 26px;
}

.resumo div {
    background: linear-gradient(145deg, #ffffff, #fbf5ff);
    padding: 22px 16px;
    border: 1px solid #eadcf2;
    border-radius: 18px;
    flex: 1;
    text-align: center;
    box-shadow: 0 4px 14px rgba(103, 8, 143, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.resumo div:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 18px rgba(103, 8, 143, 0.12);
}

.resumo strong {
    display: block;
    font-size: 32px;
    font-weight: 800;
    line-height: 1.2;
    color: #702b91;
    margin-bottom: 8px;
}

.resumo span {
    display: block;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #806c89;
}



/* =========================
   MODAL
========================= */

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;

    background-color: rgba(45, 20, 55, 0.58);
    backdrop-filter: blur(4px);

    align-items: center;
    justify-content: center;

    padding: 20px;
    overflow-y: auto;
}

.modal-conteudo {
    background: linear-gradient(145deg, #ffffff, #fbf5ff);
    width: 100%;
    max-width: 450px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;

    padding: 28px;
    border: 1px solid #eadcf2;
    border-radius: 20px;

    box-shadow: 0 15px 45px rgba(45, 20, 55, 0.2);
}

.modal-conteudo h2 {
    color: #702b91;
    font-size: 23px;
    margin-bottom: 22px;
}

.modal-conteudo label {
    display: block;
    margin-top: 15px;
    margin-bottom: 7px;

    color: #594563;
    font-size: 14px;
    font-weight: 700;
}

.modal-conteudo textarea {
    min-height: 100px;
    resize: vertical;
}

/* =========================
   BOTÕES DO FORMULÁRIO
========================= */

.botoes {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

#btn-cancelar {
    background-color: #efc7f1;
}

#form-esmalte button[type="submit"] {
    background-color: #67088f;
    color: white;
}


/* =========================
   CELULAR
========================= */


@media (max-width: 600px) {

    main {
        padding: 16px;
    }

    header {
        padding: 25px 15px;
    }

    header h1 {
        font-size: 24px;
    }

    .barra-pesquisa {
        flex-direction: column;
        gap: 10px;
    }

    .barra-pesquisa input {
        width: 100%;
        box-sizing: border-box;
    }

    .filtros {
        flex-direction: column;
        gap: 10px;
    }

    .filtros select {
        width: 100%;
        box-sizing: border-box;
    }

    .resumo {
        gap: 10px;
    }

    .resumo div {
        padding: 18px 10px;
        min-width: 0;
    }

    .resumo strong {
        font-size: 28px;
    }

    #lista-esmaltes {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .cartao-esmalte {
        padding: 16px;
        min-width: 0;
    }

    .foto-esmalte {
        height: 220px;
    }

    .acoes-cartao {
        gap: 8px;
    }

    .acoes-cartao button {
        padding: 11px 8px;
    }

    .modal {
        padding: 12px;
    }

    .modal-conteudo {
        padding: 20px;
        max-height: calc(100vh - 24px);
    }

}

/* =========================
   CARTÃO DE ESMALTE
========================= */



#lista-esmaltes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 22px;
    align-items: stretch;
}


.cartao-esmalte {
    background-color: #faeefa;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #947d9e64;

    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}


.cartao-esmalte h3 {
    color: #702b91;
    font-size: 21px;
    line-height: 1.4;
    font-weight: 700;
    overflow-wrap: anywhere;
    margin-bottom: 16px;
}

.cartao-esmalte p {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
    color: #65566d;
    overflow-wrap: anywhere;
}

.cartao-esmalte strong {
    display: block;
    color: #702b91;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.cartao-esmalte p span {
    display: block;
    color: #514458;
    overflow-wrap: anywhere;
}


.foto-esmalte {
    display: block;
    width: 100%;
    height: 250px;
    object-fit: contain;

    background: linear-gradient(145deg, #fbf5ff, #f0e2fa);

    border: none;
    border-radius: 16px;

    padding: 12px;
    margin-bottom: 20px;
}


/* MELHORIAS NOS CARTÕES */
.cartao-esmalte {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-wrap: anywhere;

    background-color: #fffaff;
    border: 1px solid #eadcf2;
    border-radius: 18px;
    padding: 20px;

    box-shadow: 0 4px 14px rgba(103, 8, 143, 0.07);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.cartao-esmalte:hover {
    transform: translateY(-3px);
    border-color: #ddc5ec;
    box-shadow: 0 8px 20px rgba(103, 8, 143, 0.12);
}


/* FOTOS DOS ESMALTES */

.foto-esmalte {
    display: block;
    width: 100%;
    height: 250px;
    object-fit: contain;

    background: linear-gradient(
        145deg,
        #fbf5ff,
        #f0e2fa
    );

    border: none;
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 20px;
}


/* BOTÕES DOS CARTÕES */
.cartao-esmalte button {
    width: calc(50% - 5px);
    margin-top: 12px;
    padding: 10px 8px;
    font-weight: bold;
    transition: background-color 0.2s ease;
}


/* BOTÃO EDITAR */
.cartao-esmalte button:first-of-type {
    background-color: #f0e4fa;
    color: #702b91;
    border: 1px solid #e2ccef;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(103, 8, 143, 0.06);
    font-weight: 600;
    transition: background-color 0.2s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
}

.cartao-esmalte button:first-of-type:hover {
    background-color: #e5d0f4;
    box-shadow: 0 4px 9px rgba(103, 8, 143, 0.12);
    transform: translateY(-1px);
}

/* BOTÃO EXCLUIR */
.cartao-esmalte button:last-of-type {
    background-color: #fff0f5;
    color: #9b2453;
    border: 1px solid #f3d2df;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(155, 36, 83, 0.05);
    font-weight: 600;
    transition: background-color 0.2s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
}

.cartao-esmalte button:last-of-type:hover {
    background-color: #f9dce8;
    box-shadow: 0 4px 9px rgba(155, 36, 83, 0.10);
    transform: translateY(-1px);
}

/* DESTAQUE AO CLICAR OU NAVEGAR PELO TECLADO */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #8e44ad;
    outline-offset: 2px;
}


/* INFORMAÇÕES DOS CARTÕES */

.cartao-esmalte h3 {
    color: #702b91;
    font-size: 21px;
    line-height: 1.4;
    font-weight: 700;
    overflow-wrap: anywhere;
    margin-bottom: 16px;
}

.cartao-esmalte p {
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.5;
}

.cartao-esmalte p strong {
    color: #67088f;
    font-size: 13px;
}

.cartao-esmalte p span {
    color: #514657;
    overflow-wrap: anywhere;
}

.cartao-esmalte .observacoes {
    background-color: #f3e5f8;
    padding: 10px;
    border-radius: 8px;
    margin-top: 5px;
}


/* ÁREA DOS BOTÕES */

.acoes-cartao {
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding-top: 18px;
}

.acoes-cartao button {
    flex: 1;
    width: auto;
    min-width: 0;
    min-height: 44px;
    margin-top: 0;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    touch-action: manipulation;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.acoes-cartao button:hover {
    transform: translateY(-2px);
}


@media (min-width: 1200px) {
    header {
        padding: 32px 20px;
    }

    header h1 {
        font-size: 30px;
    }

    main {
        max-width: 1400px;
        padding: 32px 40px;
    }

    #lista-esmaltes {
        grid-template-columns: repeat(
            auto-fit,
            minmax(300px, 1fr)
        );
        gap: 24px;
    }

    .cartao-esmalte {
        padding: 22px;
    }
}


#tela-login {
    max-width: 420px;
    margin: 35px auto;
    padding: 20px;
}

.caixa-login {
    background-color: #faeefa;
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 3px 12px rgba(103, 8, 143, 0.12);
}

.caixa-login h2 {
    color: #67088f;
    margin-bottom: 8px;
}

.caixa-login > p {
    margin-bottom: 20px;
    color: #514657;
}

#form-login label {
    display: block;
    margin: 12px 0 5px;
    font-weight: bold;
}

#form-login button {
    width: 100%;
    margin-top: 18px;
    background-color: #67088f;
    color: white;
}

#erro-login {
    color: #b42318;
    margin-top: 12px;
    overflow-wrap: anywhere;
}

body.verificando-sessao #tela-login,
body.verificando-sessao #catalogo {
    display: none !important;
}


#btn-sair {
    margin-top: 12px;
    padding: 9px 16px;
    border: 1px solid #67088f;
    border-radius: 8px;
    background-color: transparent;
    color: #67088f;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

#btn-sair:hover {
    background-color: #67088f;
    color: white;
}


.mensagem-vazia {
    grid-column: 1 / -1;
    padding: 28px 20px;
    margin: 0;
    text-align: center;
    color: #806c89;
    background: linear-gradient(145deg, #ffffff, #fbf5ff);
    border: 1px dashed #d9c0e7;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.6;
}

#btn-limpar-filtros {
    background: linear-gradient(135deg, #f5eafa, #ead8f5);
    color: #702b91;
    border: 1px solid #d9c0e7;
    border-radius: 14px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

#btn-limpar-filtros:hover {
    background: linear-gradient(135deg, #ead8f5, #dfc5ed);
    transform: translateY(-2px);
}


.label-foto {
    display: block;
    margin-bottom: 12px;
    color: #594563;
    font-size: 14px;
    font-weight: 700;
}

.botoes-foto {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.botoes-foto button {
    flex: 1;
    min-width: 0;
    min-height: 50px;
    padding: 12px 8px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

#btn-tirar-foto {
    background: linear-gradient(135deg, #702b91, #8d45aa);
    color: #ffffff;
    border: 1px solid #702b91;
}

#btn-escolher-galeria {
    background: linear-gradient(135deg, #f5eafa, #ead8f5);
    color: #702b91;
    border: 1px solid #d9c0e7;
}

.botoes-foto button:hover {
    transform: translateY(-2px);
}

@media (max-width: 360px) {
    .botoes-foto {
        gap: 8px;
    }

    .botoes-foto button {
        font-size: 13px;
    }
}



/* NAVEGAÇÃO ENTRE ABAS */

.navegacao-abas {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.navegacao-abas .aba {
    flex: 1;
    padding: 12px 10px;
    border: 1px solid #e8d5f0;
    border-radius: 12px;
    background: #ffffff;
    color: #8536a5;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.navegacao-abas .aba.ativa {
    background: #f1ddf9;
    border-color: #d8b5e9;
    color: #71308d;
}

.navegacao-abas .aba:hover {
    background: #f8effc;
}

/* PAINÉIS DAS ABAS */

.painel-aba {
    display: none;
}

.painel-aba.ativo {
    display: block;
}


/* PRÉ-VISUALIZAÇÃO DO CRESCIMENTO */

#preview-container-crescimento {
    margin: 15px 0;
    text-align: center;
}

#preview-crescimento {
    width: 100%;
    max-width: 300px;
    max-height: 350px;
    object-fit: cover;
    border-radius: 14px;
    border: 2px solid #e8d5f0;
}


/* HISTÓRICO DE CRESCIMENTO */

.card-crescimento {
    background: #ffffff;
    border: 1px solid #e8d5f0;
    border-radius: 14px;
    padding: 14px;
    margin-top: 15px;
    box-shadow: 0 2px 8px rgba(133, 54, 165, 0.06);
}

.card-crescimento img {
  width: 100%;
  max-height: 350px;
  object-fit: contain;
  border-radius: 10px;
  background: #faf7fc;
  cursor: zoom-in;
}
.card-crescimento p {
    margin: 10px 0 0;
    color: #71308d;
}

.btn-excluir-crescimento {
  margin-top: 12px;
  padding: 9px 14px;
  border: 1px solid #e8c5ce;
  border-radius: 9px;
  background: #fff5f6;
  color: #b34d65;
  font-weight: 600;
  cursor: pointer;
}

.btn-excluir-crescimento:hover {
  background: #fce8ec;
}

.area-comparacao {
  background: #fff;
  border: 1px solid #e8d5f0;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(133, 54, 165, .06);
}

.area-comparacao h3 {
  color: #71308d;
  margin-top: 0;
}

.seletores-comparacao {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.seletores-comparacao > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seletores-comparacao select {
  width: 100%;
  padding: 10px;
  border: 1px solid #e8d5f0;
  border-radius: 9px;
  background: #fff;
  color: #71308d;
}

#intervalo-comparacao {
  text-align: center;
  color: #8536a5;
  font-weight: 600;
  margin: 16px 0;
}

.fotos-comparacao {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.fotos-comparacao > div {
  min-width: 0;
  text-align: center;
}

.fotos-comparacao h4 {
  color: #71308d;
}

.fotos-comparacao img {
  width: 100%;
  height: 300px;
  object-fit: contain;
  background: #faf7fc;
  border-radius: 10px;
}

.fotos-comparacao p {
  color: #8536a5;
  font-size: 14px;
}

@media (max-width: 500px) {
  .seletores-comparacao {
    grid-template-columns: 1fr;
  }

  .fotos-comparacao {
    grid-template-columns: 1fr;
  }

  .fotos-comparacao img {
    height: 280px;
  }
}

/* Galeria de seleção para comparação */
.galeria-comparacao {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 15px 0;
}

.miniatura-comparacao {
  position: relative;
  padding: 5px;
  border: 2px solid #e8d5f0;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  min-width: 0;
}

.miniatura-comparacao img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
}

.miniatura-comparacao p {
  margin: 5px 0 0;
  font-size: 12px;
  color: #71308d;
  text-align: center;
}

.miniatura-comparacao.selecionado-primeiro {
  border: 3px solid #8536a5;
  background: #f8effc;
}

.miniatura-comparacao.selecionado-segundo {
  border: 3px solid #c17bd8;
  background: #fcf4ff;
}

.acoes-comparacao {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0;
}

.acoes-comparacao button {
  flex: 1;
  min-width: 120px;
}

#instrucao-comparacao {
  color: #71308d;
  font-size: 14px;
  margin-top: 12px;
}

.cabecalho-crescimento {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    margin-bottom: 18px;
}

.texto-cabecalho-crescimento h2 {
    margin: 0 0 5px;
}

.texto-cabecalho-crescimento p {
    margin: 0;
}

#btn-novo-registro {
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 500px) {
    .cabecalho-crescimento {
        gap: 12px;
        padding: 14px 5px;
    }

    #btn-novo-registro {
        font-size: 13px;
        padding: 10px;
    }
}