/* =====================================================
   CATALOG PAGE - Simples e funcional
   ===================================================== */

/* GRID DE PRODUTOS */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
  width: 100%;
}

/* CARD DO PRODUTO */
.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 300ms ease-out;
}

.card:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  border-color: #0f766e;
}

.card-img {
  width: 100%;
  height: 130px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease-out;
}

.card:hover .card-img img {
  transform: scale(1.05);
}

.card-header {
  padding: 0.75rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.card-header > div:last-child {
  flex-grow: 1;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
  color: #111827;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.card-sub {
  font-size: 0.72rem;
  color: #6b7280;
  margin: 0.3rem 0;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.card-footer {
  padding: 0.75rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.preco {
  font-size: 1rem;
  font-weight: 700;
  color: #0f766e;
  margin: 0;
}

.preco span {
  font-size: 0.7rem;
  font-weight: 400;
  color: #6b7280;
  margin-left: 0.4rem;
}

.card-actions {
  padding: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.card-actions .btn {
  flex: 1;
  margin: 0;
}

.pill {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid #d1d5db;
  background: #f3f4f6;
}

.pill-est-normal {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #10b981;
}

.pill-est-crit {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: #ef4444;
  animation: pulse 2s ease-in-out infinite;
}

/* TOPBAR */
.topbar {
  background: linear-gradient(135deg, #0f766e 0%, #0d5a54 100%);
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

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

.topbar-sub {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* FILTROS */
.filters-form {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filters-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filters-form span {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
}

.filters-form input,
.filters-form select {
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background: #f9fafb;
  transition: all 150ms ease;
}

.filters-form input:focus,
.filters-form select:focus {
  border-color: #0f766e;
  background: white;
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

/* TOOLBAR */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: #4b5563;
}

.toolbar-center {
  flex: 1;
  justify-content: center;
}

/* PAGINAÇÃO */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  background: white;
  color: #111827;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 150ms ease-out;
  text-decoration: none;
}

.page-link:hover:not(.disabled):not(.active) {
  border-color: #0f766e;
  background: #f3f4f6;
  transform: translateY(-2px);
}

.page-link.active {
  background: linear-gradient(135deg, #0f766e 0%, #0d5a54 100%);
  border-color: #0f766e;
  color: white;
  font-weight: 700;
}

.page-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: #f9fafb;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-backdrop.show {
  display: flex;
  animation: fadeIn 300ms ease-out;
}

.modal {
  max-width: 480px;
  width: 100%;
  background: white;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  animation: slideUp 300ms ease-out;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 150ms;
}

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

.modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-body label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: #111827;
}

.modal-body input,
.modal-body select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  background: #f9fafb;
  color: #111827;
  transition: all 150ms;
  min-height: 44px;
}

.modal-body input:focus,
.modal-body select:focus {
  outline: none;
  border-color: #0f766e;
  background: white;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  background: #f9fafb;
}

.msg-erro {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  border-radius: 0.5rem;
  color: #ef4444;
  font-size: 0.875rem;
  animation: slideDown 300ms ease-out;
}

/* FOOTER */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  border-top: 1px solid #d1d5db;
  font-size: 0.875rem;
  color: #6b7280;
  z-index: 40;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

/* MEDIA QUERIES */
@media (max-width: 768px) {
  .topbar {
    padding: 0.5rem 0.75rem;
  }

  .filters-form {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .modal {
    max-width: 90vw;
    max-height: 90vh;
  }
}

@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .card-img {
    height: 110px;
  }

  .card-title {
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
  }

  .card-sub {
    font-size: 0.7rem;
    margin: 0.2rem 0;
  }

  .card-header {
    padding: 0.65rem;
  }

  .pagination {
    gap: 0.1rem;
  }

  .page-link {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }
}

@media (max-width: 430px) {
  .topbar-sub {
    display: none;
  }

  .topbar-title {
    font-size: 1rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .card-img {
    height: 100px;
  }

  .card-title {
    font-size: 0.78rem;
    margin-bottom: 0.4rem;
  }

  .card-sub {
    font-size: 0.68rem;
    margin: 0.2rem 0;
  }

  .card-header {
    padding: 0.6rem;
  }

  .card-footer {
    padding: 0.6rem;
  }

  .card-actions {
    padding: 0.6rem;
  }

  .preco {
    font-size: 0.9rem;
  }

  .preco span {
    font-size: 0.65rem;
  }

  .card-actions .btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }

  .filters-form {
    grid-template-columns: 1fr;
    padding: 0.75rem;
    gap: 0.5rem;
    margin: 1rem 0;
  }

  footer {
    padding: 0.5rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    font-size: 0.75rem;
  }
}

/* ANIMAÇÕES */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}
