/* Lista CSS - Estilos específicos para funcionalidades da lista */

/* Filters */
.filters {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 0.1rem;
  margin-top: 0.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.filters-header h2 {
  color: #1e293b;
  font-size: 1.5rem;
}

.search-box {
  position: relative;
  max-width: 300px;
  flex: 1;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: #dc8cdb;
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 2px solid #e2e8f0;
  background: white;
  color: #64748b;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: #dc8cdb;
  background: linear-gradient(-145deg, rgba(219, 138, 222, 1) 0%, rgba(246, 191, 159, 1) 100%);
  color: white;
}

/* Items Grid */
.items-section {
  margin-bottom: 2rem;
  margin-top: 2rem;
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.item-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

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

/* ===== FIX: IMAGENS SEMPRE INTEIRAS (SEM CORTE) ===== */
.item-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  /* Proporção quadrada no desktop */
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 3rem;
  position: relative;
  overflow: hidden;
  border-radius: 0;
  /* Remove arredondamento se houver */
}

.item-image img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  /* ✅ CONTAIN = imagem inteira visível */
  object-position: center !important;
  display: block !important;
}

/* Mobile: proporção mais ampla para ver detalhes */
@media (max-width: 767px) {
  .item-image {
    aspect-ratio: 4 / 3;
  }
}

/* Fallback para navegadores que não suportam aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
  .item-image {
    height: 200px;
    /* Altura fixa como fallback */
  }

  @media (max-width: 767px) {
    .item-image {
      height: 180px;
    }
  }
}

.badge {
  position: absolute;
  bottom: 0rem;
  align-items: center;
  justify-content: center;
  border-radius: 0rem;
  font-size: 1rem;
  font-weight: 600;
  background: #fdfdfd;
  color: #921414;
}

.item-price-inside {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: #86efac;
  color: #065f46;
}

.item-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-available {
  background: #86efac;
  color: #065f46;
}

.status-reserved {
  background: #fde68a;
  color: #92400e;
}

.status-unavailable {
  background: #fca5a5;
  color: #991b1b;
}

.item-content {
  padding: 0.875rem 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.item-info {
  margin-bottom: 0.5rem;
}

.item-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
  color: #1e293b;
  line-height: 1.3;
}

.item-description {
  color: #64748b;
  margin-bottom: 0;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  line-height: 1.3;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1;
  /* Truncar texto longo com reticências */
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2rem;
  /* ~2 linhas mais compactas */
}

.item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  gap: 0.5rem;
}

.item-quantity {
  margin-left: auto;
  color: #64748b;
}

.item-price {
  font-weight: 600;
  color: #059669;
  font-size: 1rem;
}

.item-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.item-actions .btn-primary,
.item-actions .btn-secondary {
  flex: 1;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Shopee Preview */
.shopee-preview {
  text-align: center;
  margin-bottom: 1rem;
}

.shopee-preview img {
  max-width: 100px;
  max-height: 100px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

/* Amazon Preview */
.amazon-preview {
  text-align: center;
  margin-bottom: 1rem;
}

.amazon-preview img {
  max-width: 100px;
  max-height: 100px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

/* Search Shopee */
.search-shopee {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-shopee input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1rem;
}

.search-shopee input:focus {
  outline: none;
  border-color: #dc8cdb;
}

.search-shopee button {
  width: 100%;
  padding: 0.75rem;
  white-space: nowrap;
}

/* Item Preview */
.item-preview {
  background: #f8fafc;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.item-preview-image {
  width: 80px;
  height: 80px;
  background: #e2e8f0;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 2rem;
  flex-shrink: 0;
}

.item-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* ✅ Imagem inteira visível */
  border-radius: 0.5rem;
}

.item-preview-content h4 {
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: #1e293b;
}

.item-preview-content p {
  color: #64748b;
  font-size: 0.875rem;
}

/* Shopee Results */
#resultadoShopee {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 5px;
}

.resultado-item img {
  max-width: 80px;
  height: auto;
}

/* Shopee results dentro da modal */
#shopeeResults {
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 6px;
}

/* Card compacto de resultado */
.shopee-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  align-items: flex-start;
  margin-bottom: 10px;
}

/* Thumb pequena e fixa */
.shopee-thumb {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
}

.shopee-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* ✅ Produtos Shopee sempre inteiros */
}

/* Texto do resultado */
.shopee-body {
  flex: 1;
  min-width: 0;
}

.shopee-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shopee-price {
  color: #059669;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.shopee-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shopee-actions .btn-primary,
.shopee-actions .btn-success,
.shopee-actions .btn-secondary {
  padding: 6px 10px;
  font-size: 0.85rem;
}

/* Estilos para elementos de busca no modal de edição */
#editItemModal .form-group[style*="display:flex"] {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  align-items: stretch !important;
}

