/* --- Variáveis e Root --- */
:root {
    --primary-bg: #0f1115;
    --sidebar-bg: #1a1c23;
    --card-bg: #24262d;
    --text-color: #e5e7eb;
    --ols-green: #97d700;
    --ols-blue: #3498db;
    --border-color: #333;
    --sidebar-width: 260px;
    --header-height: 60px;
}

* { box-sizing: border-box; }

body {
    background-color: var(--primary-bg);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* --- Controle de Layout --- */
body:not(.dashboard-body) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-body {
    display: block;
    padding-top: var(--header-height);
    overflow-x: hidden;
}

/* --- Header Fixo --- */
.top-header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--sidebar-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1001;
    border-bottom: 1px solid var(--border-color);
}

/* --- Bloco de Busca --- */
.header-search {
    flex: 1;
    max-width: 500px;
    margin: 0 25px;
}

.search-highlight {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #ffffff;
    border-radius: 20px;
    padding: 2px 15px;
    transition: 0.3s;
}

.search-highlight:focus-within {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.search-input {
    background: transparent;
    border: none;
    color: #ffffff;
    padding: 8px 10px;
    width: 100%;
    outline: none;
    font-size: 0.9rem;
}

.search-input::placeholder { color: #888; }
.search-icon { color: #ffffff; font-size: 0.85rem; }

/* --- Usuário e Saída --- */
.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
    white-space: nowrap;
}

.header-user .btn-exit {
    color: #ff4d4d;
    text-decoration: none;
    font-size: 1.2rem;
    transition: 0.3s;
}

.header-user .btn-exit:hover { transform: scale(1.1); }

/* --- Sidebar Lateral (MODIFICADO APENAS PARA ROLAGEM) --- */
.sidebar {
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    position: fixed;
    top: var(--header-height);
    left: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.3s ease;
    /* AS ÚNICAS DUAS LINHAS ADICIONADAS: */
    overflow-y: auto;
    overflow-x: hidden;
}

/* Pequeno ajuste visual para a barra de rolagem não ser a padrão cinza do Windows */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }

.sidebar-nav { padding: 10px 0; flex-grow: 1; }
.sidebar-nav a {
    display: block;
    padding: 15px 25px;
    color: #888;
    text-decoration: none;
    transition: 0.3s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sidebar-nav a i { margin-right: 10px; width: 20px; text-align: center; }

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--card-bg);
    color: var(--ols-green);
    border-left: 4px solid var(--ols-green);
}

/* --- Área de Conteúdo (BACKUP) --- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: calc(100vh - var(--header-height) - 60px);
    transition: margin-left 0.3s ease;
}

.welcome-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* --- Cards de Estatísticas --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card { padding: 25px; border-radius: 10px; color: white; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.stat-card h3 { font-size: 2rem; margin: 0; }
.stat-card p { margin: 5px 0 0; opacity: 0.8; font-size: 0.9rem; }

.stat-card.blue { background: #3498db; }
.stat-card.orange { background: #f39c12; }
.stat-card.green { background: #27ae60; }
.stat-card.red { background: #e74c3c; }
.stat-card.yellow { background: #f1c40f; color: #000; }

/* --- Tabelas OLS --- */
.ols-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
}

.ols-table th, .ols-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border-color); }
.ols-table th { background: #2f313a; color: #888; font-weight: normal; font-size: 0.85rem; text-transform: uppercase; }
.ols-table tr:hover { background: rgba(255,255,255,0.02); }

/* --- Badges de Status --- */
.badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    display: inline-block;
}

.status-open { background: rgba(52, 152, 219, 0.2); color: #3498db; }
.status-atendimento, .status-em_atendimento { background: rgba(241, 196, 15, 0.2); color: #f1c40f; }
.status-pendente { background: rgba(149, 165, 166, 0.2); color: #95a5a6; }
.status-resolvido { background: rgba(39, 174, 96, 0.2); color: #27ae60; }

/* --- Formulários e Botões --- */
.login-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 450px;
}

.form-group { margin-bottom: 1.2rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: #bbb; }

.form-control {
    width: 100%;
    height: 45px;
    padding: 0 12px;
    line-height: 45px;
    border-radius: 6px;
    border: 1px solid #3f414a;
    background: #2f313a;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: 0.3s;
}

.form-control:focus { border-color: var(--ols-green); }

.btn-login {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--ols-green);
    border: none;
    border-radius: 6px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    text-align: center;
    text-transform: uppercase;
    font-size: 0.85rem;
    text-decoration: none;
}

.btn-login:hover { background-color: #b1f000; transform: translateY(-2px); }

/* --- Footer --- */
.main-footer {
    margin-left: var(--sidebar-width);
    padding: 20px;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    color: #666;
    text-align: center;
    font-size: 0.8rem;
    transition: margin-left 0.3s ease;
}

/* --- REGRAS DO MENU FECHADO (MANTIDAS) --- */
.sidebar.collapsed { 
    width: 70px !important; 
}
.main-content.expanded, .main-footer.expanded { 
    margin-left: 70px !important; 
}
.sidebar.collapsed span, 
.sidebar.collapsed .section-title, 
.sidebar.collapsed hr { 
    display: none !important; 
}
.sidebar.collapsed a { 
    text-align: center; 
    padding: 15px 0; 
}
.sidebar.collapsed a i { 
    margin-right: 0; 
}

/* --- Responsividade --- */
@media (max-width: 768px) {
    .sidebar { width: 70px; }
    .sidebar-nav a span { display: none; }
    .main-content, .main-footer { margin-left: 70px; }
    .header-search { max-width: 150px; margin: 0 10px; }
}

/* --- ANIMAÇÃO DE ALERTA --- */
@keyframes blink-red {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); box-shadow: 0 0 20px rgba(231, 76, 60, 0.6); }
    100% { opacity: 1; transform: scale(1); }
}

.blink-alert {
    animation: blink-red 1s infinite;
    border: 2px solid #fff !important;
}