:root {
    --primary: #0f62fe;
    --primary-rgb: 15, 98, 254;
    --primary-hover: #0353e9;
    --bg-color: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --input-bg: #f9fafb;
    --focus-ring: rgba(15, 98, 254, 0.25);

    /* Imagem local fornecida para o lado esquerdo */
    /* --visual-bg: url('../img/logo_grande.jpg'); */
    --visual-bg: url('../img/login_logo.png');

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--bg-color);
    min-height: 100vh;
    overflow-x: hidden;
}

.split-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Lado Esquerdo - Visual */
.visual-side {
    flex: 1;
    position: relative;
    background-image: var(--visual-bg);
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: none;
    /* Escondido por padrão no Mobile */
    align-items: flex-start;
    padding: 1rem;
    /* border-right: 1px solid var(--border-color); */
    /* borda separando os elementos do login */
}

@media (min-width: 900px) {
    .visual-side {
        display: flex;
        opacity: 0;
        animation: fadeIn 1.2s ease forwards;
    }
}

.overlay-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(17, 24, 39, 0.95) 0%, rgba(17, 24, 39, 0.2) 100%);
    z-index: 1;
}

.visual-content {
    position: relative;
    z-index: 2;
    color: white;
    max-width: 500px;
}

.visual-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.visual-content p {
    font-size: 1.125rem;
    color: #e5e7eb;
    line-height: 1.6;
}

/* Lado Direito - Autenticação */
.auth-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 2.5rem 2rem;
    background-color: var(--bg-color);
    overflow-y: auto;
}

.auth-container {
    width: 100%;
    max-width: 380px;
    margin: auto;
}

.brand {
    margin-bottom: 1.5rem;
    text-align: left;
}

.logo {
    max-height: 45px;
    width: auto;
    object-fit: contain;
}

h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.8rem;
    font-size: 0.9rem;
}

/* Formulário */
.login-form {
    display: flex;
    flex-direction: column;
}

.input-group {
    position: relative;
    margin-bottom: 1.2rem;
}

.input-group .icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.3s ease;
    z-index: 2;
}

.input-group input {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 3rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--input-bg);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
    background-color: #ffffff;
}

.input-group input:focus~.icon {
    color: var(--primary);
}

.password-tools {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.forgot-password {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.toggle-password {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s ease;
    z-index: 2;
}

.toggle-password:hover {
    color: var(--text-main);
}

/* Botão */
.btn-primary {
    width: 100%;
    padding: 0.85rem;
    margin-top: 0.75rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(15, 98, 254, 0.1), 0 2px 4px -1px rgba(15, 98, 254, 0.06);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(15, 98, 254, 0.2), 0 4px 6px -2px rgba(15, 98, 254, 0.1);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Rodapé */
.support-footer {
    margin-top: 1.5rem;
    text-align: center;
    width: 100%;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.support-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.support-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Micro-Animações */
.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

.fade-in {
    animation: fadeIn 1s ease forwards;
    opacity: 0;
}

.delay-1 {
    animation-delay: 0.15s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Responsividade Aprimorada */
@media (max-width: 899px) {
    .split-layout {
        flex-direction: column;
    }

    .visual-side {
        display: none;
    }

    .auth-side {
        flex: 1;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 2rem;
    }

    .auth-container {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }

    .support-footer {
        margin-top: 3rem;
    }
}

/* --- ESTILOS UNIFICADOS DO TOOLBAR --- */

.header-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    /* Mais quadradinho */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    height: 48px;
    /* Altura fixa para alinhar perfeitamente */
}

.header-selector:hover,
.header-selector.active {
    background: #e2e8f0;
    border-color: #cbd5e1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.header-selector:hover i.fa-chevron-down {
    color: var(--primary);
}

/* Estilos internos para Empresa */
.company-context {
    border: none !important;
    /* Reseta as bordas antigas */
    padding: 0 !important;
}

/* Estilos internos para Perfil */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- DROPDOWNS --- */

.company-dropdown-menu,
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    border: 1px solid #edf2f7;
    overflow: visible;
    animation: premiumFadeIn 0.2s ease-out forwards;
}

.company-dropdown-menu {
    min-width: 100%;
    width: max-content;
    max-width: 320px;
}

.user-dropdown-menu {
    width: 200px;
}

.company-dropdown-menu::before,
.user-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-top: 1px solid #edf2f7;
    border-left: 1px solid #edf2f7;
    z-index: 1;
}

@keyframes premiumFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.company-dropdown-menu ul,
.user-dropdown-menu ul {
    list-style: none;
    padding: 8px;
    margin: 0;
}

.company-dropdown-menu li,
.user-dropdown-menu li {
    padding: 12px 15px;
    font-size: 0.9rem;
    color: #4a5568;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-dropdown-menu li:hover,
.user-dropdown-menu li:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.company-dropdown-menu li:hover i,
.user-dropdown-menu li:hover i {
    color: var(--primary);
    opacity: 1;
}

/* Overlay de Carregamento FullScreen */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    text-align: center;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loader-content i {
    font-size: 3rem;
    color: var(--primary);
}

.loader-content span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.loader-content p {
    color: var(--text-muted);
}

/* --- DROPDOWN DE EMPRESA NO LOGIN (STEP 2) --- */
.step-dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-trigger {
    width: 100%;
    padding: 1.1rem 1.25rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-main);
}

.dropdown-trigger:hover {
    border-color: var(--primary);
    background: white;
}

.dropdown-trigger.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.1);
}

.dropdown-options-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-height: min(250px, 36vh);
    overflow-y: auto;
    padding: 6px;
    -webkit-overflow-scrolling: touch;
    animation: premiumFadeIn 0.2s ease-out;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
    font-weight: 500;
}

