/* ============================================
   AGENDA CSS — Multi-professional grid
   ============================================ */

/* ── AGENDA TOOLBAR ── */
.agenda-toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.agenda-nav { display: flex; align-items: center; gap: 0.5rem; }
.agenda-date-display { font-weight: 600; font-size: 0.95rem; min-width: 180px; text-align: center; }
.agenda-views { display: flex; gap: 0.3rem; }
.btn-view {
  padding: 0.35rem 0.9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); font-size: 0.82rem; cursor: pointer; transition: all var(--transition);
}
.btn-view:hover { border-color: var(--gold); color: var(--gold); }
.btn-view.active { background: var(--gold-glow); border-color: var(--gold); color: var(--gold); font-weight: 600; }
.agenda-filters { margin-left: auto; }

/* ── AGENDA GRID CONTAINER ── */
.agenda-grid-wrap {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: auto; max-height: calc(100vh - 240px);
}

/* ── AGENDA GRID ── */
.agenda-grid {
  display: grid;
  /* columns: time-col + one per professional */
  min-width: 600px;
}
.agenda-header-row {
  display: contents;
}
.agenda-time-col {
  position: sticky; left: 0; z-index: 10;
  background: var(--bg-elevated); border-right: 1px solid var(--border);
}
.agenda-prof-header {
  padding: 0.9rem 0.6rem; text-align: center;
  background: var(--bg-elevated); border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.agenda-prof-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff; margin: 0 auto 0.3rem;
}
.agenda-prof-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.agenda-prof-count { font-size: 0.68rem; color: var(--text-muted); }

/* ── TIME SLOT HEADER ── */
.time-label {
  font-size: 0.72rem; color: var(--text-muted); text-align: right;
  padding: 0 0.5rem; height: 60px;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding-top: 2px; background: var(--bg-elevated);
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  position: sticky; left: 0; z-index: 4;
  font-variant-numeric: tabular-nums;
}

/* ── AGENDA SLOT ── */
.agenda-slot {
  height: 60px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid rgba(42,42,56,0.5);
  padding: 2px; position: relative; cursor: pointer;
  transition: background var(--transition);
}
.agenda-slot:hover { background: var(--bg-hover); }
.agenda-slot.half-hour { border-bottom-style: dashed; opacity: 0.6; }

