/* =============================================================================
   ONEDEAL BRAND IDENTITY & TECH PREMIUM DESIGN SYSTEM
   Edição Especial: 4KIDS Buffet Infantil (Curitiba)
   ============================================================================= */

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

:root {
  /* 1. Paleta Principal da Marca (OneDeal Brand Identity) */
  --brand-blue: #0459FA;
  --color-primary: #0459FA;
  --brand-vibrant: #0384FC;
  --color-primary-vibrant: #0384FC;
  --brand-glow: #01BBFD;
  --color-primary-glow: #01BBFD;
  --brand-deep: #023273;
  --color-primary-deep: #023273;
  --color-white: #F9FAFC;
  --color-light-gray: #E9EEF7;
  --color-dark-text: #1C2434;

  /* 2. Gradientes Principais */
  --gradient-primary: linear-gradient(90deg, #0459FA, #01BBFD);
  --gradient-hover: linear-gradient(90deg, #0384FC, #00ADEF);

  /* 3. Tema Escuro — Tech Premium (Padrão no :root) */
  --bg-main: #020711;
  --color-background: #020711;
  --bg-alt: #050E1A;
  --color-footer-bg: #050E1A;
  --bg-sec: #081526;
  --color-background-sec: #081526;
  --bg-card: #0A1830;
  --color-card: #0A1830;
  --border-brand: rgba(255, 255, 255, 0.08);
  --color-border: rgba(255, 255, 255, 0.08);
  --text-main: #F9FAFC;
  --color-text-main: #F9FAFC;
  --text-sec: #A4B0C5;
  --color-text-sec: #A4B0C5;
  --color-glow: 0 0 30px rgba(1, 187, 253, 0.15);

  /* 5. Tipografia e Bordas (:root) */
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
  --lp-radius: 20px;
  --radius-card: 1.25rem;
  --radius-btn: 0.75rem;
  --radius-input: 0.75rem;
  --radius-full: 9999px;

  /* Status Colors Operacionais */
  --status-green: #10B981;
  --status-yellow: #F59E0B;
  --status-blue: #0384FC;
  --status-red: #EF4444;
  --status-purple: #A855F7;
}

[data-theme="dark"] {
  --bg-main: #07111F;
  --color-background: #07111F;
  --bg-alt: #0B1220;
  --color-footer-bg: #0B1220;
  --bg-sec: #111A2C;
  --color-background-sec: #111A2C;
  --bg-card: #121C30;
  --color-card: #121C30;
  --border-brand: rgba(255, 255, 255, 0.08);
  --color-border: rgba(255, 255, 255, 0.08);
  --text-main: #F4F8FF;
  --color-text-main: #F4F8FF;
  --text-sec: #A4B0C5;
  --color-text-sec: #A4B0C5;
  --color-glow: 0 0 30px rgba(41, 214, 255, 0.15);
}

[data-theme="light"] {
  --bg-main: #FFFFFF;
  --color-background: #FFFFFF;
  --bg-alt: #FFFFFF;
  --color-footer-bg: #FFFFFF;
  --bg-card: #FFFFFF;
  --color-card: #FFFFFF;
  --bg-sec: #F8FAFC;
  --color-background-sec: #F8FAFC;
  --border-brand: #CBD5E1;
  --color-border: #CBD5E1;
  --text-main: #000000;
  --color-text-main: #000000;
  --text-sec: #000000;
  --color-text-sec: #000000;
  --color-glow: none;
}

/* =============================================================================
   RESET & BASE LAYOUT
   ============================================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--brand-glow);
  text-decoration: none;
}

/* =============================================================================
   APP SHELL (SIDEBAR + MAIN CONTENT)
   ============================================================================= */
.app-shell {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-alt);
  border-right: 1px solid var(--border-brand);
  padding: 1.5rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.4rem 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border-brand);
}

.brand-logo-orb {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--gradient-primary);
  box-shadow: var(--color-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: #FFFFFF;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.15;
}

