/* assets/css/style.css — Buffet Kids Sistema */

:root {
  --primary:     #FF6B9D;
  --primary-d:   #e05585;
  --secondary:   #6C63FF;
  --accent:      #FFC75F;
  --success:     #43D9AD;
  --danger:      #FF5E7E;
  --warning:     #FFC75F;
  --info:        #5BC4FF;
  --dark:        #1E1B2E;
  --sidebar-w:   250px;
  --topbar-h:    64px;
  --radius:      14px;
  --shadow:      0 4px 24px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 40px rgba(0,0,0,.13);
  --bg:          #F4F5FA;
  --card-bg:     #ffffff;
  --text:        #2d2b3d;
  --text-muted:  #8b8aab;
  --border:      #eaeaf4;
  --font-main:   'Nunito', sans-serif;
  --font-brand:  'Fredoka One', cursive;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  margin: 0;
  overflow-x: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  padding: 18px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-icon { font-size: 2rem; flex-shrink: 0; }

.sidebar-logo-img {
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.logo-text {
  font-family: var(--font-brand);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-sub {
  font-family: var(--font-main);
  font-size: .65rem;
  font-weight: 600;
  color: rgba(255,255,255,.45);
  letter-spacing: .3px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logo-text strong { color: var(--primary); }

.sidebar-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  padding: 11px 20px;
  border-radius: 0 30px 30px 0;
  margin: 2px 12px 2px 0;
  font-weight: 600;
  font-size: .93rem;
  transition: all .2s;
}

.sidebar-nav .nav-link i { font-size: 1.15rem; }

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  box-shadow: 0 4px 14px rgba(255,107,157,.35);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }

.user-name {
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role { color: var(--text-muted); font-size: .75rem; }

.btn-logout {
  color: rgba(255,255,255,.5);
  font-size: 1.2rem;
  transition: color .2s;
}
.btn-logout:hover { color: var(--danger); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1040;
}

/* ── MAIN WRAPPER ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s;
}

/* ── TOPBAR ── */
.topbar {
  min-height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 8px 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow);
  flex-wrap: nowrap;
}

.topbar-left { flex: 1; min-width: 0; }
.topbar-right { flex-shrink: 0; }

.page-title {
  font-family: var(--font-brand);
  font-size: 1.3rem;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.date-badge {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.topbar-avatar { display: block; }

.btn-menu {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

/* ── CONTENT ── */
.content-area {
  flex: 1;
  padding: 28px 28px 40px;
}

/* ── AVATAR ── */
.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
}

/* ── CARDS ── */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── STAT CARDS ── */
.stat-card {
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  right: -20px; bottom: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
}

.stat-card .stat-icon {
  font-size: 2.2rem;
  background: rgba(255,255,255,.2);
  border-radius: 12px;
  width: 58px; height: 58px;
  display: flex; align-items: center; justify-content: center;
}

.stat-card .stat-value {
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
}

.stat-card .stat-label {
  font-size: .82rem;
  opacity: .85;
  font-weight: 600;
}

.bg-grad-pink   { background: linear-gradient(135deg, #FF6B9D, #ff4776); }
.bg-grad-purple { background: linear-gradient(135deg, #6C63FF, #4e47cc); }
.bg-grad-yellow { background: linear-gradient(135deg, #FFC75F, #f5a623); }
.bg-grad-teal   { background: linear-gradient(135deg, #43D9AD, #29b589); }
.bg-grad-blue   { background: linear-gradient(135deg, #5BC4FF, #2a9fd6); }
.bg-grad-red    { background: linear-gradient(135deg, #FF5E7E, #d93a5a); }

/* ── BADGES ── */
.badge-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
}

.badge-agendado    { background: #e8f4fd; color: #2a9fd6; }
.badge-confirmado  { background: #e6fbf4; color: #29b589; }
.badge-realizado   { background: #f0f0f0; color: #666; }
.badge-cancelado   { background: #fde8ee; color: #d93a5a; }
.badge-pendente    { background: #fff8e6; color: #d68910; }
.badge-pago        { background: #e6fbf4; color: #29b589; }
.badge-recebido    { background: #e6fbf4; color: #29b589; }
.badge-vencido     { background: #fde8ee; color: #d93a5a; }

/* ── TABLES ── */
.table-buffet thead th {
  background: #f7f7fc;
  border-bottom: 2px solid var(--border);
  font-weight: 700;
  font-size: .83rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 16px;
}

.table-buffet tbody tr {
  transition: background .15s;
}
.table-buffet tbody tr:hover { background: #fafaff; }
.table-buffet td { padding: 12px 16px; vertical-align: middle; font-size: .9rem; }

/* ── FORMS ── */
.form-label { font-weight: 700; font-size: .85rem; color: var(--text); }

.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
  font-family: var(--font-main);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,157,.15);
  outline: none;
}

/* ── BUTTONS ── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
  border-radius: 10px;
}
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
  border-radius: 10px;
}
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  border: none;
  cursor: pointer;
  transition: all .2s;
}

.btn-icon.view   { background: #e8f4fd; color: #2a9fd6; }
.btn-icon.edit   { background: #fff8e6; color: #d68910; }
.btn-icon.delete { background: #fde8ee; color: #d93a5a; }
.btn-icon:hover  { filter: brightness(.9); transform: scale(1.05); }

/* ── TABS ── */
.nav-tabs-buffet {
  border-bottom: 2px solid var(--border);
  gap: 4px;
  margin-bottom: 24px;
}

.nav-tabs-buffet .nav-link {
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 0;
  background: none;
  transition: all .2s;
  font-size: .9rem;
}

.nav-tabs-buffet .nav-link:hover { color: var(--primary); }
.nav-tabs-buffet .nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── CALENDAR ── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-header {
  text-align: center;
  font-weight: 800;
  font-size: .75rem;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
}

.cal-day {
  min-height: 80px;
  border-radius: 10px;
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all .15s;
}

.cal-day:hover { border-color: var(--primary); background: #fff5f9; }

.cal-day.today { border-color: var(--primary); background: #fff0f6; }

.cal-day.other-month { opacity: .35; }

.cal-day .day-num {
  font-weight: 800;
  font-size: .85rem;
  color: var(--text);
  margin-bottom: 4px;
}

.cal-day.today .day-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}

.event-dot {
  font-size: .68rem;
  padding: 1px 6px;
  border-radius: 6px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  cursor: pointer;
}

.event-agendado   { background: #e8f4fd; color: #2a9fd6; }
.event-confirmado { background: #e6fbf4; color: #29b589; }
.event-realizado  { background: #f0f0f0; color: #666; }
.event-cancelado  { background: #fde8ee; color: #d93a5a; }

/* ── ESTOQUE ALERT ── */
.estoque-baixo { background: #fff8e6; border-left: 4px solid var(--warning); }

/* ── AVATAR UPLOAD ── */
.avatar-upload {
  position: relative;
  display: inline-block;
}
.avatar-upload img {
  width: 100px; height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
}
.avatar-upload .upload-btn {
  position: absolute;
  bottom: 0; right: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: 2px solid #fff;
  font-size: .9rem;
}

/* ── SECTION TITLE ── */
.section-title {
  font-family: var(--font-brand);
  font-size: 1.4rem;
  color: var(--text);
  margin-bottom: 0;
}

/* ── ALERT TOAST ── */
.toast-container { z-index: 9999; }

/* ── MOBILE ── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .content-area {
    padding: 18px 14px 30px;
  }
}

/* ── TOPBAR USER INFO ── */
.topbar-user-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 4px 12px 4px 4px;
  border-radius: 30px;
  border: 1.5px solid var(--border);
  transition: border-color .2s, background .2s;
  background: #fff;
  max-height: 48px;
  flex-shrink: 0;
}
.topbar-user-link:hover {
  border-color: var(--primary);
  background: #fff5f9;
}
.topbar-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.topbar-user-name {
  font-weight: 800;
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-user-role {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ── VERSION BADGE ── */
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f4f5fa;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: .3px;
}
.version-badge i { font-size: .78rem; color: var(--primary); }

@media (max-width: 767px) {
  .topbar-user-info { display: none; }
  .date-badge { display: none !important; }
  .topbar { padding: 8px 14px; }
}
@media (max-width: 400px) {
  .topbar-user-link { padding: 3px; border: none; background: transparent; }
}

/* ── NOTIFICAÇÕES ── */
.notif-wrap {
  position: relative;
}
.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background .2s, border-color .2s, color .2s;
}
.notif-btn:hover {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
}
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--primary);
  color: #fff;
  font-size: .6rem;
  font-weight: 900;
  min-width: 17px; height: 17px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
  animation: pulseBadge 2s ease-in-out infinite;
}
@keyframes pulseBadge {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.15); }
}
.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
  border: 1.5px solid var(--border);
  z-index: 2000;
  overflow: hidden;
}
.notif-dropdown.show { display: block; }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.notif-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
}
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #f7f7fc; }
.notif-icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; flex-shrink: 0;
}
.notif-body { flex: 1; min-width: 0; }
.notif-desc {
  font-size: .83rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-meta { font-size: .72rem; color: var(--text-muted); margin-top: 2px; }
.notif-footer {
  padding: 8px 16px; text-align: center; background: #fafafa;
  border-top: 1px solid var(--border);
}
.notif-footer a {
  font-size: .78rem; font-weight: 700; color: var(--secondary);
  text-decoration: none;
}
.notif-footer a:hover { text-decoration: underline; }

.notif-section-label {
  padding: 5px 14px;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.notif-section-danger  { background: #fde8ee; color: #d93a5a; }
.notif-section-warning { background: #fffbee; color: #d68910; }
.notif-item-vencida    { background: #fff8f8; }
.notif-item-vencida:hover { background: #fde8ee; }

/* ══════════════════════════════════════════════════════════
   MODO ESCURO
   ══════════════════════════════════════════════════════════ */
body.dark-mode {
  --bg:         #0f0e1a;
  --card-bg:    #1a1829;
  --text:       #e8e6f0;
  --text-muted: #6e6c8a;
  --border:     #2a2840;
  --shadow:     0 4px 24px rgba(0,0,0,.35);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.5);
}

/* Topbar escuro */
body.dark-mode .topbar {
  background: #1a1829;
  border-bottom-color: #2a2840;
}

/* Cards escuros */
body.dark-mode .card {
  background: var(--card-bg);
  border-color: var(--border);
}
body.dark-mode .card-header {
  background: #201e30 !important;
  border-bottom-color: var(--border);
  color: var(--text);
}

/* Tabelas escuras */
body.dark-mode .table {
  color: var(--text);
  --bs-table-bg: transparent;
  --bs-table-striped-bg: #201e30;
  --bs-table-hover-bg: #252338;
}
body.dark-mode .table-responsive { background: var(--card-bg); }
body.dark-mode .table-buffet thead th {
  background: #201e30 !important;
  color: #9997b8 !important;
  border-bottom-color: var(--border);
}
body.dark-mode .table-buffet tbody tr {
  background: var(--card-bg) !important;
  border-bottom-color: var(--border);
}
body.dark-mode .table-buffet tbody tr:hover {
  background: #201e30 !important;
}
body.dark-mode .table-buffet td,
body.dark-mode .table-buffet th {
  background: transparent !important;
  color: var(--text) !important;
  border-color: var(--border);
}
body.dark-mode .table td,
body.dark-mode .table th {
  background: transparent !important;
  color: var(--text) !important;
  border-color: var(--border);
}
/* Forçar fundo escuro em qualquer table dentro de card */
body.dark-mode .card .table-responsive,
body.dark-mode .card table {
  background: var(--card-bg);
}

/* Inputs e forms escuros */
body.dark-mode .form-control,
body.dark-mode .form-select {
  background: #201e30;
  border-color: #2a2840;
  color: var(--text);
}
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
  background: #201e30;
  border-color: var(--primary);
  color: var(--text);
}
body.dark-mode .form-control::placeholder { color: var(--text-muted); }
body.dark-mode .input-group-text {
  background: #201e30;
  border-color: #2a2840;
  color: var(--text-muted);
}

/* Modais escuros */
body.dark-mode .modal-content {
  background: #1a1829;
  border-color: #2a2840;
  color: var(--text);
}
body.dark-mode .modal-body { background: #1a1829; }
body.dark-mode .modal-footer {
  background: #201e30;
  border-top-color: var(--border);
}

/* Badges e alerts escuros */
body.dark-mode .alert { border-color: var(--border); }
body.dark-mode .list-group-item {
  background: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}

/* Nav tabs escuras */
body.dark-mode .nav-tabs-buffet .nav-link {
  color: var(--text-muted);
}
body.dark-mode .nav-tabs-buffet .nav-link.active {
  background: var(--card-bg);
  color: var(--primary);
  border-color: var(--border);
}

/* Botão dark mode */
.dark-toggle {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  transition: background .2s, border-color .2s, color .2s;
  flex-shrink: 0;
}
.dark-toggle:hover {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary);
}
body.dark-mode .dark-toggle {
  background: #201e30;
  border-color: #2a2840;
  color: #FFC75F;
}
body.dark-mode .dark-toggle:hover {
  background: #2a2840;
  border-color: #FFC75F;
  color: #FFC75F;
}

/* Notif dropdown escuro */
body.dark-mode .notif-dropdown {
  background: #1a1829;
  border-color: #2a2840;
}
body.dark-mode .notif-header { background: #201e30; }
body.dark-mode .notif-item { color: var(--text); border-bottom-color: #2a2840; }
body.dark-mode .notif-item:hover { background: #201e30; }
body.dark-mode .notif-footer { background: #201e30; border-top-color: #2a2840; }
body.dark-mode .notif-section-label { opacity: .9; }

/* Dropdowns e select escuros */
body.dark-mode .dropdown-menu {
  background: #1a1829;
  border-color: #2a2840;
}
body.dark-mode .dropdown-item { color: var(--text); }
body.dark-mode .dropdown-item:hover { background: #201e30; }

/* Botões outline escuros */
body.dark-mode .btn-outline-secondary {
  color: var(--text-muted);
  border-color: #2a2840;
}
body.dark-mode .btn-outline-secondary:hover {
  background: #201e30;
  color: var(--text);
}

/* Page title escuro */
body.dark-mode .page-title { color: var(--text); }
body.dark-mode .date-badge { color: var(--text-muted); }

/* Topbar user escuro */
body.dark-mode .topbar-user-name { color: var(--text); }
body.dark-mode .topbar-user-role { color: var(--text-muted); }
body.dark-mode .topbar-user-link { border-color: #2a2840; }

/* Botão notif escuro */
body.dark-mode .notif-btn {
  background: #201e30;
  border-color: #2a2840;
  color: var(--text);
}
body.dark-mode .notif-btn:hover {
  background: #2a2840;
  border-color: var(--primary);
  color: var(--primary);
}

/* Scrollbar escura */
body.dark-mode ::-webkit-scrollbar { background: #0f0e1a; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #2a2840; border-radius: 8px; }

/* Agenda e calendário escuros */
body.dark-mode .cal-day {
  background: #201e30 !important;
  border-color: #2a2840 !important;
  color: var(--text) !important;
}
body.dark-mode .cal-day:hover {
  background: #2a2840 !important;
  border-color: var(--primary) !important;
}
body.dark-mode .cal-day.today {
  background: #2a1535 !important;
  border-color: var(--primary) !important;
}
body.dark-mode .cal-day .day-num { color: var(--text) !important; }
body.dark-mode .cal-day-header { color: #9997b8 !important; }

/* Event dots escuros */
body.dark-mode .event-agendado   { background: #0d2e3e !important; color: #5BC4FF !important; }
body.dark-mode .event-confirmado { background: #0d2e1f !important; color: #43D9AD !important; }
body.dark-mode .event-realizado  { background: #252338 !important; color: #9997b8 !important; }
body.dark-mode .event-cancelado  { background: #2e0d1a !important; color: #FF6B9D !important; }

/* Fundo branco genérico — forçar escuro */
body.dark-mode [style*="background:#fff"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background:white"],
body.dark-mode [style*="background:#f7f7fc"],
body.dark-mode [style*="background:#fafafa"],
body.dark-mode [style*="background:#f0f0f8"],
body.dark-mode [style*="background:#fafaff"] {
  background: #1e1c2e !important;
}

/* ── Correção de textos — forçar cor clara em todos os contextos ── */

/* Texto padrão e headings */
body.dark-mode,
body.dark-mode p,
body.dark-mode span:not(.badge):not(.badge-status),
body.dark-mode div,
body.dark-mode td,
body.dark-mode th,
body.dark-mode label,
body.dark-mode h1,body.dark-mode h2,body.dark-mode h3,
body.dark-mode h4,body.dark-mode h5,body.dark-mode h6,
body.dark-mode li,
body.dark-mode small {
  color: var(--text);
}

/* Textos explicitamente escuros via Bootstrap */
body.dark-mode .text-dark   { color: #c8c6e0 !important; }
body.dark-mode .text-black  { color: #c8c6e0 !important; }

/* Textos muteds ficam mais visíveis no escuro */
body.dark-mode .text-muted  { color: #8a88aa !important; }

/* Links padrão */
body.dark-mode a:not(.btn):not(.nav-link):not(.notif-item):not(.topbar-user-link) {
  color: #9d99ff;
}

/* Stat cards — labels ficam mais claros */
body.dark-mode .stat-label  { color: rgba(255,255,255,.7) !important; }
body.dark-mode .stat-value  { color: #fff !important; }

/* Card body texto */
body.dark-mode .card-body   { color: var(--text); }

/* Section titles */
body.dark-mode .section-title { color: var(--text) !important; }

/* fw-700/800/900 inline sem color explícita */
body.dark-mode [class*="fw-"] { color: inherit; }

/* Textos de progresso e percentual */
body.dark-mode .progress { background: #201e30; }

/* Alert */
body.dark-mode .alert-success { background: #0d2e1f; border-color: #1a5c35; color: #6ee7b7; }
body.dark-mode .alert-danger  { background: #2e0d1a; border-color: #5c1a2e; color: #fca5a5; }
body.dark-mode .alert-warning { background: #2e200d; border-color: #5c3e1a; color: #fcd34d; }
body.dark-mode .alert-info    { background: #0d1e2e; border-color: #1a3a5c; color: #93c5fd; }

/* List group items */
body.dark-mode .list-group-item { color: var(--text) !important; }

/* Placeholders */
body.dark-mode ::placeholder   { color: #5a5878 !important; }

/* Select option */
body.dark-mode option { background: #201e30; color: var(--text); }

/* hr */
body.dark-mode hr { border-color: #2a2840; }

/* ── PESQUISA GLOBAL ── */
.search-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  z-index: 901;
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: .9rem;
  pointer-events: none;
  z-index: 1;
}
.search-input {
  width: 100%;
  padding: 8px 36px 8px 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-main);
  font-size: .88rem;
  font-weight: 600;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,157,.12);
  background: var(--card-bg);
}
.search-input::placeholder { color: var(--text-muted); font-weight: 400; }
.search-clear {
  position: absolute;
  right: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--text-muted);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .75rem;
  opacity: .6;
  transition: opacity .2s;
}
.search-clear:hover { opacity: 1; }

/* Dropdown de resultados */
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 3000;
}
.search-results.show { display: block; }

.sr-loading, .sr-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sr-group {
  padding: 8px 14px 4px;
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.sr-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background .12s;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover, .sr-item.focused { background: var(--bg); }
.sr-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
}
.sr-evento       { background: #fff0f6; color: #FF6B9D; }
.sr-freelancer   { background: #eef0ff; color: #6C63FF; }
.sr-conta_pagar  { background: #fde8ee; color: #d93a5a; }
.sr-conta_receber{ background: #e6fbf4; color: #29b589; }
.sr-fornecedor   { background: #fffbee; color: #d68910; }
.sr-estoque      { background: #f0f8ff; color: #2a9fd6; }
.sr-body { flex: 1; min-width: 0; }
.sr-title {
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.sr-sub {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Dark mode pesquisa */
body.dark-mode .search-input {
  background: #201e30;
  border-color: #2a2840;
  color: var(--text);
}
body.dark-mode .search-input:focus {
  background: #252338;
  border-color: var(--primary);
}
body.dark-mode .search-results { background: #1a1829; border-color: #2a2840; }
body.dark-mode .sr-group { background: #201e30; color: #9997b8; border-color: #2a2840; }
body.dark-mode .sr-item { color: var(--text); border-color: #2a2840; }
body.dark-mode .sr-item:hover, body.dark-mode .sr-item.focused { background: #201e30; }
body.dark-mode .sr-title { color: var(--text); }
