/* Estilos gerais para carrinho */

.container.mt-3 {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 15px;
}

.container.mt-3 .row.p-2 {
  margin-left: 0;
  margin-right: 0;
  padding: 0;
}

.undo-message-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid rgba(0, 103, 93, 0.25);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 103, 93, 0.12);
  padding: 0;
  opacity: 0;
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  pointer-events: none;
  max-width: 90%;
}

.undo-message-container.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.undo-message-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 16px;
}

.undo-message-text {
  font-size: 0.9375rem;
  color: #333;
  font-weight: 400;
  white-space: nowrap;
}

.undo-button {
  background: #00675d;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  pointer-events: auto !important;
  position: relative;
  box-shadow: 0 2px 4px rgba(0, 103, 93, 0.2);
}

.undo-button:hover {
  background: #004d45;
  box-shadow: 0 2px 8px rgba(0, 103, 93, 0.3);
}

.undo-button:active {
  background: #004d47;
  box-shadow: 0 1px 2px rgba(0, 103, 93, 0.25);
}

.table {
  width: 100%;
  margin-bottom: 0;
}

.table thead th:last-child {
  display: none;
}

.table tbody tr td:last-child .carrinho-remove-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: none;
  border: none !important;
  background: transparent;
  transition: opacity 0.2s;
}

.table tbody tr td:last-child .carrinho-remove-icon:hover {
  opacity: 0.7;
}

.table tbody tr td:last-child .carrinho-remove-icon i {
  font-size: 0.875rem;
  color: #dc2626;
}

.table tbody tr td:nth-child(3) .stepper,
.table tbody tr td:nth-child(3) .stepper.flex-column,
.table tbody tr td:nth-child(3) .stepper.flex-lg-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
}

#totalCarrinho {
  font-size: 1.125rem;
}


