/* Estilos extras da v27 — complementam style.css (espelho do v25_prod).
   Tudo aqui é especifico de v27 (dev tools, toast, FullCalendar, etc).
   NÃO duplicar regras já presentes em style.css. */

/* ===== Dev user switcher (vive na barra azul .nav-header) ===== */

.nav-header { gap: 12px; padding-right: 12px; }
.nav-header .dev-switcher {
    margin-left: auto; /* empurra para a direita; não estica */
    min-width: 0;
}
.nav-header .dev-switcher select {
    width: auto;
    max-width: 100%;
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 6px 28px 6px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.nav-header .dev-switcher select:hover  { background: rgba(255,255,255,0.28); border-color: rgba(255,255,255,0.7); }
.nav-header .dev-switcher select:focus  { outline: 2px solid rgba(255,255,255,0.5); outline-offset: 1px; }
.nav-header .dev-switcher select option { color: #323130; background: #fff; }

/* Quando o menu está colapsado em desktop (.collapsed sem mobile), some o switcher */
.navigation.collapsed:not(.is-mobile-open) .dev-switcher { display: none; }

/* ===== Loading / empty states ===== */

.card-loading,
.card-empty {
    padding: 24px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* ===== Badges (aliases EN para o backend i18n) ===== */

.badge.badge-approved  { background: #198754; color: #fff; }
.badge.badge-pending   { background: #ffc107; color: #000; }
.badge.badge-rejected  { background: #dc3545; color: #fff; }
.badge.badge-cancelled { background: #e5e7eb; color: #6b7280; }

/* ===== Toast (slide-in/out) ===== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: #323130;
    color: white;
    padding: 12px 18px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    font-size: 14px;
    transform: translateX(120%);
    transition: transform 0.25s ease;
    min-width: 240px;
    max-width: 360px;
}
.toast-show     { transform: translateX(0); }
.toast-success  { background: #107c10; }
.toast-error    { background: #d13438; }
.toast-info     { background: #0078d4; }

/* ===== Filter chip (Minhas justificativas etc) ===== */

.filter-chip {
    background: white;
    border: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    border-radius: 14px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #444;
    transition: all 0.1s;
}
.filter-chip:hover { background: var(--neutral-fill-hover, #f0f0f0); }
.filter-chip.active {
    background: var(--alpargatas-blue, #0597F2);
    color: white;
    border-color: var(--alpargatas-blue, #0597F2);
}

/* ===== FullCalendar wrapper (Tools → Calendário) ===== */

#fc-mount {
    background: white;
    border-radius: 6px;
    padding: 8px;
}
.fc-toolbar-title {
    font-size: 18px !important;
    color: #323130;
}
.fc-button {
    background: var(--alpargatas-blue, #0597F2) !important;
    border-color: var(--alpargatas-blue, #0597F2) !important;
}
.fc-event {
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
}

.cal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.cal-modal {
    background: white;
    border-radius: 8px;
    padding: 24px;
    width: min(420px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.cal-modal h3 { margin: 0 0 16px; font-size: 18px; }

/* ===== Solicitar Falta Justificada — chips de motivos ===== */

.absence-reasons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.reason-chip {
    background: white;
    border: 2px solid var(--neutral-stroke-rest, #d1d1d1);
    border-radius: 8px;
    padding: 16px 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    color: #444;
}
.reason-chip:hover {
    border-color: var(--alpargatas-blue, #0597F2);
    background: var(--neutral-fill-hover, #f5f5f5);
}
.reason-chip.active {
    border-color: var(--alpargatas-blue, #0597F2);
    background: rgba(5, 151, 242, 0.1);
}
.reason-icon  { font-size: 28px; }
.reason-label { font-weight: 500; }
.predefined-justifications h3 { margin: 0; font-size: 16px; }

/* ===== Visão Corporativa — diferenças v27 sobre kpi-grid v25_prod ===== */
/* v25_prod usa flex; v27 estende com .large/.small (size hints) */
.kpi-card.large  { /* mantém base do .kpi-card de style.css */ }
.kpi-card.small  { /* idem — apenas marker para JS */ }

/* ===== Relatórios da Equipe — barra de filtros (lado-a-lado sempre) ===== */

.re-filter-bar {
    display: flex;
    gap: 12px;
    align-items: end;
}
.re-filter-bar .re-field {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
}
.re-filter-bar .re-field input { width: 100%; box-sizing: border-box; }
.re-filter-bar .re-apply {
    flex: 0 0 auto;
    align-self: stretch;
    margin-top: 0;
}

/* No celular: mantém os 3 lado-a-lado, só comprime tipografia/padding */
@media (max-width: 600px) {
    .re-filter-bar { gap: 6px; }
    .re-filter-bar label { font-size: 11px; }
    .re-filter-bar .re-field input {
        font-size: 13px;
        padding: 8px 6px;
    }
    .re-filter-bar .re-apply {
        font-size: 13px;
        padding: 9px 12px;
    }
    /* Calendário do picker centralizado no viewport quando aberto via inputs desta barra */
    .re-filter-bar .calendar-dropdown-gestor.active {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        width: min(320px, calc(100vw - 24px));
        max-height: calc(100dvh - 80px);
        overflow-y: auto;
        z-index: 1000;
    }
}

/* ===== Aderência (v27): expansão de gestores ===== */

.dept-expand-btn {
    background: transparent;
    border: 1px solid var(--neutral-stroke-rest, #d1d1d1);
    border-radius: 4px;
    width: 22px; height: 22px;
    line-height: 18px; text-align: center;
    cursor: pointer;
    margin-right: 6px;
    color: #555;
    font-weight: 600;
}
.dept-expand-btn:hover { background: var(--neutral-fill-hover, #f0f0f0); }

.dept-mgr-row {
    background: var(--surface-background, #f8f9fa);
    font-size: 12px;
    color: #555;
}
.dept-mgr-row td:first-child {
    padding-left: 36px;
    font-style: italic;
}

/* ===== Histórico (v27) — bloco resumo ===== */

.historico-summary {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--surface-background, #f8f9fa);
    border-radius: 6px;
    font-size: 13px;
    color: #555;
}
.historico-summary .kpi-low  { color: #d13438; font-weight: 600; }
.historico-summary .kpi-high { color: #107c10; font-weight: 600; }

/* ===== Multi-anexo: lista abaixo do .file-upload (v25_prod base) ===== */
/* O componente reusa .file-upload do style.css; só precisa da lista.
   Cada chip tem largura igual ao conteúdo + folga; embrulha em mais de
   uma linha apenas quando não couber. */

.attach-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 10px;
}
.attach-list:empty { display: none; }
.attach-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: 100%;
    padding: 6px 10px;
    background: white;
    border: 1px solid var(--neutral-stroke-rest, #e5e5e5);
    border-radius: 6px;
    font-size: 13px;
}
.attach-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 28ch;
}
.attach-size { color: #888; font-size: 12px; white-space: nowrap; }
.attach-remove {
    border: none; background: transparent;
    color: #d13438;
    cursor: pointer;
    font-size: 18px; line-height: 1;
    padding: 0 6px;
    border-radius: 4px;
}
.attach-remove:hover { background: rgba(209, 52, 56, 0.1); }
.file-upload.is-dragover .upload-text {
    border-color: var(--alpargatas-blue, #0597F2);
    background-color: #f0f8ff;
    color: var(--alpargatas-blue, #0597F2);
}

/* ===== Mobile: ajustes APENAS para componentes v27 ===== */

@media (max-width: 768px) {
    /* Toast preenche margem */
    #toast-container { left: 8px; right: 8px; top: auto; bottom: 8px; }
    .toast { max-width: none; min-width: 0; }

    /* Painel de notificações ocupa quase toda a tela */
    .notif-panel {
        position: fixed;
        top: 60px;
        left: 8px;
        right: 8px;
        width: auto;
        max-height: calc(100dvh - 72px);
    }

    /* Reason chips (Solicitar Falta Justificada) em 2 colunas */
    .absence-reasons { grid-template-columns: repeat(2, 1fr); }

    /* FullCalendar mais compacto */
    .fc .fc-toolbar { flex-direction: column; gap: 8px; }
}

@media (max-width: 480px) {
    .absence-reasons { grid-template-columns: 1fr; }
}

/* === v27f overrides: ícones SVG inline + divider === */
.nav-icon svg { width: 18px; height: 18px; }
.nav-divider {
  height: 1px;
  margin: 12px 14px;
  background: rgba(255,255,255,0.12);
}
.nav-link.active .nav-icon svg { color: #fff; }
.nav-link .nav-icon { display: inline-flex; align-items: center; justify-content: center; }

/* Cartão de perfil — atalhos */
.tpc-quick:hover { background: #F3F4F6; padding-left: 4px; transition: padding .12s; }

/* v27f · group title nos divisores */
.nav-group-title {
  padding: 4px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-top: 4px;
}
.navigation.collapsed .nav-group-title { display: none; }

/* Card de presença · jornada no título + fração ao lado de "Dias Presenciais"
   (evita estourar a largura do card). */
.app-container.teams-layout .section-title .conformidade-rule {
  font-size: 16px; font-weight: 400; color: #707070; margin-left: 6px;
}
.app-container.teams-layout .conformidade-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.app-container.teams-layout .conformidade-progress .progress-bar { flex: 1; }

/* Relatórios globais · gráfico de evolução + legenda lado-a-lado.
   Em telas estreitas (< 560px) os min-width inline (300px/200px) forçam layout
   apertado; aqui anulamos para empilhar (precisa de !important p/ vencer o style inline). */
@media (max-width: 560px) {
  .chart-canvas-wrapper,
  .chart-legend { min-width: 0 !important; width: 100% !important; }
}

/* === Config · Cadastro/Mapeamento de BU (department → BU) ==================== */
.cfgbu-intro { margin: 0 2px 12px; color: #64748b; }
.cfgbu-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.cfgbu-filters__search { flex: 1; min-width: 200px; }
.cfgbu-onlyerr { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #475569; white-space: nowrap; }
.cfgbu-summary { color: #64748b; margin: 0 0 8px; }
.cfgbu-summary .cfgbu-err { color: #c0392b; }
.cfgbu-summary .cfgbu-unmapped { color: #a96d09; }
/* Realce de estado por classe (não cor inline): erro cadastral vs. não mapeado. */
.cfgbu-row--err { background: #fff6f6; }
.cfgbu-row--unmapped { background: #fff9ef; }
.cfgbu-num { text-align: right; font-weight: 600; }
.cfgbu-num--muted { text-align: right; color: #94a3b8; font-weight: 400; }
.cfgbu-th-num { text-align: right; }
.cfgbu-sel { font-size: 12px; padding: 5px 6px; }
.cfgbu-sel--flag { border-color: #e0b080; }
.cfgbu-empty { padding: 24px; }