.brand-title span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--text-sec);
  margin-top: 2px;
}

.nav-menu {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-sec);
  padding: 0.65rem 0.75rem 0.25rem;
  font-weight: 600;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-sec);
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-btn-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.nav-btn:hover {
  background: var(--bg-sec);
  color: var(--text-main);
  border-color: var(--border-brand);
}

.nav-btn.active {
  background: var(--gradient-primary);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: var(--color-glow);
}

.nav-badge {
  font-size: 0.7rem;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font-weight: 600;
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-brand);
  font-size: 0.76rem;
  color: var(--text-sec);
}

.cloud-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-btn);
  background: var(--bg-sec);
  border: 1px solid var(--border-brand);
  margin-bottom: 0.5rem;
  font-size: 0.74rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-green);
  box-shadow: 0 0 10px var(--status-green);
  flex-shrink: 0;
}

/* =============================================================================
   MAIN WORKSPACE & TOPBAR
   ============================================================================= */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border-brand);
  padding: 0.95rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.topbar-meta {
  font-size: 0.8rem;
  color: var(--text-sec);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.role-switcher, .theme-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-sec);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-btn);
  padding: 0.2rem;
  gap: 0.2rem;
}

.chip-btn {
  padding: 0.42rem 0.75rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-sec);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chip-btn.active {
  background: var(--brand-blue);
  color: #FFFFFF;
  font-weight: 600;
}

/* =============================================================================
   BUTTONS, INPUTS & CARDS (ONEDEAL TOKENS)
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-btn);
  font-family: var(--font-heading);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #FFFFFF;
  box-shadow: var(--color-glow);
}

.btn-primary:hover {
  background: var(--gradient-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-sec);
  color: var(--text-main);
  border-color: var(--border-brand);
}

.btn-secondary:hover {
  border-color: var(--brand-vibrant);
}

.btn-success {
  background: rgba(16, 185, 129, 0.16);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.35);
}

[data-theme="light"] .btn-success {
  color: #065F46;
  background: #D1FAE5;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  color: #F87171;
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.76rem;
}

.content-container {
  padding: 1.5rem 1.75rem 3rem;
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-card);
  padding: 1.35rem;
  box-shadow: var(--color-glow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--text-sec);
}

/* =============================================================================
   BANNER SINCRONIZADOR 1 -> 3 (SOLUÇÃO DA DOR DA VENDEDORA)
   ============================================================================= */
.sync-hero-banner {
  background: linear-gradient(135deg, rgba(4, 89, 250, 0.18), rgba(1, 187, 253, 0.08));
  border: 1px solid rgba(1, 187, 253, 0.3);
  border-radius: var(--lp-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.sync-flow-steps {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.sync-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-btn);
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.sync-pill strong {
  color: var(--brand-glow);
}

/* =============================================================================
   KPI GRID
   ============================================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-card);
  padding: 1.15rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-sec);
  font-weight: 500;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0.3rem 0;
}

.kpi-foot {
  font-size: 0.75rem;
  color: var(--text-sec);
}

/* =============================================================================
   GRADE MATRIZ DE ESCALAS 4KIDS (IDÊNTICA À PLANILHA REAL DO WHATSAPP)
   ============================================================================= */
.matrix-scroll-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-brand);
  background: var(--bg-sec);
}

.schedule-matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1150px;
  font-size: 0.82rem;
}

.schedule-matrix-table th,
.schedule-matrix-table td {
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.5rem 0.65rem;
  text-align: center;
}

/* Modo Clássico Planilha 4KIDS (Cores exatas da imagem WhatsApp) */
.schedule-matrix-table.classic-4kids th,
.schedule-matrix-table.classic-4kids td {
  border: 1px solid #1E293B;
  color: #0F172A;
  font-weight: 700;
}