/* Responsivo - Mobile -*/
@media (max-width: 768px) {
  .container.mt-3 {
    padding: 15px 10px;
  }

  .undo-message-container {
    bottom: 15px;
    left: 15px;
    right: 15px;
    max-width: none;
    transform: translateX(0) translateY(20px);
    z-index: 9999 !important;
  }

  .undo-message-container.show {
    transform: translateX(0) translateY(0);

  }

  .undo-message-content {
    padding: 10px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .undo-message-text {
    font-size: 0.875rem;
    flex: 1;
    min-width: 0;
  }

  .undo-button {
    padding: 6px 12px;
    font-size: 0.8125rem;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr 44px;
    grid-template-rows: auto auto auto auto;
    gap: 0 0.5rem;
    margin-bottom: 16px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
  }

  .table tbody tr:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .table tbody td,
  .table tbody th {
    border: none !important;
    padding: 0 !important;
    text-align: left !important;
  }

  .table tbody tr th:first-child {
    grid-column: 1;
    grid-row: 1;
    width: auto !important;
    margin-right: 0;
    vertical-align: top;
  }

  .table tbody tr th:first-child img.imgProdtCart {
    width: 100px !important;
    height: 100px !important;
    max-width: 100px !important;
    max-height: 100px !important;
    min-width: 100px !important;
    min-height: 100px !important;
    border: 1px solid #e9ecef;
    border-radius: 4px;
  }

  .table tbody tr td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    overflow: visible;
    width: auto !important;
    vertical-align: top;
    padding: 0.5rem 0 !important;
    margin-bottom: 0;
    display: block;
    align-self: start; 
    min-height: 4rem; 
  }

  .table tbody tr td:nth-child(2) .carrinho-item-nome {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 0.35rem;
    padding-right: 0;
    font-weight: 600;
  }

  .table tbody tr td:nth-child(2) .carrinho-item-codigo {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0;
    flex-shrink: 0;
    display: block;
    line-height: 1.3;
    white-space: nowrap;
    overflow: visible;
  }

  .table tbody tr td:nth-child(2) h6.carrinho-item-codigo {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0;
  }

  .table tbody tr td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100% !important;
    padding: 12px 0 !important;
    margin: 12px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
  }

  .table tbody tr td:nth-child(3)::before {
    content: "Quantidade:";
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 400;
  }

  .table tbody tr td:nth-child(3) .stepper,
  .table tbody tr td:nth-child(3) .stepper.flex-column,
  .table tbody tr td:nth-child(3) .stepper.flex-lg-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    margin: 0;
    max-width: none;
    gap: 8px;
  }

  .table tbody tr td:nth-child(3) .stepper input {
    width: 70px !important;
  }

  .table tbody tr td:nth-child(4) {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100% !important;
    padding: 8px 0 !important;
    font-size: 0.875rem;
    font-weight: 400;
  }

  .table tbody tr td:nth-child(4)::before {
    content: "Preço unitário:";
    color: #6b7280;
    font-weight: 400;
  }

  .table tbody tr td:nth-child(5) {
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100% !important;
    padding: 8px 0 !important;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
  }

  .table tbody tr td:nth-child(5)::before {
    content: "Subtotal:";
    color: #6b7280;
    font-weight: 400;
  }

  .table tbody tr td:last-child {
    grid-column: 3;
    grid-row: 1;
    align-self: start;
    justify-self: end;
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 44px;
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
  }

  .table tbody tr td:last-child .carrinho-remove-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 6px;
    margin-right: 0.25rem;
    cursor: pointer;
    text-decoration: none;
    border: none !important;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow: none;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
  }

  .table tbody tr td:last-child .carrinho-remove-icon:hover {
    background: rgba(220, 53, 69, 0.15);
    transform: scale(1.1);
    box-shadow: none;
  }

  .table tbody tr td:last-child .carrinho-remove-icon:active {
    transform: scale(0.95);
  }

  .table tbody tr td:last-child .carrinho-remove-icon i {
    font-size: 0.9rem;
    color: #dc2626;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 16px !important;
    margin: 0 !important;
    border-top: 2px solid #e9ecef;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col {
    padding: 0 !important;
    margin-bottom: 12px;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:last-child {
    margin-bottom: 0;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:first-child {
    justify-content: center !important;
    text-align: center;
    padding: 12px 0 !important;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px !important;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:first-child h3 {
    margin: 0 !important;
    font-size: 1.25rem;
    color: #333;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:first-child h3 .fw-bold,
  .container.mt-3 .row.p-2.d-flex.flex-column .col:first-child h3 #totalCarrinho {
    font-size: 1.25rem;
    color: #00675d;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:nth-child(2) {
    justify-content: center !important;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:nth-child(2) a#fecharPedido {
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    padding: 16px 24px !important;
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 103, 93, 0.3);
    transition: all 0.2s;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:nth-child(2) a#fecharPedido:hover {
    box-shadow: 0 4px 12px rgba(0, 103, 93, 0.4);
    transform: translateY(-1px);
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:nth-child(2) a#fecharPedido.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:last-child {
    justify-content: center !important;
    text-align: center;
    padding: 8px 0 !important;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:last-child h6 {
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0 !important;
  }
}

/* Telas muito pequenas */
@media (max-width: 450px) {
  .table tbody tr {
    padding: 12px;
  }

  .table tbody tr th:first-child img.imgProdtCart {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
  }

  .table tbody tr td:nth-child(2) {
    min-width: 0;
    align-self: start;
    min-height: 4rem;
  }

  .table tbody tr td:nth-child(2) .carrinho-item-nome {
    font-size: 0.875rem;
  }

  .table tbody tr td:nth-child(2) .carrinho-item-codigo {
    font-size: 0.75rem;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column {
    padding: 12px !important;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:first-child h3 {
    font-size: 1.125rem;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:first-child h3 .fw-bold {
    font-size: 1.375rem;
  }

  .container.mt-3 .row.p-2.d-flex.flex-column .col:nth-child(2) a#fecharPedido {
    padding: 14px 20px !important;
    font-size: 1rem !important;
  }
}

@media (max-width: 1024px) {
  body:has([href*="carrinho"]) header,
  body.page-carrinho header {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    position: fixed !important;
    top: 0 !important;
    width: 100% !important;
    z-index: 1000 !important;
  }

  body:has([href*="carrinho"]) header + .nav-pages-container,
  body.page-carrinho header + .nav-pages-container {
    display: none !important;
  }
}
