/* =========================================================
    1. VARIÁVEIS GERAIS (Design System)
========================================================= */
:root {
    --bg-body: #f4f7fe;
    --bg-card: #ffffff;
    --text-primary: #2b3674;
    --text-secondary: #a3aed0;

    --primary-color: #4318ff;
    --primary-hover: #3311db;
    --accent-green: #05cd99;
    --accent-orange: #ffb547;
    --accent-red: #ee5d50;

    --shadow-soft: 0px 3px 15px rgba(112, 144, 176, 0.08);
    --shadow-hover: 0px 8px 25px rgba(112, 144, 176, 0.15);
    --radius-card: 20px;
    --radius-btn: 12px;
}

/* =========================================================
    2. BASE E SCROLLBARS globais
========================================================= */
body {
    background-color: var(--bg-body);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbars Customizados (Fica elegante no Windows/Linux) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* =========================================================
    3. UTILITÁRIOS GERAIS
========================================================= */
.hidden {
    display: none !important;
}

.cursor-pointer {
    cursor: pointer;
}

.min-h-500 {
    min-height: 500px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Hover com elevação suave (Migrado do Index) */
.hover-shadow {
    transition: all 0.3s ease-in-out;
}

.hover-shadow:hover {
    box-shadow: var(--shadow-hover) !important;
    transform: translateY(-3px);
}

/* =========================================================
    4. TELA DE LOGIN
========================================================= */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #868CFF 100%);
    /* Adiciona um efeito sutil de padrão ao fundo */
    background-image: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1) 0%, transparent 60%),
        linear-gradient(135deg, var(--primary-color) 0%, #868CFF 100%);
}

.login-card {
    border-radius: var(--radius-card);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
    5. LAYOUT DO DASHBOARD & CARDS
========================================================= */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-out forwards;
}

.card-modern {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: none;
    box-shadow: var(--shadow-soft);
    padding: 24px;
    height: 100%;
    transition: all 0.3s ease;
}

/* Contêiner do Filtro de Empresas (Migrado do Index) */
#adminCompanySummaryContainer {
    scroll-behavior: smooth;
    padding-bottom: 8px;
    /* Dá espaço para o scrollbar customizado não cortar o card */
}

/* =========================================================
    6. COMPONENTES: KPIs E STATUS
========================================================= */
.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: var(--text-primary);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

/* Pontos de Status Coloridos */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-active {
    background-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(5, 205, 153, 0.2);
}

.status-warning {
    background-color: var(--accent-orange);
    box-shadow: 0 0 0 3px rgba(255, 181, 71, 0.2);
}

.status-danger {
    background-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(238, 93, 80, 0.2);
}

/* Caixa de Ícone da Tabela */
.asset-icon-box {
    width: 42px;
    height: 42px;
    background: #eef2ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* =========================================================
    7. COMPONENTES: TABELAS E BOTÕES
========================================================= */
.table-modern {
    margin-bottom: 0;
}

.table-modern thead th {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9edf7;
    padding: 16px 12px;
    white-space: nowrap;
}

.table-modern tbody td {
    padding: 16px 12px;
    vertical-align: middle;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px solid #f0f3f8;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* Botão Principal Customizado */
.btn-modern-primary {
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--radius-btn);
    padding: 10px 24px;
    font-weight: 600;
    border: none;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-modern-primary:hover,
.btn-modern-primary:focus {
    background-color: var(--primary-hover);
    color: white;
}

.btn-modern-primary:active {
    transform: scale(0.97);
}

/* =========================================================
    8. MODAIS E CONFIGURAÇÕES
========================================================= */
.modal-content {
    border-radius: var(--radius-card);
    border: none;
}

.modal-header {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
}

/* Menu Lateral de Configurações */
.settings-nav .list-group-item {
    border: none;
    border-radius: 10px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 16px;
    transition: all 0.2s;
}

.settings-nav .list-group-item:hover:not(.active) {
    background-color: #e9edf7;
    color: var(--text-primary);
}

.settings-nav .list-group-item.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(67, 24, 255, 0.25);
}

/* =========================================================
    9. PLUGINS (Tom Select / Select2 / Multi Tags)
========================================================= */
.multi-select-tag {
    display: inline-block;
    background: #eef2ff;
    color: var(--primary-color);
    border-radius: 6px;
    padding: 4px 10px;
    margin: 2px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #d0d7f9;
}

/* Correção do campo do TomSelect para bater com o visual do Bootstrap 5 */
.ts-wrapper.form-control {
    padding: 0;
    border: none;
    box-shadow: none;
}

.ts-control {
    border-radius: 0.375rem;
    /* Padrão Bootstrap 5 */
    border: 1px solid #dee2e6;
    padding: 0.375rem 0.75rem;
    min-height: calc(1.5em + 0.75rem + 2px);
}

.ts-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* CORREÇÃO TOMSELECT NO BOOTSTRAP MODAL */
.ts-dropdown {
    z-index: 1060 !important;
    /* O Modal do Bootstrap usa 1055, então 1060 garante que a lista fique por cima */
}