/**
 * ============================================================================
 * SHOPTET.CZ - PRICE MEASURE + QUANTITY SELECTOR STYLES
 * ============================================================================
 * File: styler.css
 * Description: 
 *   1. Styles for price-measure fetched from detail page
 *   2. Styles for custom quantity selector
 * Version: 3.0
 * ============================================================================
 */

/* ============================================================================
   1. PRICE MEASURE FROM DETAIL PAGE
   ============================================================================
   Displays price-measure (e.g., "22 Kč / 1 chiếc") on category listings
   Fetched via AJAX from product detail page
   ============================================================================ */

/* Hide original product appendix (e.g., "/ balení") */
.product-appendix {
  display: none !important;
}

/* Main container for fetched price measure */
.price-measure-from-detail {
  display: block;
  font-size: 12px;
  color: #666;
  margin: 4px 0;
  padding: 2px 0;
  line-height: 1.3;
}

/* The inner span with actual price measure text */
.price-measure-from-detail span,
.price-measure-from-detail {
  color: #106C37;
  font-weight: 500;
}

/* When placed before price */
.price-measure-from-detail + .price.price-final {
  margin-top: 2px;
}

/* ============================================================================
   2. PRODUCT QUANTITY SELECTOR
   ============================================================================
   Purpose: Custom quantity input with +/- buttons for products
   Layout: Quantity (left, 35%) + Add to Cart button (right, 65%) on same row
   ============================================================================ */

/* Form layout - Horizontal row with 35/65 split, full width */
.product form.pr-action {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

/* Quantity container - 40% width on desktop */
.product .quantity {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40%;
  min-width: 90px;
  max-width: none;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #e0e5ee;
  background: #fff;
  position: relative;
  height: 44px;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Number input - flexible width with left padding */
.product .quantity input.amount {
  border: 0;
  outline: none;
  background: transparent;
  flex: 1;
  min-width: 40px;
  max-width: 60px;
  height: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  padding: 0 0 0 4px;
  margin: 0;
  -moz-appearance: textfield;
}

/* Remove number input spinners */
.product .quantity input.amount::-webkit-outer-spin-button,
.product .quantity input.amount::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Increase/Decrease buttons with text + and - */
.product .quantity .decrease,
.product .quantity .increase {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 36px;
  background: #f8f9fa;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  font-size: 20px;
  font-weight: 700;
  color: #495057;
  line-height: 1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.product .quantity .decrease {
  border-right: 1px solid #e0e5ee;
}

.product .quantity .increase {
  border-left: 1px solid #e0e5ee;
}

.product .quantity .decrease:hover,
.product .quantity .increase:hover {
  background-color: #e9ecef;
}

.product .quantity .decrease:active,
.product .quantity .increase:active {
  background-color: #dee2e6;
}

/* Add to Cart button - 60% width on desktop (leaves space for right border) */
.product form.pr-action .btn-cart,
.product form.pr-action .add-to-cart-button {
  width: 60%;
  flex: 0 0 60%;
  min-width: 0;
  max-width: none;
  height: 44px;
  margin: 0;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  line-height: 1.2;
  text-align: center;
  box-sizing: border-box;
}

/* For product listings - 40/60 split, 90% width */
.products-block .product form.pr-action {
  width: 90%;
  max-width: none;
}

.products-block .product .quantity {
  height: 40px;
  width: 40%;
  min-width: 80px;
  max-width: none;
}

.products-block .product .quantity input.amount {
  font-size: 15px;
}

.products-block .product .quantity .decrease,
.products-block .product .quantity .increase {
  width: 32px;
  font-size: 18px;
}

.products-block .product form.pr-action .btn-cart,
.products-block .product form.pr-action .add-to-cart-button {
  height: 40px;
  width: 60%;
  flex: 0 0 60%;
  font-size: 12px;
  padding: 0 6px;
  white-space: normal;
  overflow: visible;
}

/* ============================================================================
   3. MOBILE QUANTITY SELECTOR
   ============================================================================
   On mobile (< 768px): Stack quantity and button vertically
   Both take full width, quantity has larger +/- buttons
   ============================================================================ */

@media (max-width: 768px) {
  .product form.pr-action,
  .products-block .product form.pr-action {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 30px;
  }
  
  /* Quantity takes full row width like the button */
  .product .quantity,
  .products-block .product .quantity {
    height: 48px;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  
  .product .quantity input.amount,
  .products-block .product .quantity input.amount {
    flex: 1;
    font-size: 17px; /* Prevent zoom on iOS */
    max-width: none;
  }
  
  .product form.pr-action .btn-cart,
  .product form.pr-action .add-to-cart-button,
  .products-block .product form.pr-action .btn-cart,
  .products-block .product form.pr-action .add-to-cart-button {
    height: 48px;
    width: 100%;
    flex: none;
    font-size: 14px;
    padding: 0 16px;
    max-width: 100%;
  }
}
