/* =====================================================
   CABEÇALHO MODULAR - Simulados para Enfermagem
   Arquivo: header-v4-dashboard.css
   Descrição: Estilos completos para o cabeçalho com
              mega-menus e controles de acessibilidade
   ===================================================== */

/* ===== TOP BAR - FAIXA 1 ===== */
.top-bar {
    background: linear-gradient(135deg, #1A3E74 0%, #0d2847 100%);
    padding: 0;
    font-size: 13px;
    position: relative;
}

.top-bar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 48px;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-bar-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    opacity: 0.95;
}

.top-bar-item a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.top-bar-item a:hover {
    opacity: 1;
}

/* ===== TOP BAR TOOLS - Controles de Acessibilidade ===== */
.top-bar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.tool-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    font-family: inherit;
    font-weight: 500;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.tool-btn:active {
    transform: translateY(0);
}

.tool-btn.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.tool-btn:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.tool-btn i {
    font-size: 11px;
}

.tool-text {
    font-weight: 700;
    font-size: 13px;
}

/* Theme Toggle - Alternador de Tema */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.theme-toggle:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.theme-toggle.active {
    background: #00bcd4;
    border-color: #00bcd4;
}

.theme-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.theme-toggle.active::after {
    transform: translateX(20px);
}

/* Skip Links - Links de Acessibilidade */
.skip-links {
    display: flex;
    gap: 8px;
}

.skip-link {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    text-decoration: none;
    opacity: 0.8;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
}

.skip-link:hover,
.skip-link:focus {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.skip-link:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

/* Estilo para elementos com foco visível quando navegado por teclado */
.skip-link:focus-visible {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

/* ===== MAIN HEADER - FAIXA 2 ===== */
.main-header {
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

/* Logo */
.header-logo {
    text-decoration: none;
    flex-shrink: 0;
    display: block;
}

.header-logo:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 4px;
    border-radius: 4px;
}

.logo-image {
    height: 50px;
    max-width: 200px;
    display: block;
}

/* Main Navigation */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.nav-item {
    position: static;
}

/* Links de Navegação */
.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    color: #1A3E74;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    border: none;
}

.nav-link:hover,
.nav-link.active {
    background: #f0f4f8;
    color: #1A3E74;
}

.nav-link:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.nav-link i:last-child {
    font-size: 10px;
    margin-left: 4px;
    transition: transform 0.2s ease;
}

.nav-item:hover .nav-link i:last-child,
.nav-item:focus-within .nav-link i:last-child {
    transform: rotate(180deg);
}

/* Mega Menu - Container Principal */
.mega-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    border-radius: 0 0 12px 12px;
    animation: slideDown 0.3s ease;
}

.nav-item:hover .mega-menu,
.nav-item:focus-within .mega-menu,
.nav-link[aria-expanded="true"] + .mega-menu {
    display: block;
}

/* Animação de abertura do mega menu */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mega-menu-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.mega-menu-column {
    position: relative;
}

/* Títulos das Colunas */
.mega-menu-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #1A3E74;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #00bcd4;
    margin: 0 0 15px 0;
    font-family: inherit;
}

.mega-menu-title i {
    font-size: 14px;
    color: #00bcd4;
}

/* Lista de Links do Mega Menu */
.mega-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu-list li {
    margin-bottom: 4px;
}

.mega-menu-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4a5568;
    text-decoration: none;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.mega-menu-list a:hover {
    background: #f0f4f8;
    color: #1A3E74;
    transform: translateX(4px);
}

.mega-menu-list a:focus {
    outline: 2px solid #00bcd4;
    outline-offset: -2px;
}

.mega-menu-list a i {
    font-size: 12px;
    color: #00bcd4;
    width: 16px;
    text-align: center;
}

/* Mega Menu - Área do Usuário (Grid Especial) */
.user-area-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.user-area-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f8fafc;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.user-area-item:hover {
    background: #f0f4f8;
    border-color: #00bcd4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.15);
}

