:root{
    --cor-fundo: linear-gradient(to right, rgb(20, 147, 220), rgb(17, 54, 71));
    --cor-botao: linear-gradient(to right, rgb(0, 92, 197), rgb(90, 20, 220));
    --cor-principal: dodgerblue;
    --fundo-form: rgba(0, 0, 0, 0.5);
    --cor-fonte: white;
}

body{
    font-family: Arial, Helvetica, sans-serif;
    background-image: var(--cor-fundo);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h2 {
    color: var(--cor-fonte);
    text-align: center;
}

h3 {
    text-align: center;
    color: var(--cor-fonte);
}

.box{
    position: relative;
    margin: 50px auto;
    background-color: var(--fundo-form);
    padding: 15px;
    border-radius: 15px;
    width: 70%;
    color: var(--cor-fonte);
    max-width: 800px;
    min-width: 300px;
    /* Garante que a caixa cresça conforme o conteúdo e não tenha barra de rolagem interna */
    height: auto;
    max-height: none;
    overflow: visible;
}

.box2{
    position: relative;
    margin: 50px auto;
    background-color: var(--fundo-form);
    padding: 15px;
    border-radius: 15px;
    width: 70%;
    color: var(--cor-fonte);
    max-width: 800px;
    min-width: 300px;
    height: auto;
    max-height: none;
    overflow: visible;
}

/* box2-junior removed -> managed by flow */

.box2c{
    position: relative;
    margin: 50px auto;
    background-color: var(--fundo-form);
    padding: 15px;
    border-radius: 15px;
    width: 70%;
    color: var(--cor-fonte);
    max-width: 800px;
    min-width: 300px;
    height: auto;
    max-height: none;
    overflow: visible;
}

.box7{
    position: relative;
    margin: 50px auto;
    background-color: var(--fundo-form);
    padding: 15px;
    border-radius: 15px;
    width: 70%;
    color: var(--cor-fonte);
    /* margin-top: 45px; Removido pois margin auto controla melhor */
    max-width: 800px;
    min-width: 300px;
    /* Ajustes para fluxo normal da página */
    height: auto;
    max-height: none;
    overflow: visible;
}

.box3{
    position: relative;
    margin: 50px auto;
    background-color: var(--fundo-form);
    padding: 15px;
    border-radius: 15px;
    width: 70%;
    color: var(--cor-fonte);
    max-width: 800px;
    min-width: 300px;
    height: auto;
    max-height: none;
    overflow: visible;
}

.box4{
    position: relative;
    margin: 50px auto;
    background-color: var(--fundo-form);
    padding: 15px;
    border-radius: 15px;
    width: 30%;
    color: var(--cor-fonte);
    max-width: 400px;
    min-width: 280px;
    height: auto;
    max-height: none;
    overflow: visible;
}

/* Garante que alertas fiquem visíveis sobre outros elementos */
.alert {
    position: relative;
    z-index: 9999;
}

fieldset{
    border: 3px solid var(--cor-principal);  
    margin: 10px 0;
    padding: 15px;
}

legend{
    border: 1px solid var(--cor-principal);
    padding: 10px;
    text-align: center;
    background-color: var(--cor-principal);
    border-radius: 8px;
    margin: 0 auto; 
    display: block;
    width: fit-content;
}

.inputBox{
    position: relative;
    padding-bottom: 15px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.inputUser{
    background: none;
    border: none;
    border-bottom: 1px solid white;
    outline: none;
    color: var(--cor-fonte);
    font-size: 18px;
    width: 100%;
    letter-spacing: 2px;
    padding: 8px 0;
}

.inputUser2{
    background: none;
    border: none;
    border-bottom: 1px solid white;
    outline: none;
    color: var(--cor-fonte);
    font-size: 18px;
    width: 100%;
    letter-spacing: 2px;
    flex: 2;
    padding: 8px 0;
}

.dupla3{
    display: flex;
    width: 100%;
    gap: 15px;
    flex-wrap: wrap;
}

.inputUser3{
    background: none;
    border: none;
    border-bottom: 1px solid white;
    outline: none;
    color: var(--cor-fonte);
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
    flex: 1;
    min-width: 70px;
    padding: 8px 0;
}

.labelInput{
    position: absolute;
    top: 8px;
    left: 0px;
    pointer-events: none;
    transition: .5s;
    font-size: 16px;
}

.inputUser:focus ~ .labelInput,
.inputUser:valid ~ .labelInput{
    top: -20px;
    font-size: 14px;
    color: var(--cor-principal);
}

.inputUser2:focus ~ .labelInput,
.inputUser2:valid ~ .labelInput{
    top: -20px;
    font-size: 14px;
    color: var(--cor-principal);
}

.inputUser3:focus ~ .labelInput,
.inputUser3:valid ~ .labelInput{
    top: -20px;
    font-size: 14px;
    color: var(--cor-principal);
}

#nasc, #validade{
    border: none;
    padding: 12px;
    border-radius: 10px;
    outline: none;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
}

#submit{
    background-image: var(--cor-botao);
    width: 100%;
    border: none;
    padding: 15px;
    color: var(--cor-fonte);
    font-size: 18px;
    cursor: pointer;
    border-radius: 10px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

#submit:hover{
    background-image: linear-gradient(to right, rgb(0, 80, 172), rgb(80, 19, 175));
    transform: translateY(-2px);
}