#editItemModal .form-group[style*="display:flex"] input {
  width: 100% !important;
  flex: none !important;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1rem;
}

#editItemModal .form-group[style*="display:flex"] input:focus {
  outline: none;
  border-color: #dc8cdb;
}

#editItemModal .form-group[style*="display:flex"] button {
  width: 100% !important;
  padding: 0.75rem;
  white-space: nowrap;
}

/* Responsive Design para Lista */
@media (max-width: 768px) {
  .filters-header {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: none;
  }

  .items-grid {
    grid-template-columns: 1fr;
  }

  /* Garantir que botões ocupem toda a linha no mobile */
  .search-shopee,
  .search-amazon {
    flex-direction: column;
    gap: 0.75rem;
  }

  .search-shopee input,
  .search-amazon input {
    width: 100%;
  }

  .search-shopee button,
  .search-amazon button {
    width: 100%;
    padding: 0.75rem;
  }

  /* Garantir layout responsivo no modal de edição */
  #editItemModal .form-group[style*="display:flex"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  #editItemModal .form-group[style*="display:flex"] input,
  #editItemModal .form-group[style*="display:flex"] button {
    width: 100% !important;
  }
}

/* Mobile: thumbnails menores ainda */
@media (max-width: 480px) {
  .shopee-thumb {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  /* Botões com padding adequado no mobile */
  .search-shopee button,
  .search-amazon button,
  #editItemModal .form-group[style*="display:flex"] button {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
}

/* Preview image modal */
#imagePreviewModal .modal-content {
  max-width: 90vw;
  width: auto;
}

#imagePreviewModal img {
  width: 100%;
  height: auto;
}

/* Checkbox personalizado para "Sem limite" */
/* === DESIGN MELHORADO PARA CHECKBOX "SEM LIMITE" === */

/* Container principal do checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  font-weight: 600;
  color: #1f2937;
  user-select: none;
  font-size: 0.95rem;
}

.checkbox-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.5s ease;
}

.checkbox-container:hover::before {
  left: 100%;
}

.checkbox-container:hover {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #0ea5e9;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
  transform: translateY(-1px);
}

/* Esconder checkbox padrão */
.checkbox-container input[type="checkbox"] {
  display: none;
}