.schedule-matrix-table.classic-4kids .col-sticky-label {
  background: #F8FAFC;
  color: #0F172A;
  text-align: left;
  min-width: 115px;
  position: sticky;
  left: 0;
  z-index: 5;
}

.schedule-matrix-table.classic-4kids .hdr-kids {
  background: #FF66FF;
  color: #000000;
  font-family: var(--font-heading);
}

.schedule-matrix-table.classic-4kids .hdr-teen {
  background: #E48332;
  color: #000000;
  font-family: var(--font-heading);
}

.schedule-matrix-table.classic-4kids .row-date td {
  background: #F4B084;
  color: #000000;
}

.schedule-matrix-table.classic-4kids .row-day td {
  background: #FFFFFF;
  color: #000000;
}

.schedule-matrix-table.classic-4kids .row-time td {
  background: #FFFF00;
  color: #000000;
}

.schedule-matrix-table.classic-4kids .row-local td {
  background: #FFFFFF;
  color: #000000;
}

.schedule-matrix-table.classic-4kids .row-staff td {
  background: #FCE4D6;
  color: #000000;
}

.matrix-cell-select {
  width: 100%;
  min-width: 105px;
  padding: 0.28rem 0.35rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.75);
  color: #000000;
  font-weight: 700;
  font-size: 0.78rem;
  text-align: center;
  cursor: pointer;
}

.matrix-cell-select.empty-slot {
  background: rgba(239, 68, 68, 0.18);
  border-color: #EF4444;
  color: #991B1B;
}

.schedule-matrix-table:not(.classic-4kids) .matrix-cell-select {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-brand);
}

/* =============================================================================
   FORMS, INPUTS & SIMULADOR DE MARGEM EM TEMPO REAL
   ============================================================================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-sec);
}

.form-control {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-brand);
  background: var(--bg-sec);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  border-color: var(--brand-glow);
}

.allergy-input {
  border-color: rgba(239, 68, 68, 0.6) !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

.margin-bar-track {
  width: 100%;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--bg-sec);
  overflow: hidden;
  border: 1px solid var(--border-brand);
  margin: 0.45rem 0;
}

.margin-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

/* =============================================================================
   KANBAN BOARD (PRÉ-VENDA) & AGENDA CARDS
   ============================================================================= */
.kanban-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(250px, 1fr));
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.kanban-col {
  background: var(--bg-sec);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-card);
  padding: 1rem;
  min-height: 420px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  font-family: var(--font-heading);
  font-size: 0.86rem;
  font-weight: 600;
}

.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-btn);
  padding: 0.9rem;
  margin-bottom: 0.75rem;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-kids {
  background: rgba(236, 72, 153, 0.18);
  color: #F472B6;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.badge-teen {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.badge-confirmada, .badge-realizada {
  background: rgba(16, 185, 129, 0.18);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-pre_reserva {
  background: rgba(3, 132, 252, 0.2);
  color: #38BDF8;
  border: 1px solid rgba(3, 132, 252, 0.4);
}

.badge-visita {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-pendencia_operacional {
  background: rgba(239, 68, 68, 0.22);
  color: #F87171;
  border: 1px solid rgba(239, 68, 68, 0.55);
  animation: pulseAlert 1.6s infinite;
}

@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* =============================================================================
   DATA TABLES & MODALS
   ============================================================================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-brand);
  text-align: left;
}

.data-table th {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-sec);
  background: var(--bg-sec);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 17, 0.78);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.25rem;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-brand);
  border-radius: var(--lp-radius);
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--color-glow);
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast-msg {
  background: var(--bg-card);
  border-left: 4px solid var(--brand-glow);
  border-top: 1px solid var(--border-brand);
  border-right: 1px solid var(--border-brand);
  border-bottom: 1px solid var(--border-brand);
  color: var(--text-main);
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-btn);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-size: 0.85rem;
  max-width: 420px;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

/* Mobile-First Responsivo para o Gerente andando no salão do 4KIDS */
@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    height: auto;
    position: relative;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
  }
}