.datas{
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 15px;
}

.datas .inputBox {
    flex: 1;
    min-width: 0;
}

input[type="date"]{
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    outline: none;
    font-size: 16px;
    color: black;
    box-sizing: border-box;
}

.botao {
    background-color: #002595;
    color: white;
    border: none;
    padding: 12px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    margin: 5px 0;
}

.botao:hover {
    background-color: #001d74;
    transform: translateY(-2px);
}

.botao:active {
    background-color: #664bff;
    transform: scale(0.98);
}

.dupla{
    display: flex;
    justify-content: space-between;
    gap: 15px;
    align-items: flex-start;
}

.dupla .inputBox2j {
    flex: 1;
    min-width: 0;
}

.caixa{
    width: 100%;
    min-width: 200px;
}

.inputBox2{
    position: relative;
    padding-bottom: 15px;
    width: 100%;
}

.inputBox2j{
    position: relative;
    padding-bottom: 15px;
    width: 100%;
}

.inputBox3{
    position: relative;
    padding-bottom: 15px;
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 15px;
    flex-wrap: wrap;
}

select {
    width: 100%;
    padding: 12px; 
    border: 1px solid #ccc;
    border-radius: 5px; 
    font-size: 16px; 
    background-color: rgb(16, 63, 85); 
    color: white;
    box-sizing: border-box;
}

input, textarea {
    color: black;
    box-sizing: border-box;
}

/* Header responsivo */
header {
    background-color: #00509E;
    color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
}

nav {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s;
    background-color: #003F7D;
    white-space: nowrap;
}

nav a:hover {
    background-color: #002C5E;
}

nav a.active {
    background-color: var(--cor-principal);
}

/* Estilo para tabelas responsivas */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    display: block;
    white-space: nowrap;
}

.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    min-width: 120px;
}

.table th {
    background-color: #007BFF;
    color: white;
    font-weight: bold;
    text-transform: uppercase;
    position: sticky;
    top: 0;
}

.table tr:hover {
    background-color: #f1f1f1;
}

.table td {
    color: #555;
}

/* Container para scroll horizontal em tabelas */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dupla2{
    display: flex;
    justify-content: space-around;
    gap: 15px;
    flex-wrap: wrap;
}

.caixa2{
    width: 100%;
    min-width: 200px;
}

*{
    color: var(--cor-fonte);
    text-decoration: none;
}

.link-tree{
    display: flex;
    flex-direction: column;
    margin: auto;
    align-items: center;
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

.link-tree img {
    max-width: 90%;
    max-height: 35vh;
    object-fit: contain;
}

.link-tree h1{
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: bold;
    text-align: center;
}

.link-tree a{
    background: var(--cor-botao);
    padding: 15px 30px;
    border-radius: 5px;
    color: var(--cor-fonte);
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: bold;
    text-transform: uppercase;
    transition: 0.5s;
    text-align: center;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
}

.link-tree a:hover{
    background: var(--cor-principal);
    transform: translateY(-2px);
}   

.chave{
    color: black;
}

.entidade{
    display: flex;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
}

.tabela{
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: clamp(14px, 2.5vw, 18px);
    overflow-x: auto;
    display: block;
}

.itens_tabela{
    border: 1px solid #002595;
    padding: 8px;
    min-width: 100px;
}

.espaco{
    display: none;
}

.ibge{
    width: 100%;
}

.alerta{
    background-color: #f44336;
    color: white;
    border: none;
    padding: 12px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    margin: 5px 0;
}

.alerta:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
}

.loginBox{
    justify-content: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
}

.logout {
    background-color: red;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease-in-out;
    white-space: nowrap;
}

.logout:hover {
    background-color: darkred;
}

.linkRecuperar {
    color: #007BFF;
    text-decoration: none;
    font-size: 14px;
    text-align: center;
    display: block;
    margin-top: 15px;
}

.linkRecuperar:hover {
    text-decoration: underline;
}

