/* ============================================= */
/* ESTRUTURA PRINCIPAL E LAYOUT (layout.css)     */
/* ============================================= */

/* --- OVERLAY DE CARREGAMENTO DO SISTEMA --- */
#system-loading-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: #ffffff; z-index: 99999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 0.5s ease-out, visibility 0.5s ease-out; }
#system-loading-overlay.fade-out { opacity: 0; visibility: hidden; }
#system-loading-overlay img { width: 80px; height: auto; }
#system-loading-overlay p { margin-top: 20px; font-family: 'Segoe UI', sans-serif; color: var(--azul); font-weight: bold; font-size: 1.2em; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

/* Esconde o sistema por padrão */
#system-section { padding: 0; min-height: 100vh; height: auto; display: none; box-sizing: border-box; }

/* Remove a barra superior móvel em telas grandes */
.mobile-top-bar { display: none; }

.app-container { display: flex; min-height: 100vh; height: auto; }

/* --- SIDEBAR --- */
.sidebar-menu { width: 200px; background: var(--azul); display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; transition: transform 0.3s ease-in-out; z-index: 1000; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100vh; }
.sidebar-logo-container { padding: 12px; text-align: center; border-bottom: 1px solid rgba(246, 219, 23, 0.2); }
.sidebar-logo-container .logo { max-height: 40px; margin-top: 0; }

.content-container { flex: 1; height: auto; overflow-y: visible; padding: 0; background: var(--azulclaro); position: relative; margin-left: 200px; }
.section { padding: 20px; }

