/* ================== ESTILOS DA AGENDA DE ATENDIMENTOS ================== */

.agenda-container {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.agenda-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.agenda-header h2 {
  margin: 0;
  color: #333;
  font-size: 28px;
}

.agenda-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.toggle-switch input {
  display: none;
}

.toggle-switch .slider {
  position: relative;
  width: 50px;
  height: 26px;
  background-color: #ccc;
  border-radius: 26px;
  transition: 0.4s;
  margin-right: 10px;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.4s;
}

.toggle-switch input:checked + .slider {
  background-color: #4CAF50;
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(24px);
}

.toggle-label {
  font-weight: 500;
  color: #555;
}

/* Estatísticas */
.agenda-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  color: white;
}

.stat-card:nth-child(2) {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon {
  font-size: 32px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 28px;
  font-weight: bold;
}

/* Filtros */
.agenda-filters {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-input,
.filter-select {
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  flex: 1;
  min-width: 150px;
}

.filter-input:focus,
.filter-select:focus {
  outline: none;
  border-color: #667eea;
}

/* Lista de Agendamentos */
.agenda-list {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  overflow: hidden;
  margin-bottom: 30px;
}

.list-header {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1.5fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 15px 20px;
  background: #f8f9fa;
  font-weight: 600;
  color: #555;
  border-bottom: 2px solid #e0e0e0;
}

.list-body {
  max-height: 500px;
  overflow-y: auto;
}

.appointment-row {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1.5fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
  transition: background 0.2s;
}

.appointment-row:hover {
  background: #f8f9fa;
}

.appointment-row.cancelled {
  opacity: 0.6;
  text-decoration: line-through;
}

.apt-phone {
  font-family: monospace;
  color: #666;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-scheduled {
  background: #fff3cd;
  color: #856404;
}

.status-confirmed {
  background: #d1ecf1;
  color: #0c5460;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-cancelled {
  background: #f8d7da;
  color: #721c24;
}

.apt-actions {
  display: flex;
  gap: 5px;
}

.btn-icon {
  background: none;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  color: #667eea;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: #f0f0f0;
  color: #764ba2;
}

.btn-icon.btn-danger {
  color: #f44336;
}

.btn-icon.btn-danger:hover {
  background: #ffebee;
}

/* Próximas Vagas */
.next-slots {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 20px;
}

.next-slots h3 {
  margin: 0 0 20px 0;
  color: #333;
}

.slots-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 15px;
}

.slot-card {
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
  border-left: 5px solid #667eea;
  transition: all 0.3s;
  cursor: pointer;
}

.slot-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.slot-card.disponivel {
  border-left-color: #4CAF50;
  background: linear-gradient(135deg, #f8fff9 0%, #f0f9f0 100%);
}

.slot-card.ocupado {
  border-left-color: #f44336;
  background: linear-gradient(135deg, #fff8f8 0%, #fff0f0 100%);
  opacity: 0.7;
}

.slot-label {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.slot-label::before {
  content: '🕐';
  font-size: 20px;
}

.slot-date {
  font-weight: 600;
  color: #666;
  margin-bottom: 10px;
  font-size: 13px;
}

.slot-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  background: white;
}

.slot-card.disponivel .slot-status {
  color: #2e7d32;
}

.slot-card.ocupado .slot-status {
  color: #c62828;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  animation: fadeIn 0.3s;
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 30px;
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideDown 0.3s;
}

.modal-content h2 {
  margin: 0 0 20px 0;
  color: #333;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover,
.close:focus {
  color: #000;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 25px;
}

/* Botões da Agenda - Escopo específico para não conflitar com outros componentes */
.agenda-container .btn-primary,
.agenda-container .btn-secondary,
.agenda-container .btn-danger,
.agenda-filters .btn-primary,
.agenda-filters .btn-secondary,
.agenda-filters .btn-danger {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.agenda-container .btn-primary,
.agenda-filters .btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.agenda-container .btn-primary:hover,
.agenda-filters .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.agenda-container .btn-secondary,
.agenda-filters .btn-secondary {
  background: #6b7280;
  color: white;
}

.agenda-container .btn-secondary:hover,
.agenda-filters .btn-secondary:hover {
  background: #4b5563;
}

.agenda-container .btn-danger,
.agenda-filters .btn-danger {
  background: #dc2626;
  color: white;
}

.agenda-container .btn-danger:hover,
.agenda-filters .btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* Mensagens */
.loading-message,
.empty-message {
  padding: 40px;
  text-align: center;
  color: #999;
  font-style: italic;
}

/* Animações */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Responsivo */
@media (max-width: 1024px) {
  .list-header,
  .appointment-row {
    grid-template-columns: 1.5fr 1fr 1.5fr 0.8fr 0.8fr 0.8fr;
  }
}

@media (max-width: 768px) {
  .agenda-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .list-header {
    display: none;
  }

  .appointment-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .appointment-row > span:before {
    content: attr(class) ": ";
    font-weight: 600;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ================== ESTILOS DA AGENDA SGP ================== */

.agenda-sgp-container {
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.agenda-sgp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.agenda-sgp-header h2 {
  margin: 0;
  color: #333;
  font-size: 28px;
}

.agenda-sgp-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group label {
  font-size: 12px;
  color: #666;
}

.filter-group input,
.filter-group select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.agenda-sgp-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.agenda-sgp-stats .stat-card {
  background: white;
  border-radius: 8px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  min-width: 150px;
}

.agenda-sgp-stats .stat-icon {
  font-size: 24px;
}

.agenda-sgp-stats .stat-info {
  display: flex;
  flex-direction: column;
}

.agenda-sgp-stats .stat-label {
  font-size: 12px;
  color: #666;
}

.agenda-sgp-stats .stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #333;
}

.agenda-sgp-table-container {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.agenda-sgp-table {
  width: 100%;
  border-collapse: collapse;
}

.agenda-sgp-table th,
.agenda-sgp-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.agenda-sgp-table th {
  background: #f5f5f5;
  font-weight: 600;
  color: #333;
}

.agenda-sgp-table tbody tr:hover {
  background: #f9f9f9;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: white;
  font-weight: 500;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  color: #666;
  transition: color 0.2s;
}

.btn-icon:hover {
  color: #2196F3;
}

/* Modal */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  margin: 10px 0;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Form Group */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

/* ===== HEADER REDESIGN ===== */
.agenda-title-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.agenda-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}

.agenda-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: linear-gradient(180deg, #667eea, #764ba2);
  border-radius: 2px;
  flex-shrink: 0;
}

.agenda-subtitle {
  font-size: 12px;
  color: #9ca3af;
  margin-left: 14px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.agenda-config-btn {
  width: 38px;
  height: 38px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 15px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.agenda-config-btn:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

/* ===== SEARCH CARD ===== */
.agenda-search-card {
  display: flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  flex-wrap: wrap;
  row-gap: 8px;
}

.search-period-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-cal-icon {
  color: #667eea;
  font-size: 15px;
  flex-shrink: 0;
}

.search-date-input {
  border: none;
  outline: none;
  font-size: 14px;
  color: #374151;
  background: transparent;
  cursor: pointer;
  padding: 4px 2px;
  min-width: 128px;
  font-family: inherit;
}

.search-date-input:focus {
  color: #667eea;
}

.period-arrow {
  color: #c0c4cc;
  font-size: 14px;
  margin: 0 2px;
  user-select: none;
}

.search-card-sep {
  width: 1px;
  height: 26px;
  background: #e5e7eb;
  margin: 0 10px;
  flex-shrink: 0;
}

.search-status-select {
  border: none;
  outline: none;
  font-size: 14px;
  color: #374151;
  background: transparent;
  cursor: pointer;
  padding: 4px 2px;
  min-width: 155px;
  font-family: inherit;
  flex-shrink: 0;
}

.search-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.search-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-btn-primary:hover {
  box-shadow: 0 4px 12px rgba(102,126,234,0.4);
  transform: translateY(-1px);
}

.search-btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid #e5e7eb;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 13px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.search-btn-icon:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.search-btn-icon.search-btn-danger {
  color: #ef4444;
}

.search-btn-icon.search-btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.circuit-status-badge {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  padding: 5px 12px;
  background: #f9fafb;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  margin-left: 4px;
}

.btn-circuit-reset {
  padding: 5px 14px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

/* ===== SLOTS INFO NO MODAL ===== */
.slots-info-card {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  transition: background 0.2s;
}

.slots-info-card--hint {
  background: linear-gradient(135deg, #f0f4ff, #f5f0ff);
  border: 1px solid #e0e7ff;
  color: #6366f1;
}

.slots-info-card--loading {
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  color: #9ca3af;
}

.slots-info-card--warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.slots-info-card--slots {
  flex-direction: column;
  align-items: flex-start;
  background: #f8faff;
  border: 1px solid #e0e7ff;
  padding: 12px 14px;
  gap: 8px;
}

.slots-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #9ca3af;
}

.slots-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.slot-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
  font-family: inherit;
  line-height: 1;
}

.slot-pill small {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.8;
}

.slot-pill--free {
  background: white;
  border-color: #c7d2fe;
  color: #4338ca;
  box-shadow: 0 1px 3px rgba(99,102,241,0.1);
}

.slot-pill--free:hover {
  background: #eef2ff;
  border-color: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(99,102,241,0.2);
}

.slot-pill--selected {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  border-color: transparent !important;
  color: white !important;
  box-shadow: 0 3px 10px rgba(102,126,234,0.4) !important;
}

.slot-pill--full {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #d1d5db;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ===== LINHAS COMPACTAS DA TABELA ===== */
.os-row td {
  padding: 8px 12px;
  vertical-align: middle;
}

.os-row:hover {
  background: #f8faff;
}

.os-cell-fonte {
  text-align: center;
  white-space: nowrap;
}

.row-fonte-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.row-fonte-sgp { background: #dbeafe; color: #1d4ed8; }
.row-fonte-int { background: #dcfce7; color: #15803d; }

.row-id {
  display: block;
  font-size: 10px;
  color: #c0c4cc;
  margin-top: 2px;
  font-weight: 400;
}

.os-cell-data { white-space: nowrap; }

.row-date-day {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.row-date-time {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 1px;
}

.os-cell-status { white-space: nowrap; }

.row-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.row-status-label {
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}

.row-client-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.row-meta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

.row-meta {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
}

.os-cell-acoes {
  white-space: nowrap;
  text-align: right;
}