.alert { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; border-radius: 4px; }
.alert-success { color: #155724; background-color: #d4edda; border-color: #c3e6cb; }
.alert-danger { color: #721c24; background-color: #f8d7da; border-color: #f5c6cb; }

/* Botão de fechar alerta (estilo similar ao Bootstrap) */
.alert .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
    cursor: pointer;
}
.alert .btn-close:hover {
    color: #000;
    text-decoration: none;
    opacity: .75;
}
.alert .btn-close::before {
    content: "×";
}

input:disabled { background-color: #dddddd33; cursor: not-allowed; }

/* Media Queries para responsividade */
/* ...existing code... */

/* Media Queries para responsividade - AJUSTADAS */
@media (max-width: 1024px) and (min-width: 769px) {
    .box, .box2, .box3 {
        width: 80%;
    }
    
    .box4 {
        width: 50%;
    }
}

@media (max-width: 768px) {
    .box, .box2, .box2c, .box3 {
        width: 93%;
        padding: 15px;
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 20px auto;
        max-height: none;
    }
    
    .box4 {
        width: 95%;
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 20px auto;
        max-height: none;
    }

    header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        text-align: center;
    }

    nav {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    nav a {
        flex: 1;
        text-align: center;
        min-width: 120px;
        font-size: 14px;
        padding: 10px 8px;
    }

    .dupla, .dupla2, .dupla3, .entidade {
        flex-direction: column;
        gap: 15px;
    }

    .inputBox2, .inputBox2j, .caixa, .caixa2 {
        width: 100%;
    }

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

    .table {
        font-size: 14px;
        display: table;
        white-space: normal;
    }

    .table th, .table td {
        padding: 8px 6px;
        min-width: 80px;
        word-wrap: break-word;
    }

    .espaco {
        display: block;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .box, .box2, .box3, .box4 {
        width: 90%;
        padding: 10px;
        margin: 10px auto;
    }

    header {
        padding: 10px;
    }

    .logo {
        font-size: 1.2rem;
    }

    nav a {
        font-size: 12px;
        padding: 8px 6px;
        min-width: 80px;
    }

    .inputUser, .inputUser2, .inputUser3 {
        font-size: 14px;
    }

    #submit {
        font-size: 14px;
        padding: 12px;
    }

    .table th, .table td {
        padding: 6px 4px;
        font-size: 12px;
        min-width: 60px;
    }

    .link-tree h1 {
        font-size: 1.8rem;
    }

    .link-tree a {
        padding: 10px 15px;
        font-size: 14px;
    }

    .botao, .alerta {
        padding: 10px 15px;
        font-size: 14px;
    }

    fieldset {
        padding: 10px;
    }

    legend {
        padding: 8px;
        font-size: 14px;
    }

    .box7{
        top: 75%;
    }

    .inputBox .labelInput {
        top: -18px; 
        font-size: 0.95em;
  }
}

/* ...existing code... */

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Melhor usabilidade em telas pequenas */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Ocultar elementos em telas muito pequenas se necessário */
@media (max-width: 320px) {
    .dupla3 {
        flex-direction: column;
    }
    
    .table-container {
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }
}

/* Nico dev footer brand */
.nico-dev-footer {
    position: relative;
    margin-top: auto;
    width: 100%;
    padding: 15px 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    letter-spacing: 2px;
    z-index: 10;
    pointer-events: auto;
    user-select: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nico-dev-footer a {
    color: inherit;
    text-decoration: none;
    pointer-events: auto;
    transition: color 0.3s ease;
}

.nico-dev-footer a:hover {
    color: var(--cor-principal);
    text-shadow: 0 0 10px var(--cor-principal);
}

.nico-dev-footer::before {
    content: "{ ";
    color: var(--cor-principal);
    font-weight: bold;
    opacity: 0.8;
}

.nico-dev-footer::after {
    content: " }";
    color: var(--cor-principal);
    font-weight: bold;
    opacity: 0.8;
}

.alert-box {
    background: linear-gradient(135deg, #DC2424, #4A569D);
    background: linear-gradient(135deg, #cb2d3e, #ef473a);
    color: white;
    padding: 20px;
    margin: 20px auto;
    width: 90%;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-family: inherit;
    border: 1px solid rgba(255,255,255,0.2);
}

.alert-box .alert-icon {
    font-size: 3em;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.alert-box .alert-content {
    text-align: left;
}

.alert-box .alert-title {
    display: block;
    font-size: 1.3em;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alert-box .alert-text {
    font-size: 1.1em;
    line-height: 1.5;
}

.alert-box .alert-link {
    color: #fff;
    background-color: rgba(255,255,255,0.2);
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 5px;
    transition: background 0.3s;
}

.alert-box .alert-link:hover {
    background-color: rgba(255,255,255,0.4);
}