@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

/* =========================================================================
   GRUPO ALV - DESIGN SYSTEM CORPORATIVO
   ========================================================================= */

:root {
    /* Paleta Principal ALV */
    --alv-primary-dark: #003756;
    --alv-primary-800:  #01426A;
    --alv-primary-500:  #0067B9;
    --alv-primary-100:  #EAF4FB; /* Seleção Clara */
    
    --alv-green:        #85B84F; /* Verde Institucional */
    
    /* Estruturais (Backgrounds e Bordas) */
    --bg-main:   #F5F6F8;
    --bg-card:   #FFFFFF;
    --line:      #E2E6EA;
    
    /* Tipografia e Ícones */
    --text-main: #101828;
    --text-sec:  #667085;
    --text-menu: #475467;
    --icon-gray: #98A2B3;
    
    /* Cores Semânticas (Strict) */
    --success:   #168A45;
    --warning:   #C97700;
    --danger:    #D92D20;
    --info:      var(--alv-primary-500);
    
    /* Sombras e Raios SaaS Modernos */
    --shadow-flat:  0 1px 3px rgba(16, 24, 40, 0.08);
    --radius-sm:    6px;
    --radius-md:    8px;
    --radius-card:  10px;
}

/* ==================================================
   RESET & TIPOGRAFIA BASE
   ================================================== */
body {
    font-family: 'Montserrat', Arial, sans-serif;
    color: var(--text-main);
    background: var(--bg-main);
    line-height: 1.5;
    margin: 0;
    font-size: 14px;
}
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    color: var(--text-main);
    font-weight: 600;
}

/* Tipografia Hierarquia */
.text-display { font-size: 32px; font-weight: 700; line-height: 40px; }
.text-page-title { font-size: 24px; font-weight: 700; line-height: 32px; }
.text-section-title { font-size: 18px; font-weight: 600; line-height: 26px; }
.text-card-title { font-size: 14px; font-weight: 600; line-height: 20px; }
.text-body { font-size: 14px; font-weight: 400; line-height: 21px; }
.text-aux { font-size: 12px; font-weight: 400; line-height: 18px; }

/* ==================================================
   LAYOUT E ESTRUTURA GLOBAL
   ================================================== */
.integrator-shell {
    display: flex;
    min-height: 100vh;
}
.integrator-main {
    flex-grow: 1;
    min-width: 0; /* Impede overflow horizontal flex */
    display: flex;
    flex-direction: column;
}

/* Sidebar */
.integrator-sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--line);
    padding: 0;
    width: 212px; /* 208 a 220px */
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.integrator-brand {
    display: flex;
    justify-content: center;
    border-bottom: 0;
    margin: 16px 0 24px 0;
}
.integrator-brand img {
    filter: none;
    max-width: 120px;
    height: auto;
}
.integrator-brand span { display: none; } /* Ocultar texto que compete com menu */

.integrator-sidebar nav {
    padding: 0 14px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px; /* Espaço vertical reduzido */
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}
.integrator-sidebar nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari e Opera */
}
.integrator-sidebar nav a {
    color: var(--text-menu);
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 0 14px;
    height: 40px; /* Mais compacto */
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    text-decoration: none;
    border: none;
    transition: all 0.2s ease;
}
.integrator-sidebar i {
    color: var(--icon-gray);
    font-size: 18px; /* Padronizado */
    width: 20px;
    text-align: center;
}
.integrator-sidebar nav a:hover {
    background: #F9FAFB;
    color: var(--text-main);
}
.integrator-sidebar nav a.active {
    background: var(--alv-primary-100);
    color: var(--alv-primary-800);
    font-weight: 600;
}
.integrator-sidebar nav a.active i {
    color: var(--alv-primary-800);
}

/* Header */
.integrator-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--line);
    height: 60px; /* Reduzido de 68/72 */
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.integrator-header > div {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}
.environment-badge {
    background: var(--alv-primary-100);
    color: var(--alv-primary-800);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
}
.admin-user span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}
.admin-user button, .header-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sec);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}
.admin-user button:hover, .header-link:hover { color: var(--alv-primary-800); }

