/* Importa normalize.css e as fontes */
@import url('https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css');
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700&family=VT323&display=swap');

/* Variáveis de cores */
:root {
    --blue-dark: #000033;
    --blue-medium: #1a2a4c;
    --green-cyan: #00ffee;
    --text-color-bright: #e0e0e0;
    --menu-bg: #101a2e;
    --menu-hover: #00ffee1a;
    --border-glow: #00ffee;
    --input-focus-glow: #00ffee;
}

body {
    background-color: var(--blue-dark);
    font-family: 'Montserrat', sans-serif;
    color: var(--text-color-bright);
    font-size: 1rem;
    line-height: 1.6;
    overflow: hidden;
    position: relative;
    height: 100vh;
}

/* Animações e Fundo de Partículas */
@keyframes flicker {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.3; }
}

@keyframes backgroundScroll {
    from { background-position: 0 0; }
    to { background-position: 100% 100%; }
}

.background-pattern-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -2;
}

.background-pattern {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 10% 20%, rgba(0, 255, 238, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 90%, rgba(0, 255, 238, 0.1) 0%, transparent 50%),
        repeating-linear-gradient(
            -45deg,
            var(--blue-dark) 0%,
            var(--blue-dark) 2px,
            rgba(0, 255, 238, 0.05) 2px,
            rgba(0, 255, 238, 0.05) 3px
        );
    background-size: 100% 100%, 100% 100%, 10px 10px;
    animation: backgroundScroll 60s linear infinite;
    opacity: 0.8;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background: transparent;
    box-shadow: 0 0 100px rgba(0, 255, 238, 0.1) inset,
                0 0 200px rgba(0, 255, 238, 0.05) inset;
    animation: particleGlow 10s infinite alternate;
}

@keyframes particleGlow {
    0%, 100% { box-shadow: 0 0 100px rgba(0, 255, 238, 0.1) inset, 0 0 200px rgba(0, 255, 238, 0.05) inset; }
    50% { box-shadow: 0 0 120px rgba(0, 255, 238, 0.2) inset, 0 0 240px rgba(0, 255, 238, 0.1) inset; }
}

/* Animação de entrada para a caixa de login */
@keyframes slideIn {
    from {
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
        filter: blur(5px);
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

.animated-login {
    animation: slideIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Estrutura e Estilos do Sistema */
.system-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--menu-bg);
    padding: 0.8rem 2rem;
    border-bottom: 2px solid var(--border-glow);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 10;
}

/* Estilo do Logo Principal */
.main-logo {
    height: 35px;
    width: auto;
    transition: transform 0.3s ease-in-out;
    filter: drop-shadow(0 0 5px rgba(0, 255, 238, 0.6));
}

.main-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px rgba(0, 255, 238, 0.8));
}

/* --- ESTILOS DO NOVO MENU UMA ESTRUTURA UL/LI --- */
.menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.menu ul li {
    position: relative;
}

/* Estilo para os itens de menu principais */
.menu ul li a {
    color: var(--text-color-bright);
    text-decoration: none;
    padding: 0.5rem 1rem;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: background-color 0.3s, color 0.3s, transform 0.3s, box-shadow 0.3s;
    border-radius: 4px;
    display: block;
}

.menu ul li a:hover {
    background-color: var(--menu-hover);
    color: var(--green-cyan);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 5px 15px rgba(0, 255, 238, 0.3);
}

/* Esconde o submenu por padrão */
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 200px;
    background-color: var(--blue-medium);
    border: 2px solid var(--border-glow);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Mostra o submenu ao passar o mouse sobre o item de menu pai */
.menu ul li:hover > .submenu {
    display: block;
}

/* Ajuste para o submenu aninhado (Submenu de segundo nível) */
.submenu .submenu {
    top: 0; /* Posiciona no topo do item pai */
    left: 100%; /* Posiciona à direita do item pai */
    margin-left: 5px; /* Adiciona um pequeno espaçamento */
}

/* Exibe o submenu aninhado quando o mouse está sobre o item pai */
.submenu li:hover > .submenu {
    display: block;
}


/* Estilo para os links dentro do submenu */
.submenu li a {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    padding: 0.8rem 1rem;
    color: var(--text-color-bright);
    text-transform: none;
    font-weight: normal;
}

.submenu li a:hover {
    background-color: var(--green-cyan);
    color: var(--blue-dark);
    transform: none;
    box-shadow: none;
}

/* Estilo para o separador */
.menu-separator {
    width: 1px;
    height: 1.5rem;
    background-color: rgba(0, 255, 238, 0.2);
    align-self: center;
}

/* Estilos de Login Aprimorados */
.login-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-box {
    background-color: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--border-glow);
    color: var(--green-cyan);
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 0 20px rgba(0, 255, 238, 0.8);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.login-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 1px,
        rgba(0, 255, 238, 0.05) 1px,
        rgba(0, 255, 238, 0.05) 2px
    );
    pointer-events: none;
    opacity: 0.5;
    z-index: 0;
}

.login-header {
    background-color: var(--green-cyan);
    color: var(--blue-dark);
    padding: 0.8rem;
    text-align: center;
    font-weight: bold;
    margin: -2rem -2rem 2rem -2rem;
    font-size: 1.3rem;
    text-transform: uppercase;
    box-shadow: 0 4px 10px rgba(0, 255, 238, 0.5);
}

.login-form .input-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.8rem;
}