/* ── APPOINTMENT BLOCK ── */
.appointment-block {
  position: absolute; left: 3px; right: 3px;
  border-radius: 6px; padding: 4px 6px;
  font-size: 0.72rem; cursor: pointer; overflow: hidden;
  border-left: 3px solid;
  transition: filter var(--transition), transform var(--transition);
  z-index: 2;
}
.appointment-block:hover { filter: brightness(1.1); transform: scale(1.01); z-index: 3; }
.apt-status-1 { background: rgba(59,130,246,0.2); border-color: var(--blue); color: #90c0ff; }        /* Agendado */
.apt-status-E { background: rgba(245,158,11,0.2); border-color: var(--amber); color: #f5d090; }        /* Em atendimento */
.apt-status-2 { background: rgba(168,85,247,0.2); border-color: var(--purple); color: #d09af7; }       /* Comanda aberta */
.apt-status-F { background: rgba(34,197,94,0.2); border-color: var(--green); color: #90eaa8; }         /* Finalizado */
.apt-status-B { background: rgba(239,68,68,0.15); border-color: var(--red); color: #f09090; }          /* Bloqueado */
.apt-status-C { background: var(--bg-elevated); border-color: var(--border); color: var(--text-muted); }/* Cancelado */
.apt-client-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apt-service-name { opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apt-time { opacity: 0.7; font-size: 0.65rem; }

/* ── APPOINTMENT ACTIONS POPUP ── */
.apt-popup {
  position: fixed; z-index: 300;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  width: 260px; padding: 1rem;
  animation: fadeUp 0.15s ease;
}
.apt-popup-header { display: flex; justify-content: space-between; margin-bottom: 0.8rem; }
.apt-popup-title { font-weight: 700; font-size: 0.9rem; }
.apt-popup-actions { display: flex; flex-direction: column; gap: 0.4rem; }
.apt-action-btn {
  width: 100%; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-primary); font-size: 0.85rem; text-align: left;
  cursor: pointer; transition: all var(--transition); display: flex; align-items: center; gap: 0.5rem;
}
.apt-action-btn:hover { background: var(--bg-hover); border-color: var(--gold); color: var(--gold); }

/* ── SEMANA VIEW ── */
.semana-grid {
  display: grid; grid-template-columns: 80px repeat(7, 1fr);
  min-width: 700px;
}
.semana-day-header {
  padding: 0.6rem; text-align: center; background: var(--bg-elevated);
  border-bottom: 2px solid var(--border); border-right: 1px solid var(--border);
  font-size: 0.78rem; position: sticky; top: 0; z-index: 5;
}
.semana-day-name { font-weight: 600; text-transform: uppercase; font-size: 0.7rem; color: var(--text-muted); }
.semana-day-num { font-size: 1.1rem; font-weight: 700; }
.semana-day-header.today .semana-day-num {
  background: var(--gold); color: #fff; border-radius: 50%;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; margin: 0 auto;
}

/* ── CURRENT TIME INDICATOR ── */
.current-time-line {
  position: absolute; left: 0; right: 0; z-index: 5;
  height: 2px; background: var(--red);
  pointer-events: none;
}
.current-time-line::before {
  content: ''; position: absolute; left: -4px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--red);
}

/* ── ENCAIXE MODAL ── */
.encaixe-steps { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.encaixe-step {
  flex: 1; height: 4px; border-radius: 99px;
  background: var(--border); transition: background 0.3s;
}
.encaixe-step.done { background: var(--gold); }
.encaixe-step.active { background: var(--gold-light); animation: pulse 1.5s infinite; }

/* ── CHECKOUT MODAL ── */
.checkout-service-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.8rem; }
.checkout-service-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.75rem; background: var(--bg-elevated);
  border-radius: var(--radius-sm); font-size: 0.87rem;
}
.checkout-service-item .nome { flex: 1; }
.checkout-service-item .valor { font-weight: 600; color: var(--gold); }
.checkout-service-item .remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.9rem;
  padding: 0.1rem 0.3rem; border-radius: 4px; transition: all var(--transition);
}
.checkout-service-item .remove:hover { background: var(--red-bg); color: var(--red); }

.desconto-pix-info {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem;
  color: var(--green); background: var(--green-bg); border-radius: var(--radius-sm);
  padding: 0.4rem 0.8rem;
}

/* ── LEGEND ── */
.agenda-legend {
  display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.75rem;
  padding: 0.6rem 1rem; background: var(--bg-elevated); border-radius: var(--radius-sm);
}
.legend-item { display: flex; align-items: center; gap: 0.3rem; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot-blue { background: var(--blue); }
.legend-dot-amber { background: var(--amber); }
.legend-dot-purple { background: var(--purple); }
.legend-dot-green { background: var(--green); }
.legend-dot-red { background: var(--red); }

@media (max-width: 900px) {
  .agenda-grid-wrap { max-height: calc(100vh - 280px); }
  .agenda-toolbar { gap: 0.6rem; }
  .agenda-filters { margin-left: 0; }
}

.week-appointment {
  position: relative;
  display: block;
  min-height: 24px;
  padding: 4px 6px;
  margin-bottom: 3px;
  border-radius: 6px;
  font-size: 0.72rem;
  overflow: hidden;
  cursor: pointer;
}

.week-appointment .apt-client-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-slot.week-slot {
  position: relative;
  min-height: 42px;
  padding: 3px;
  overflow: hidden;
}

.week-appointment {
  position: relative !important;
  display: block;
  width: 100%;
  min-height: 28px;
  max-height: 38px;
  padding: 4px 6px;
  margin-bottom: 3px;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.15;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
}

.week-appointment-client {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-appointment-meta {
  font-size: 0.62rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.semana-day-header {
  min-height: 54px;
  padding: 10px;
  text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  box-sizing: border-box;
}

.semana-day-header.today {
  color: var(--gold);
}

.semana-time {
  min-height: 60px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.agenda-slot.week-slot {
  position: relative;
  min-height: 60px;
  padding: 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  box-sizing: border-box;
}

.week-appointment {
  position: relative !important;
  display: block;
  width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  margin-bottom: 3px;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.15;
  overflow: hidden;
  cursor: pointer;
  box-sizing: border-box;
}

.week-appointment-client {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.week-appointment-meta {
  font-size: 0.62rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