.user-area-item:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.user-area-item i {
    width: 36px;
    height: 36px;
    background: #1A3E74;
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.user-area-item span {
    font-size: 13px;
    color: #1A3E74;
    font-weight: 500;
    line-height: 1.3;
}

/* Search Box - Caixa de Busca */
.search-box {
    display: flex;
    align-items: center;
    background: #f0f4f8;
    border-radius: 25px;
    padding: 8px 16px;
    gap: 10px;
    width: 220px;
    transition: all 0.2s ease;
}

.search-box:focus-within {
    background: #e2e8f0;
    box-shadow: 0 0 0 2px #00bcd4;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    flex: 1;
    color: #1A3E74;
    font-family: inherit;
}

.search-box input::placeholder {
    color: #94a3b8;
}

.search-box input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    cursor: pointer;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 4.586l2.293-2.293 1.414 1.414L7.414 6l2.293 2.293-1.414 1.414L6 7.414l-2.293 2.293-1.414-1.414L4.586 6l-2.293-2.293 1.414-1.414L6 4.586z'/%3E%3C/svg%3E");
}

.search-box button {
    background: none;
    border: none;
    color: #1A3E74;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    transition: color 0.2s ease;
}

.search-box button:hover {
    color: #00bcd4;
}

.search-box button:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
    border-radius: 50%;
}

/* Header Actions - Ações do Cabeçalho */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Botão de Login */
.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1A3E74;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    border: none;
    cursor: pointer;
}

.login-btn:hover {
    background: #152c4f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 62, 116, 0.3);
}

.login-btn:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.login-btn:active {
    transform: translateY(0);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #1A3E74;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
    background: #f0f4f8;
}

.mobile-menu-btn:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

/* ===== MOBILE DRAWER - Menu Mobile ===== */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 380px;
    max-width: 100%;
    height: 100%;
    background: white;
    z-index: 10001;
    transition: right 0.4s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
}

.mobile-drawer.open {
    right: 0;
}

.mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #1A3E74;
    flex-shrink: 0;
}

.mobile-drawer-header img {
    height: 35px;
    display: block;
}

.mobile-drawer-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-drawer-close:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

/* Navegação Mobile */
.mobile-nav {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav-item {
    border-bottom: 1px solid #f0f4f8;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    color: #1A3E74;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.mobile-nav-link:hover {
    color: #00bcd4;
}

.mobile-nav-link:focus {
    outline: 2px solid #00bcd4;
    outline-offset: 2px;
}

.mobile-nav-link i:first-child {
    width: 30px;
    color: #00bcd4;
    font-size: 14px;
}

.mobile-nav-link.active {
    color: #00bcd4;
}

.mobile-nav-link.active i:last-child {
    transform: rotate(180deg);
}

/* Submenu Mobile */
.mobile-submenu {
    display: none;
    padding-left: 30px;
    background: #f8fafc;
    margin: 0 -20px;
    padding: 15px 20px 15px 50px;
}

.mobile-submenu.open {
    display: block;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.mobile-submenu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: #4a5568;
    text-decoration: none;
    font-size: 14px;
    font-family: inherit;
    transition: color 0.2s ease;
}

.mobile-submenu a:hover {
    color: #1A3E74;
}

.mobile-submenu a:focus {
    outline: 2px solid #00bcd4;
    outline-offset: -2px;
}

.mobile-submenu a i {
    font-size: 12px;
    color: #00bcd4;
    width: 18px;
}

/* Footer do Mobile Drawer */
.mobile-drawer-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    flex-shrink: 0;
}

.mobile-drawer-footer .login-btn {
    width: 100%;
    justify-content: center;
}