.login-form .input-group label {
    width: 110px;
    flex-shrink: 0;
    text-align: right;
    margin-right: 1.5rem;
    font-weight: 300;
}

.login-form .input-group .input-field {
    flex-grow: 1;
    background-color: var(--blue-dark);
    border: 1px solid var(--border-glow);
    color: var(--green-cyan);
    padding: 0.7rem 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s, background-color 0.3s;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
}

.login-form .input-group .input-field:focus {
    border-color: var(--input-focus-glow);
    box-shadow: 0 0 10px var(--input-focus-glow);
    background-color: #000040;
}

.login-form .button-group {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
}

.login-button {
    background-color: var(--green-cyan);
    color: var(--blue-dark);
    border: none;
    padding: 1rem 3.5rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    box-shadow: 6px 6px 15px rgba(0, 255, 238, 0.5);
    border-radius: 50px;
    position: relative;
    overflow: hidden;
}

.login-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.login-button:hover::before {
    left: 100%;
}

.login-button:hover {
    background-color: #fff;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 255, 238, 0.7);
    color: var(--blue-dark);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--menu-bg);
    padding: 0.8rem 2rem;
    border-top: 2px solid var(--border-glow);
    font-size: clamp(0.8rem, 1.2vw, 1.2rem);
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4);
    font-family: 'VT323', monospace;
    flex-shrink: 0;
}

/* Novo estilo para o texto do sistema */
.status-bar .system-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    color: var(--text-color-bright);
}

/* Estilo para o Botão de Ajuda */
.help-button-container {
    cursor: pointer;
    background-color: rgba(0, 255, 238, 0.1);
    border: 1px solid var(--green-cyan);
    color: var(--green-cyan);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.help-button-container:hover {
    background-color: rgba(0, 255, 238, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 255, 238, 0.5);
}

.help-button-container .button-icon {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 1;
}

.help-button-container .button-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
}

/* -------------------- POP-UP DE AJUDA -------------------- */
.popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.popup-container.active {
    display: flex;
    opacity: 1;
}

.popup-box {
    background-color: var(--blue-medium);
    border: 2px solid var(--green-cyan);
    color: var(--text-color-bright);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    box-shadow: 0 0 20px rgba(0, 255, 238, 0.8);
    animation: popupIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes popupIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.popup-header {
    background-color: var(--green-cyan);
    color: var(--blue-dark);
    padding: 0.8rem 1rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.popup-close {
    color: var(--blue-dark);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.popup-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

.popup-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    overflow: hidden;
}

#help-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    margin: 0;
}

.popup-footer {
    background-color: var(--menu-bg);
    border-top: 1px solid var(--green-cyan);
    padding: 0.8rem;
    text-align: center;
    font-size: 0.8rem;
    font-family: 'Montserrat', sans-serif;
    opacity: 0.8;
    flex-shrink: 0;
}

/* Estilos para o Submenu de Cadastros */

/* Esconde o submenu por padrão */
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 200px;
    background-color: var(--blue-medium);
    border: 2px solid var(--border-glow);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Mostra o submenu ao passar o mouse sobre o item de menu pai */
.menu ul li:hover > .submenu {
    display: block;
}

/* Ajuste para o submenu aninhado (Submenu de segundo nível) */
.submenu .submenu {
    top: 0;
    left: 100%;
    margin-left: 5px;
}

/* Exibe o submenu aninhado quando o mouse está sobre o item pai */
.submenu li:hover > .submenu {
    display: block;
}

/* Estilo para os links dentro do submenu */
.submenu li a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-color-bright);
    text-decoration: none;
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    transition: background-color 0.2s, color 0.2s;
}

.submenu li a:hover {
    background-color: var(--green-cyan);
    color: var(--blue-dark);
    transform: none;
    box-shadow: none;
}

/* Estilo para o separador */
.menu-separator {
    width: 1px;
    height: 1.5rem;
    background-color: rgba(0, 255, 238, 0.2);
    align-self: center;
}

/* Responsividade */
@media (max-width: 850px) {
    .menu ul {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    .menu ul li a {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    .top-bar {
        flex-direction: column;
        align-items: center;
        padding: 1rem;
    }
    .main-logo {
        margin-bottom: 1rem;
        margin-right: 0;
    }
    .date {
        margin-top: 1rem;
    }
}

@media (max-width: 650px) {
    .main-logo {
        height: 30px;
    }
    .top-bar {
        flex-direction: column;
        align-items: center;
    }
    .menu ul {
        justify-content: center;
        width: 100%;
    }
    .login-form .input-group {
        flex-direction: column;
        align-items: flex-start;
    }
    .login-form .input-group label {
        width: auto;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    .popup-box {
        max-width: 95%;
    }
    .popup-header {
        font-size: 1.2rem;
    }
    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }
    .status-bar .status-left,
    .status-bar .status-right {
        text-align: center;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .login-box {
        padding: 1.5rem;
    }
    .login-header {
        font-size: 1.1rem;
        margin: -1.5rem -1.5rem 1.5rem -1.5rem;
    }
    .login-button {
        padding: 0.8rem 2.5rem;
        font-size: 0.9rem;
    }
    .status-bar span {
        font-size: 0.75rem;
    }
    .help-button-container {
        padding: 0.3rem 0.6rem;
    }
    .help-button-container .button-text {
        font-size: 0.8rem;
    }
    .popup-header {
        font-size: 1rem;
    }
}