/* --- MENU LATERAL PRINCIPAL --- */
.menu { display: flex; flex-direction: column; list-style: none; margin: 0; padding: 0; width: 100%; align-items: flex-start; }
.menu > li { position: relative; width: 100%; }
.menu li a { color: #F6DB17; text-decoration: none; font-weight: bold; padding: 7px 20px; height: auto; width: 100%; display: flex; align-items: center; transition: background 0.3s; box-sizing: border-box; border-bottom: 1px solid rgba(246,219,23,0.1); }
.menu li a:hover { background-color: #0048C8; }
.menu > li > a.active { background-color: var(--amarelo); color: #002888; font-weight: bold; border-left: 5px solid var(--azul); }
.menu > li > a.active:hover { background-color: #ffe066; color: #002888; }

.has-submenu > a::after { content: '▼'; font-size: 0.7em; margin-left: auto; transition: transform 0.3s ease; }
.has-submenu.open > a::after { transform: rotate(180deg); }

.submenu { list-style: none; position: relative; top: 0; left: 0; background-color: #002888; padding: 0; margin: 0; width: 100%; max-height: 0px; overflow: hidden; transition: max-height 0.3s ease; }
.submenu li a { padding: 7px 20px 7px 30px; height: auto; color: #FFF; border-bottom: 1px solid rgba(246,219,23,0.1); font-size: 12px; }
.submenu li:last-child a { border-bottom: none; }
.submenu li a:hover { background-color: #0038A8; }
.submenu li a.active { background-color: var(--amarelo); color: #002888; font-weight: bold; border-left: 5px solid #002888; padding-left: 26px; }
.submenu li a.active:hover { background-color: #ffe066; color: var(--azul); }
.has-submenu.open > .submenu { max-height: 500px; transition: max-height 0.5s ease-in; }

/* --- MENU DE USUÁRIO (SIDEBAR) --- */
.user-menu { position: relative; width: 100%; border-bottom: 1px solid rgba(246, 219, 23, 0.2); }
.user-icon { cursor: pointer; display: flex; align-items: flex-end; justify-content: flex-start; padding: 10px 15px; gap: 10px; margin-top: 0; margin-bottom: 0; position: relative; }
.user-icon::after { content: '▼'; font-size: 0.7em; color: var(--amarelo); margin-left: auto; transition: transform 0.3s ease; position: absolute; right: 20px; top: 70%; transform: translateY(-50%); }
.user-menu.open .user-icon::after { transform: translateY(-50%) rotate(180deg); }
.user-icon img { width: 24px; height: 24px; margin-bottom: 3px; }
.user-text-info { display: flex; flex-direction: column; align-items: flex-start; color: white; }
#user-name-display { font-weight: bold; font-size: 12px; margin-top: -5px; }
#user-role-display { font-size: 12px; opacity: 0.8; text-transform: capitalize; }

.user-dropdown { display: block; position: relative; background: #002888; list-style: none; padding: 0; margin: 0; width: 100%; overflow: hidden; max-height: 0px; transition: max-height 0.3s ease-out; }
.user-menu.open > .user-dropdown { max-height: 120px; }
.user-dropdown li { border-bottom: 1px solid rgba(255,255,255,0.1); }
.user-dropdown li:last-child { border-bottom: none; }
.user-dropdown li a, .user-dropdown li button { text-decoration: none; font-weight: bold; display: block; width: 100%; padding: 10px 15px; text-align: left; background: none; border: none; color: #fff; font-size: 12px; cursor: pointer; }
.user-dropdown li a:hover, .user-dropdown li button:hover { background: #0048C8; }
.user-dropdown li a.active { background-color: var(--amarelo); color: #002888; font-weight: bold; border-left: 5px solid var(--azul); }
.user-dropdown li a.active:hover { background-color: #ffe066; color: #002888; }
button.sair { background: none; border: none; box-shadow: none; color: white; font-weight: bold; cursor: pointer; font-size: 16px; padding: 5px 10px; }
button.sair:hover { text-decoration: none; }

/* --- CABEÇALHOS DAS PÁGINAS --- */
.header { gap: 10px; position: relative; display: flex; justify-content: space-between; align-items: center; color: var(--azul); padding: 20px; margin-bottom: 0; margin-top: -20px; }
.header h1 { margin: 0; flex-grow: 1; text-align: center; }
.header .nav-btn { background: var(--amarelo); color: var(--azul); width: 45px; height: 45px; border: none; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 2em; font-weight: bold; padding-bottom: 8px; flex-shrink: 0; }
.header .nav-btn:hover { background: #f7e04f; }
.header .nav-btn:disabled { background: #ccc; color: #888; cursor: not-allowed; opacity: 0.7; }
.header .nav-btn:disabled:hover { background: #ccc; transform: none; }
.header .btn-add-account { background-color: var(--verde); color: white; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-size: 1.2em; font-weight: bold; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); transition: background-color 0.3s ease; flex-shrink: 0; height: 45px; box-sizing: border-box; }
.header .btn-add-account:hover { background: var(--verdeescuro); transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.header .btn-report { background: var(--azul); color: white; border: none; padding: 10px 15px; border-radius: 5px; cursor: pointer; font-size: 1.2em; font-weight: bold; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; flex-shrink: 0; height: 45px; box-sizing: border-box; display: flex; align-items: center; gap: 8px;}
.header .btn-report:hover { background: #002c85; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

/* --- RESPONSIVIDADE LAYOUT --- */
@media (max-width: 768px) {
    body { padding-top: 60px; }
    #system-section { padding-top: 0; }
    .mobile-top-bar { display: flex; align-items: center; gap: 15px; position: fixed; top: 0; left: 0; width: 100%; height: 60px; background: var(--azul); padding: 0 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); z-index: 1001; box-sizing: border-box; }
    .mobile-menu-toggle { background: none; border: none; color: var(--amarelo); font-size: 24px; cursor: pointer; padding: 5px; -webkit-user-select: none; user-select: none; }
    .mobile-logo { height: 35px; width: auto; }
    .app-container { display: block; height: 100%; }
    .sidebar-menu { position: fixed; top: 60px; left: 0; height: calc(100vh - 60px); transform: translateX(-100%); box-shadow: 4px 0 10px rgba(0,0,0,0.1); z-index: 10002; }
    .sidebar-menu.visible { transform: translateX(0); }
    .content-container { width: 100%; height: 100%; padding: 0; box-sizing: border-box; margin-left: 0; margin-top: 60px; min-width: 0; }
    .sidebar-logo-container { display: none; }
    .section { padding: 10px; }

    .header { padding: 15px; flex-wrap: wrap; justify-content: space-between; row-gap: 15px; }
    .header h1 { font-size: 1.2em; }
    .header h2#main-title { font-size: 1.2em; flex-basis: 50%; flex-grow: 1; text-align: center; order: 4; margin: 0; }
    .header .btn-report { order: 1; flex-grow: 1; margin-right: 10px; font-size: 0.9em; height: 45px; padding: 0 10px; width: 100%; justify-content: center; }
    .header .btn-add-account { order: 2; flex-grow: 1; font-size: 0.9em; height: 45px; padding: 0 10px; }
    .header .nav-btn[onclick*="-1"] { order: 3; }
    .header .nav-btn[onclick*="1"] { order: 5; }
}

@media (max-width: 480px) {
  body { padding: 10px; }
  .header h1 { font-size: 1em; }
}


/* ============================================= */
/* ▼▼▼ TELA LIMPA DO SIMULADOR (IFRAME) ▼▼▼      */
/* ============================================= */

.simulador-clean {
    padding: 0 !important; /* Remove os espaços em branco em volta */
    height: 100vh; /* Ocupa 100% da altura da tela no PC */
    overflow: hidden; /* Evita que crie uma segunda barra de rolagem chata */
}

.simulador-clean iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Ajuste no celular para o topo não ficar escondido debaixo do menu azul */
@media (max-width: 768px) {
    .simulador-clean {
        height: calc(100vh - 60px); 
    }
}