/* Main Content Area */
.integrator-content {
    padding: 28px 32px 40px; /* Topo mais próximo (28px), lateral 32px */
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
}

/* Toolbar & Breadcrumb */
.integrator-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}
.breadcrumb {
    font-size: 13px;
    color: var(--text-sec);
}
.breadcrumb a { color: var(--text-sec); text-decoration: none; }
.breadcrumb strong { font-weight: 500; color: var(--text-main); }
.breadcrumb span { margin: 0 8px; color: var(--icon-gray); }
.last-updated { font-size: 12px; color: var(--text-sec); }

/* Cabeçalho da Página (Centro de operações) */
.admin-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.admin-heading h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 4px 0;
    line-height: 30px;
}
.admin-heading p {
    font-size: 14px;
    color: var(--text-sec);
    line-height: 20px;
    margin: 0;
    max-width: 600px;
}

/* ==================================================
   BOTÕES (SaaS Refinements)
   ================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px; /* Mais curtos */
    padding: 0 14px; /* Menor padding lateral */
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
}
.btn i { font-size: 16px; }
.btn:focus { outline: 2px solid transparent; box-shadow: 0 0 0 4px rgba(20, 121, 184, 0.25); }

.btn-primary, .refresh-button {
    background: var(--alv-primary-800) !important;
    color: var(--bg-card) !important;
}
.btn-primary:hover, .refresh-button:hover { background: var(--alv-primary-dark) !important; }

/* Adicionado estado disabled / loading */
.btn:disabled, .btn.loading {
    opacity: 0.7;
    pointer-events: none;
}
.spin-icon { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* ==================================================
   CARDS E INDICADORES
   ================================================== */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px; /* Ajustado */
    margin-bottom: 24px;
}
.dashboard-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Balanceado ao invés de 1.3 / 0.7 se for painéis iguais, senão manteremos grid no html */
    gap: 16px;
}

.admin-panel, .metric-card, .health-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--line) !important;
    box-shadow: var(--shadow-flat);
    padding: 20px; /* Reduzido de 24 */
}
.metric-card {
    min-height: 112px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.metric-card span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-sec); /* #667085 */
    margin-bottom: 8px;
    display: block;
}
.metric-card strong {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
}
.metric-card small {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--alv-primary-800);
    margin-top: 8px;
    text-decoration: none;
}
.metric-card small:hover { text-decoration: underline; }

/* Seções inferiores (Painéis) */
.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}
.panel-heading h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}
.panel-heading p {
    font-size: 14px;
    color: var(--text-sec);
    margin: 4px 0 0;
}
.panel-heading a {
    font-size: 14px;
    font-weight: 500;
    color: var(--alv-primary-500);
    text-decoration: none;
}
.panel-heading a:hover { color: var(--alv-primary-800); }

/* Heath List - Limpeza */
.health-list > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.health-list > div:first-child { border-top: none; }
.health-list strong { font-size: 14px; color: var(--text-main); }
.health-list p { font-size: 13px; color: var(--text-sec); margin: 2px 0 0; }

.empty-state {
    padding: 32px 16px;
    text-align: center;
}
.empty-state i {
    font-size: 24px;
    color: var(--success);
    margin-bottom: 12px;
}
.empty-state strong { display: block; font-size: 16px; color: var(--text-main); margin-bottom: 4px; }
.empty-state p { font-size: 14px; color: var(--text-sec); }

/* ==================================================
   RESPONSIVIDADE (MEDIA QUERIES)
   ================================================== */
@media(max-width: 1199px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-columns { grid-template-columns: 1fr; }
}
@media(max-width: 767px) {
    .integrator-shell { flex-direction: column; }
    .integrator-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding-bottom: 16px;
    }
    .integrator-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .integrator-header { padding: 0 16px; height: 56px; }
    .integrator-content { padding: 16px; }
    .metric-grid { grid-template-columns: 1fr; }
    .admin-heading { flex-direction: column; align-items: flex-start; gap: 16px; }
    .header-title { font-size: 18px; }
    .admin-user span, .environment-badge { display: none; } /* Ocultar no mobile pra dar espaço */
}
