/**
 * BRAGO Sistema Padeiro - Estilos do Perfil Master Gestor
 * Mobile-First, Touch-First, iOS-Inspired Premium Style
 */

/* ─── CONTAINER BASE E TIPOGRAFIA ─── */
.master-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
  padding-bottom: 80px; /* Evitar que o menu inferior ou footer corte conteúdo no mobile */
  width: 100%;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", sans-serif;
  overflow-x: hidden;
}

/* ─── CARROSSEL DE ALERTAS EXECUTIVOS ─── */
.alert-carousel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.alert-carousel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary, #8E8E93);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 4px;
}

.alert-carousel-wrapper {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px 4px 14px 4px;
  scrollbar-width: none; /* Firefox */
  -webkit-overflow-scrolling: touch; /* Momentum scroll no iOS */
}

.alert-carousel-wrapper::-webkit-scrollbar {
  display: none; /* Safari e Chrome */
}

/* Cartão de Alerta (Ocupa 85% no mobile para dar o feedback visual de que há mais itens para deslizar) */
.alert-card-mobile {
  flex: 0 0 85%;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.2s ease;
  position: relative;
  overflow: hidden;
}

.alert-card-mobile:active {
  transform: scale(0.98);
}

/* Tipos de Alerta e Glowing Borders */
.alert-card-mobile.high-priority {
  border-left: 5px solid #FF3B30; /* Vermelho iOS */
}

.alert-card-mobile.medium-priority {
  border-left: 5px solid #FF9500; /* Laranja iOS */
}

.alert-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.high-priority .alert-card-icon {
  background: rgba(255, 59, 48, 0.1);
  color: #FF3B30;
}

.medium-priority .alert-card-icon {
  background: rgba(255, 149, 0, 0.1);
  color: #FF9500;
}

.alert-card-body {
  flex: 1;
}

.alert-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.high-priority .alert-card-label { color: #FF3B30; }
.medium-priority .alert-card-label { color: #FF9500; }

.alert-card-text {
  font-size: 14px;
  font-weight: 600;
  color: #1C1C1E;
  line-height: 1.35;
}

/* Touch targets >= 44px */
.alert-card-action-btn {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.high-priority .alert-card-action-btn {
  background: rgba(255, 59, 48, 0.08);
  color: #FF3B30;
}

.high-priority .alert-card-action-btn:active {
  background: rgba(255, 59, 48, 0.15);
}

.medium-priority .alert-card-action-btn {
  background: rgba(255, 149, 0, 0.08);
  color: #FF9500;
}

.medium-priority .alert-card-action-btn:active {
  background: rgba(255, 149, 0, 0.15);
}

/* ─── CARDS DE KPI COMPACTOS (EXCLUSIVO MASTER) ─── */
.master-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.master-kpi-card {
  background: #FFFFFF;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.master-kpi-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8E8E93;
}

.master-kpi-header i {
  width: 16px;
  height: 16px;
}

.master-kpi-label {
  font-size: 12px;
  font-weight: 600;
}

.master-kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: #1C1C1E;
  letter-spacing: -0.5px;
}

.master-kpi-footer {
  font-size: 11px;
  font-weight: 500;
  color: #8E8E93;
  margin-top: 2px;
}

.master-kpi-footer .up-trend {
  color: #34C759;
  font-weight: 700;
}

/* ─── TERMÔMETRO DE FILIAIS (BI) ─── */
.filiais-ranking-section {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  border: 1px solid rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title-compact {
  font-size: 16px;
  font-weight: 700;
  color: #1C1C1E;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filial-row-mobile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid #F2F2F7;
}

.filial-row-mobile:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.filial-info-mobile {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filial-name-mobile {
  font-size: 14px;
  font-weight: 700;
  color: #1C1C1E;
}

.filial-meta-mobile {
  font-size: 12px;
  font-weight: 600;
  color: #8E8E93;
}

.filial-value-mobile {
  color: #007AFF;
  font-weight: 700;
}

.progress-bar-container-mobile {
  width: 100%;
  height: 8px;
  background: #E5E5EA;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill-mobile {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #007AFF 0%, #00C7BE 100%);
  transition: width 0.4s ease-out;
}

/* ─── SCORECARDS DOS GESTORES (ABAS EXCLUSIVAS) ─── */
.gestores-list-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.gestor-scorecard-card {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04);
  border: 1px solid rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.gestor-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gestor-avatar-circle {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8E8E93 0%, #3A3A3C 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.gestor-details-box {
  flex: 1;
}

.gestor-card-name {
  font-size: 15px;
  font-weight: 700;
  color: #1C1C1E;
}

.gestor-card-branch {
  font-size: 12px;
  color: #8E8E93;
  font-weight: 500;
  margin-top: 1px;
}

/* Leadership Score Badge */
.gestor-score-badge {
  background: rgba(52, 199, 89, 0.1);
  color: #34C759;
  padding: 8px 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 50px;
}

.gestor-score-value {
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}

.gestor-score-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 2px;
}

/* KPIs Internos do Gestor no Card */
.gestor-kpis-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #F2F2F7;
  padding: 10px;
  border-radius: 14px;
}

.gestor-mini-kpi {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gestor-mini-value {
  font-size: 14px;
  font-weight: 700;
  color: #1C1C1E;
}

.gestor-mini-label {
  font-size: 10px;
  font-weight: 600;
  color: #8E8E93;
}

/* ─── DETALHES DO GESTOR (BOTTOM SHEET AUDIT) ─── */
.bottom-sheet-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #F2F2F7;
  border-radius: 24px 24px 0 0;
  z-index: 1001;
  max-height: 85vh;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.15, 1, 0.3, 1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}

.bottom-sheet-panel.active {
  transform: translateY(0);
}

.bottom-sheet-drag-handle {
  width: 36px;
  height: 5px;
  background: #C7C7CC;
  border-radius: 99px;
  margin: 10px auto;
  flex-shrink: 0;
}

.bottom-sheet-header {
  padding: 0 16px 14px 16px;
  border-bottom: 1px solid #D1D1D6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.bottom-sheet-title {
  font-size: 18px;
  font-weight: 700;
  color: #1C1C1E;
}

.bottom-sheet-close-btn {
  background: #E5E5EA;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8E8E93;
  cursor: pointer;
}

.bottom-sheet-body {
  overflow-y: auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
}

.audit-section-card {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.audit-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #8E8E93;
  text-transform: uppercase;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.baker-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #F2F2F7;
}

.baker-list-row:last-child {
  border-bottom: none;
}

/* ─── SEGMENTED CONTROL MÓVEL (ESTILO IOS) ─── */
.segmented-control-ios {
  background: #E5E5EA;
  border-radius: 12px;
  padding: 2px;
  display: flex;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.segmented-item-ios {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 10px;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  color: #8E8E93;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.segmented-item-ios.active {
  background: #FFFFFF;
  color: #1C1C1E;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