/* Toggle Switch Design */
.checkmark {
  position: relative;
  width: 48px;
  height: 24px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  border-radius: 12px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.checkmark::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Estado checked */
.checkbox-container input[type="checkbox"]:checked+.checkmark {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.checkbox-container input[type="checkbox"]:checked+.checkmark::after {
  left: 26px;
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

/* --- FIX global: evitar sobreposição do toggle no texto --- */
.checkbox-container.unlimited-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-container .label-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25rem;
}

.checkbox-container .checkmark {
  flex: 0 0 48px;
  /* largura fixa do switch */
}

/* camadas: brilho atrás, conteúdo na frente */
.checkbox-container::before {
  z-index: 0;
  pointer-events: none;
}

.checkbox-container .label-text,
.checkbox-container .checkmark {
  position: relative;
  z-index: 1;
}

/* opcional: sem quebra de linha no texto */
.checkbox-container .label-text {
  white-space: nowrap;
}

/* Estado ativo (quando checkbox marcado) */
.checkbox-container.unlimited-active {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #10b981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
  color: #065f46;
  font-weight: 700;
}

/* Animação de pulso quando ativo */
.checkbox-container.unlimited-active .checkmark {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(16, 185, 129, 0.2);
  }

  50% {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 4px rgba(16, 185, 129, 0.3);
  }

  100% {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(16, 185, 129, 0.2);
  }
}

/* Melhorar o texto de ajuda */
.form-text.text-muted {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-text.text-muted::before {
  content: 'ℹ️';
  font-size: 0.9rem;
}

/* Estilos para campos desabilitados */
input[type="number"]:disabled.unlimited-field {
  background-color: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
  opacity: 0.7;
}

/* Responsividade */
@media (max-width: 480px) {
  .checkbox-container {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
    font-size: 0.9rem;
  }

  .checkmark {
    width: 40px;
    height: 20px;
  }

  .checkmark::after {
    width: 16px;
    height: 16px;
    top: 2px;
  }

  .checkbox-container input[type="checkbox"]:checked+.checkmark::after {
    left: 22px;
  }
}

/* Estilos para quantity-group */
.quantity-group {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.quantity-group input[type="number"] {
  flex: 1;
  min-width: 120px;
}

.quantity-group .checkbox-container {
  flex-shrink: 0;
  min-width: 200px;
}

@media (max-width: 768px) {
  .quantity-group {
    flex-direction: column;
    gap: 0.75rem;
  }

  .quantity-group .checkbox-container {
    min-width: auto;
    width: 100%;
  }
}

/* Estilos para os cards de adicionar item */
.add-item-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.add-item-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.add-item-card .card-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  border-radius: 8px 8px 0 0;
}

.add-item-card .card-icon {
  width: 40px;
  height: 40px;
  background: #007bff;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 18px;
}

.add-item-card .card-header h4 {
  margin: 0;
  color: #333;
  font-size: 18px;
  font-weight: 600;
}

.add-item-card .card-body {
  padding: 20px;
}

/* Cabeçalho das opções */
.option-selector-header {
  text-align: center;
  margin-bottom: 25px;
  padding: 15px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  border-left: 4px solid #007bff;
}

.option-selector-header h4 {
  color: #495057;
  margin-bottom: 5px;
  font-weight: 600;
}

.option-selector-header p {
  margin: 0;
  font-size: 14px;
}

/* Cards das opções */
.add-item-card {
  position: relative;
  margin-bottom: 20px;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  transition: all 0.3s ease;
  overflow: hidden;
}

.add-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Cores específicas para cada opção */
.shopee-option {
  border-color: #ff6b35;
}

.shopee-option:hover {
  border-color: #e55a2b;
  box-shadow: 0 8px 25px rgba(255, 107, 53, 0.2);
}

.amazon-option {
  border-color: #146eb4;
}

.amazon-option:hover {
  border-color: #0f5a96;
  box-shadow: 0 8px 25px rgba(20, 110, 180, 0.2);
}

.manual-option {
  border-color: #28a745;
}

.manual-option:hover {
  border-color: #218838;
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.2);
}

/* Cabeçalhos dos cards */
.card-header {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border-bottom: 1px solid #e9ecef;
  position: relative;
}

.shopee-option .card-header {
  background: linear-gradient(135deg, #fff5f3 0%, #ffffff 100%);
  border-bottom-color: #ff6b35;
}

.amazon-option .card-header {
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%);
  border-bottom-color: #146eb4;
}

.manual-option .card-header {
  background: linear-gradient(135deg, #f0fff4 0%, #ffffff 100%);
  border-bottom-color: #28a745;
}

.card-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #495057;
}

/* Ícones coloridos */
.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  font-size: 18px;
}

.shopee-icon {
  background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
  color: white;
}

.amazon-icon {
  background: linear-gradient(135deg, #146eb4 0%, #1e88e5 100%);
  color: white;
}

.manual-icon {
  background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
  color: white;
}

/* Corpo dos cards */
.card-body {
  padding: 20px;
}

/* Responsividade */
@media (max-width: 768px) {
  .add-item-card {
    margin-bottom: 15px;
  }

  .card-header {
    padding: 12px 15px;
  }

  .card-header h4 {
    font-size: 14px;
  }

  .card-icon {
    width: 35px;
    height: 35px;
    font-size: 16px;
    margin-right: 12px;
  }

  .option-badge {
    right: 15px;
    padding: 4px 10px;
    font-size: 11px;
  }
}

/* ===== Reservations as Cards ===== */
.reservations-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.res-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.res-card-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 8px;
}

.res-item {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #111827;
  /* evita quebrar layout com nomes enormes */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* até 2 linhas */
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.res-qty {
  background: #f1f5f9;
  /* cinza claro */
  color: #475569;
  /* cinza escuro */
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  font-size: 0.85rem;
  align-self: start;
}

.res-card-body {
  display: grid;
  gap: 6px;
}

.res-by,
.res-email {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  min-width: 0;
  /* para permitir truncamento se precisar */
}

.res-name,
.res-mail-link {
  overflow-wrap: anywhere;
  /* quebra e-mails/nome longos */
  word-break: break-word;
}

.res-mail-link {
  color: #0ea5e9;
  text-decoration: none;
}

.res-mail-link:hover {
  text-decoration: underline;
}

.res-empty {
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  border: 1px dashed #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  grid-column: 1/-1;
  /* ocupa a linha inteira */
}

/* Ajustes no modal para não cortar nada e não ter scroll lateral */
#reservationsModal .modal-body {
  overflow-y: auto;
}

#reservationsModal .modal-body,
#reservationsModal .reservations-cards,
#reservationsModal .res-card {
  overflow-x: hidden;
}

/* Em telas grandes, cards um pouco mais largos */
@media (min-width: 992px) {
  .reservations-cards {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }


}