.option-item i {
    color: var(--primary);
    font-size: 0.9rem;
    opacity: 0.6;
}

.option-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.option-item:hover i {
    opacity: 1;
}

/* Custom Scrollbar para o dropdown */
.dropdown-options-list::-webkit-scrollbar {
    width: 5px;
}

.dropdown-options-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

/* --- ESTILOS DE LOGOTIPO NO DROPDOWN --- */
.company-logo-mini {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.company-logo-mini img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.company-logo-mini i {
    font-size: 0.85rem;
    color: var(--primary);
    opacity: 0.8;
}

/* --- MODAL DE ERRO INTELIGENTE --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-icon {
    width: 64px;
    height: 64px;
    background: #fef2f2;
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    margin: 0 auto 1.5rem;
}

.modal-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

.modal-content p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.btn-modal-close {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-close:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Animação de erro inteligente */
@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* =========================================================
   FORMULÁRIO DE SENHA INLINE NO DROPDOWN
   ========================================================= */
.user-dropdown-menu {
    /* Transição suave de altura quando o conteúdo muda */
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#dropdownMenuView,
#dropdownPasswordView {
    width: 100%;
    animation: fadeIn 0.2s ease;
}

.inline-pwd-view {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 240px;
    /* Alarga um pouquinho para os inputs caberem bem */
}

.inline-pwd-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.btn-back-dropdown {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-back-dropdown:hover {
    background: #f3f4f6;
    color: var(--text-main);
}

.inline-pwd-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inline-pwd-input-wrap {
    position: relative;
    width: 100%;
}

.inline-pwd-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 30px 8px 10px;
    /* Mais padding na direita para o botão do olho */
    color: var(--text-main);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.inline-pwd-input:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.inline-pwd-input::placeholder {
    color: var(--text-muted);
}

.inline-pwd-eye {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.inline-pwd-eye:hover {
    color: var(--primary);
}

.inline-pwd-msg {
    font-size: 0.75rem;
    padding: 6px;
    border-radius: 4px;
    text-align: center;
}

.inline-pwd-msg.erro {
    background: #fee2e2;
    color: #ef4444;
}

.inline-pwd-msg.sucesso {
    background: #dcfce3;
    color: #22c55e;
}

.inline-pwd-btn {
    width: 100%;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    padding: 8px;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.inline-pwd-btn:hover {
    background: var(--primary-hover);
}

.inline-pwd-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================
   SELETOR AGRUPADO - ACCORDION COM CORES
   ========================================================= */

.dropdown-options-list {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    max-height: min(250px, 36vh);
    padding: 6px;
    -webkit-overflow-scrolling: touch;
}

/* ---- GRUPO WRAPPER ---- */
.dropdown-group-wrapper {
    margin-bottom: 4px;
    border-radius: 8px;
    overflow: hidden;
}

.dropdown-group-wrapper:last-child {
    margin-bottom: 0;
}

/* ---- CABEÇALHO DO GRUPO (clicável) ---- */
.dropdown-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
    user-select: none;
}

.dropdown-group-header:hover {
    background: #f8fafc;
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.group-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.group-name {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #334155;
}

.group-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.group-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.4;
}

.group-chevron {
    font-size: 0.65rem;
    color: #94a3b8;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Seta rotaciona quando colapsado */
.dropdown-group-header.collapsed .group-chevron {
    transform: rotate(-90deg);
}

/* ---- CONTAINER DAS EMPRESAS (Colapsável) ---- */
.dropdown-group-companies {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.dropdown-group-companies.expanded {
    grid-template-rows: 1fr;
}

.group-companies-inner {
    overflow: hidden;
    min-height: 0;
    /* Necessário para o grid collapse funcionar */
}

/* ---- ITEM DE EMPRESA (Animado) ---- */
.grouped-item {
    margin: 2px 4px;
    padding: 10px 14px 10px 38px !important;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    cursor: pointer;
}

.grouped-item i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.grouped-item span {
    font-size: 0.88rem;
    font-weight: 500;
    color: #475569;
    transition: color 0.2s ease;
    white-space: normal;
    word-break: break-word;
}

/* Barra lateral colorida que aparece no hover */
.grouped-item::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    width: 3px;
    height: 0;
    background: var(--group-accent, var(--primary));
    border-radius: 4px;
    transform: translateY(-50%);
    transition: height 0.25s ease, opacity 0.25s ease;
    opacity: 0;
}

.grouped-item:hover {
    background: #f8fafc;
    padding-left: 42px !important;
}

.grouped-item:hover::before {
    height: 18px;
    opacity: 1;
}

.grouped-item:hover i {
    color: var(--group-accent, var(--primary));
}

.grouped-item:hover span {
    color: #1e293b;
}

/* ---- SCROLLBAR ---- */
.dropdown-options-list::-webkit-scrollbar {
    width: 5px;
}

.dropdown-options-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* ---- AJUSTES DE ALTURA RESPONSIVA (NOTEBOOKS / DISPOSITIVOS MENORES / MOBILE) ---- */
@media (max-height: 800px) {
    .logo {
        max-height: 95px;
    }

    .brand {
        margin-bottom: 1rem;
    }

    .subtitle {
        margin-bottom: 1.2rem;
    }

    .dropdown-options-list {
        max-height: min(220px, 32vh);
    }
}

@media (max-height: 680px) {
    .logo {
        max-height: 70px;
    }

    .brand {
        margin-bottom: 0.5rem;
    }

    .subtitle {
        margin-bottom: 1rem;
    }

    .auth-side {
        padding: 1.25rem 1rem;
    }

    .dropdown-options-list {
        max-height: min(180px, 30vh);
    }
}