/* ===== ESTADO ESCURO (DARK MODE) ===== */
body.dark-mode .top-bar {
    background: linear-gradient(135deg, #0d2847 0%, #1A3E74 100%);
}

body.dark-mode .main-header {
    background: #1a1a2e;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .nav-link {
    color: #e2e8f0;
}

body.dark-mode .nav-link:hover,
body.dark-mode .nav-link.active {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .mega-menu {
    background: #1a1a2e;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

body.dark-mode .mega-menu-title {
    color: #e2e8f0;
}

body.dark-mode .mega-menu-list a {
    color: #a0aec0;
}

body.dark-mode .mega-menu-list a:hover {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .user-area-item {
    background: #2d3748;
}

body.dark-mode .user-area-item:hover {
    background: #3d4a5c;
}

body.dark-mode .user-area-item span {
    color: #e2e8f0;
}

body.dark-mode .user-area-item i {
    background: #00bcd4;
}

body.dark-mode .search-box {
    background: #2d3748;
}

body.dark-mode .search-box input {
    color: #e2e8f0;
}

body.dark-mode .search-box input::placeholder {
    color: #718096;
}

body.dark-mode .search-box button {
    color: #e2e8f0;
}

body.dark-mode .mobile-drawer {
    background: #1a1a2e;
}

body.dark-mode .mobile-nav-item {
    border-color: #2d3748;
}

body.dark-mode .mobile-nav-link {
    color: #e2e8f0;
}

body.dark-mode .mobile-submenu {
    background: #2d3748;
}

body.dark-mode .mobile-submenu a {
    color: #a0aec0;
}

body.dark-mode .mobile-submenu a:hover {
    color: #e2e8f0;
}

body.dark-mode .mobile-drawer-header {
    background: #0d2847;
}

body.dark-mode .mobile-drawer-footer {
    background: #2d3748;
    border-color: #3d4a5c;
}

/* ===== RESPONSIVE - DESIGN RESPONSIVO ===== */

/* Tablets e telas menores (até 1024px) */
@media (max-width: 1024px) {
    .mega-menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-list {
        gap: 0;
    }
    
    .nav-link {
        padding: 12px 12px;
        font-size: 13px;
    }
    
    .top-bar-container {
        padding: 0 15px;
    }
    
    .header-container {
        padding: 0 15px;
    }
    
    .search-box {
        width: 180px;
    }
}

/* Tablets em portrait e celulares grandes (até 768px) */
@media (max-width: 768px) {
    .top-bar-container {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 15px;
        gap: 10px;
    }
    
    .top-bar-left {
        order: 1;
    }
    
    .top-bar-right {
        order: 2;
    }
    
    .top-bar-tools {
        position: static;
        transform: none;
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .skip-links {
        display: none;
    }
    
    .tool-btn {
        padding: 5px 10px;
    }
    
    .tool-text {
        display: none;
    }
    
    .tool-btn i {
        margin: 0;
    }
    
    .main-nav {
        display: none;
    }
    
    .search-box {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .login-btn span {
        display: none;
    }
    
    .login-btn {
        padding: 10px 12px;
    }
    
    .header-container {
        height: 64px;
    }
    
    .mega-menu {
        position: static;
        box-shadow: none;
        border-radius: 0;
        animation: none;
    }
    
    .mega-menu-container {
        padding: 15px;
    }
    
    .mega-menu-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .mega-menu-column {
        grid-column: span 1 !important;
    }
    
    .user-area-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-drawer-overlay.active {
        display: block;
    }
}

/* Celulares pequenos (até 480px) */
@media (max-width: 480px) {
    .top-bar-left,
    .top-bar-right {
        font-size: 11px;
        gap: 10px;
    }
    
    .top-bar-item {
        gap: 4px;
    }
    
    .tool-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .theme-toggle {
        width: 40px;
        height: 22px;
    }
    
    .theme-toggle::after {
        width: 16px;
        height: 16px;
    }
    
    .theme-toggle.active::after {
        transform: translateX(18px);
    }
    
    .header-container {
        padding: 0 10px;
    }
    
    .logo-image {
        height: 40px;
        max-width: 150px;
    }
    
    .mobile-drawer {
        width: 100%;
        right: -100%;
    }
    
    .mobile-drawer.open {
        right: 0;
    }
    
    .mobile-drawer-header {
        padding: 15px;
    }
    
    .mobile-nav {
        padding: 15px;
    }
    
    .mobile-nav-link {
        font-size: 14px;
        padding: 12px 0;
    }
}

/* Altura mínima para dispositivos muito pequenos */
@media (max-width: 360px) {
    .top-bar-tools {
        gap: 4px;
    }
    
    .tool-btn {
        padding: 4px 6px;
    }
    
    .top-bar-left,
    .top-bar-right {
        font-size: 10px;
    }
}

/* Ajuste de fonte para acessibilidade */
@media (prefers-reduced-motion: reduce) {
    .mega-menu,
    .mobile-drawer,
    .mobile-drawer-overlay,
    .nav-link,
    .user-area-item,
    .mega-menu-list a,
    .theme-toggle::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Impressão */
@media print {
    .top-bar,
    .mobile-drawer,
    .mobile-drawer-overlay,
    .search-box,
    .header-actions {
        display: none !important;
    }
    
    .main-header {
        box-shadow: none;
        position: static;
    }
    
    .header-container {
        height: auto;
        padding: 10px 0;
    }
    
    .nav-list {
        flex-wrap: wrap;
    }
}
