/* =========================================
   1. RESET E VARI�VEIS GLOBAIS
   ========================================= */
:root {
    --c-orange: #f58634;
    --c-orange-dark: #d94e00;
    --c-bg-body: #f4f7fa; /* Cinza azulado muito leve (Moderno) */
    --c-text-dark: #2d3748;
    --sidebar-width: 260px;
}

body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: var(--c-bg-body);
    overflow: hidden; /* O layout gerencia o scroll */
}

/* =========================================
   2. LAYOUT GRID (ESTRUTURA PRINCIPAL)
   ========================================= */
.layout-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- A SIDEBAR (Laranja Refinado) --- */
.layout-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(175deg, #ff9a4d 0%, #f06c1a 45%, #d95200 100%);
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 24px rgba(217, 82, 0, 0.30);
    z-index: 20;
    position: relative;
}

/* --- A �REA PRINCIPAL (Direita) --- */
.layout-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--c-bg-body);
    position: relative;
}

/* --- O HEADER (BRANCO - O Respiro Visual) --- */
.layout-header {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 2rem;
    flex-shrink: 0;
}

.header-content {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Avatarzinho simples do Header */
.avatar {
    width: 35px;
    height: 35px;
    background-color: var(--c-bg-body);
    color: var(--c-orange);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid var(--c-orange);
}

/* --- O CORPO DA P�GINA --- */
.layout-body {
    flex-grow: 1;
    overflow-y: auto; /* Scroll acontece aqui dentro */
    padding: 2rem;
}

.content-wrapper {
    max-width: 1400px; /* Limita largura em telas gigantes */
    margin: 0 auto;
}

/* =========================================
   3. ESTILO DO MENU (Dentro da Sidebar)
   ========================================= */
.sidebar-header {
    height: 70px; /* Alinha com a altura do Header Branco */
    display: flex;
    align-items: center;
    padding-left: 1.5rem;
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.brand-logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu-container {
    padding: 0.75rem 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* LINKS DO MENU */
.nav-item-custom a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    border: none;
}

    .nav-item-custom a i {
        font-size: 1rem;
        opacity: 0.85;
        flex-shrink: 0;
    }

    /* HOVER — glassmorphism suave */
    .nav-item-custom a:hover {
        background: rgba(255, 255, 255, 0.18);
        backdrop-filter: blur(4px);
        color: white;
    }

    /* ATIVO — pílula branca com sombra */
    .nav-item-custom a.active {
        background: rgba(255, 255, 255, 0.97);
        color: #c2410c !important;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
        font-weight: 700;
    }

        .nav-item-custom a.active i {
            color: #ea580c;
            opacity: 1;
        }

/* ===============================================
   4. ESTILO DO LOGIN (CARD CENTRALIZADO)
   =============================================== */

/* O container que centraliza tudo na tela */
.login-wrapper-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    width: 100%;
}

/* O Cart�o Branco */
.login-card {
    background-color: #ffffff;
    width: 100%;
    max-width: 450px;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.login-title {
    color: var(--c-text-dark);
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: #a0aec0;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.login-logo-area {
    margin-bottom: 2rem;
    color: var(--c-orange);
}

/* Inputs de Login (For�ando Branco e Limpo) */
.form-floating > .form-control {
    border: 1px solid #ced4da;
    background-color: #ffffff !important; /* Fundo Branco Obrigat�rio */
    border-radius: 8px;
    color: #333;
}

    .form-floating > .form-control:focus {
        background-color: #fff;
        border-color: var(--c-orange);
        box-shadow: 0 0 0 3px rgba(245, 134, 52, 0.15);
    }

.form-floating > label {
    color: #a0aec0;
}

/* ===============================================
   5. BOT�ES (A CORRE��O DO BRANCO SOBRE BRANCO)
   =============================================== */

.btn-celmi {
    /* Gradiente Laranja FOR�ADO */
    background: linear-gradient(90deg, var(--c-orange) 0%, var(--c-orange-dark) 100%) !important;
    color: #ffffff !important; /* Texto Branco */
    border: none !important;
    /* Estilo */
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
}

    .btn-celmi:hover {
        /* Inverte gradiente e sobe */
        background: linear-gradient(90deg, var(--c-orange-dark) 0%, var(--c-orange) 100%) !important;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(245, 134, 52, 0.4);
    }

/* ===============================================
   6. SIDEBAR COLLAPSED & RESPONSIVE MOBILE
   =============================================== */
.sidebar-collapsed {
    --sidebar-width: 80px;
}

.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-section-title,
.sidebar-collapsed .nav-chevron {
    display: none !important;
}

.sidebar-collapsed .nav-section-toggle {
    justify-content: center;
    padding: 12px 0;
}

.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
}

.sidebar-collapsed .nav-icon {
    margin: 0 !important;
    font-size: 1.25rem;
}

.sidebar-collapsed .nav-user-section {
    justify-content: center;
    padding: 12px 0;
}

.sidebar-collapsed .nav-user-name {
    display: none !important;
}

/* Transição suave do tamanho da sidebar */
.layout-sidebar, .layout-main {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Responsividade Mobile e Tablet */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: 260px;
    }

    .layout-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
    }

    .mobile-open .layout-sidebar {
        transform: translateX(0);
    }

    /* Backdrop Overlay */
    .layout-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        z-index: 999;
    }

    .mobile-open .layout-backdrop {
        display: block;
    }
}

/* Tooltip Customizado para Sidebar Colapsada */
.sidebar-collapsed [data-tooltip] {
    position: relative;
}

.sidebar-collapsed [data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    background: rgba(33, 37, 41, 0.95);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.sidebar-collapsed [data-tooltip]:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* ===============================================
   7. RECONEXAO DO BLAZOR (apos deploy/queda de circuito)
   =============================================== */
#components-reconnect-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    align-items: center;
    justify-content: center;
    background: rgba(45, 55, 72, 0.55);
    backdrop-filter: blur(2px);
    color: #ffffff;
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.95rem;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

#components-reconnect-modal .reconnect-box {
    background: #ffffff;
    color: var(--c-text-dark);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
}

#components-reconnect-modal .reconnect-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(245, 134, 52, 0.25);
    border-top-color: var(--c-orange);
    border-radius: 50%;
    animation: reconnect-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}
