﻿.page {
    position: relative;
    /*padding: 20px;*/
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: auto;
}

.content-wrapper {
    max-width: 700px;
}

main {
    height: 100%;
}

.bottom-bar {
    flex-shrink: 0;
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.shopping-item-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 2px solid var(--green-200);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: pan-y;
}

.shopping-item-card.dragging {
    opacity: 0.4;
    border: 2px dashed var(--green-600);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.drag-handle {
    cursor: grab;
    padding: 0.5rem;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    -webkit-user-drag: element;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    user-select: none;
    height: 100%;
}

.drag-handle:active {
    cursor: grabbing;
}

.shopping-item-card.is-dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.dnd-poly-drag-image {
    z-index: 99999 !important;
    opacity: 0.95 !important;
    pointer-events: none !important;
    background-color: var(--white, #ffffff);
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    overflow: hidden;
}

.item-main > div {
    display: flex;
    gap: .5rem;
    max-width: 63%;
}

.shopping-item-purchased {
    opacity: 0.6;
    background-color: var(--gray-50);
    border-color: var(--gray-200);
}

/* Modern Checkbox Container */
.custom-checkbox {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    -webkit-tap-highlight-color: transparent;
}

/* Hide the default native checkbox */
.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* The custom visual box */
.custom-checkbox .checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: white;
    border: 2px solid var(--gray-300);
    border-radius: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* The SVG checkmark icon (hidden by default) */
.custom-checkbox .checkmark svg {
    width: 65%;
    height: 65%;
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.4, 0.4, 0.2, 1.5); /* Adds a tiny bounce effect */
}

/* Checked state - Background & Border */
.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--green-600);
    border-color: var(--green-600);
}

/* Checked state - Show and scale the SVG */
.custom-checkbox input:checked ~ .checkmark svg {
    opacity: 1;
    transform: scale(1);
}

.product-img {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: contain;
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
    padding: 2px;
    background-color: white;
}

.item-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    gap: 0 !important;
}

.item-name,
.item-name > a {
    font-weight: 600;
    color: var(--green-900);
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 25px;
}

.price-container {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.price-discounted {
    color: var(--red-600);
    font-weight: 700;
    font-size: 0.95rem;
}

.price-original {
    color: var(--gray-500);
    text-decoration: line-through;
    font-size: 0.8rem;
}

.price-normal {
    color: var(--green-700);
    font-weight: 600;
    font-size: 0.95rem;
}

.count-control {
    display: flex;
    align-items: center;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
    height: 40px;
    background: white;
}

.btn-count {
    background: white;
    border: none;
    padding: 0.3rem 0.6rem;
    font-size: 1.2rem;
    color: var(--green-700);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
}

.btn-count > span {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.count-value {
    padding: 0 0.5rem;
    font-weight: 600;
    color: var(--gray-900);
    min-width: 2rem;
    text-align: center;
    font-size: 0.9rem;
    height: 40px;
    line-height: 40px;
    background: var(--gray-50)
}

.menu-items {
    gap: .2rem;
}

.list-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.meta-badge {
    background-color: var(--green-100);
    color: var(--green-800);
    padding: 0.25rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.meta-date {
    color: var(--gray-700);
    font-size: 0.75rem;
    font-weight: 500;
}

.search-bar {
  position: relative;
  margin: 20px 0px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: left;
  /*padding: 7px;*/
  border: 1px solid var(--light-color);
  border-radius: 5px;
  transition: all 0.2s ease;
}

.search-bar span {
  margin-right: 5px;
  position: absolute;
  color: var(--light-color);
}

.bi-search {
  left: 10px;
}

.product-search-input {
  border: none;
  padding: 4px 40px 4px 40px;
  width: 100%;
  height: 48px;
  background: none;
}

.product-search-input:focus-visible {
  outline: none;
}

.search-bar:has(.product-search-input:focus-visible) {
  box-shadow: 0 0 0 2px var(--secondary-color);
  border-color: var(--secondary-color);
}

.icon {
  width: 1.5rem;
  height: 1.5rem;
  stroke-width: 2;
  stroke: currentColor;
}

.close-button {
  background: none;
  color: #111827;
  border-radius: 50%;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.edit-form-group {
    margin-bottom: 1.25rem;
}

.edit-form-group-last {
    margin-bottom: 2rem;
}

.form-label-block {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--green-900);
}

.form-control {
    border: var(--bs-border-width) solid var(--bs-border-color);
}

.input-full-width {
    width: 100%;
}

.btn-save-block {
    width: 100%;
    justify-content: center;
    padding: 0.875rem;
}

.store-name {
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: center;
    overflow: hidden;
}

.products-section {
  position: fixed;
  padding: 1.5rem;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100%;
  background: #0000006e;
  animation: fadeIn 0.3s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}

.products-section > .products-container {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 20px 0 20px;
  height: 90%;
  width: 95%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.products-section.list-edit > .products-container {
  height: unset;
  width: 80%;
  max-width: 800px;
  padding: 20px;
}

.products-section.list-edit.small > .products-container {
  width: 60%;
  font-size: 16px;
}

.products-section > .products-container > .products-header h3 {
  margin: 0;
  vertical-align: middle;
}

.products-section > .products-container > .products-flex {
  width: 100%;
  overflow-y: auto;
  height: 100%;
}

.products-section > .products-container > .products-flex > div {
  flex: 1;
  width: 100%;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 1rem;
}

.info-box {
    border: 2px solid var(--green-100)
}

.summary-label {
    color: var(--green-800);
    font-weight: 700;
    font-size: 1.2rem;
}

.summary-total {
    color: var(--green-800);
    font-weight: 700;
    font-size: 1.2rem;
}

.menu-item-wrapper {
    position: relative;
    display: block;
}

.menu-card {
    display: block;
}

.delete-btn {
    position: absolute;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%) translateX(15px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    border-radius: 0.375rem;
    padding: 0.3rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    width: 35px;
}

.delete-btn:focus, .delete-btn:active:focus {
    box-shadow: none;
}

.delete-btn:hover {
    background-color: var(--bs-btn-bg);
    border: none;
}

@media (hover: hover) and (min-width: 769px) {
    .menu-item-wrapper:hover .delete-btn {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px), (hover: none) {
    .delete-btn {
        transform: translateY(-50%) translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media screen and (max-width: 768px) {
  .products-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
  }

  .products-section > .products-container {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
  }
}

@media screen and (max-width: 600px) {
    .shopping-item-card {
        padding: .5rem;
    }

    .product-img {
        height: 4rem;
        width: 4rem;
    }

    .item-main {
        flex-direction: column;
        align-items: start;
        gap: .5rem;
    }

    .item-main > div {
        max-width: 90%;
    }

    .item-main > div:last-child {
        align-self: end;
    }

    .item-name,
    .item-name > a {
        white-space: unset;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* hover only on desktop*/
@media (hover: hover) {
    .delete-btn:hover {
        color: var(--bs-btn-hover-color);
        background-color: var(--bs-btn-hover-bg);
        border-color: var(--bs-btn-hover-border-color);
    }

    .custom-checkbox:hover input ~ .checkmark {
        border-color: var(--green-400);
        background-color: var(--green-50);
    }

    .btn-count:hover {
        background: var(--green-100);
    }

    .search-button:hover {
        cursor: pointer;
    }
}