/* Progressive Incentives Plugin CSS */

.pi-incentives-container {
    margin: 0px;
    padding: 5px;
    background: #f9f9f9;
    border-radius: 0px;
    border: 1px solid #e5e5e5;
  }
  
  .pi-incentives-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 5px;
  }
  
  .pi-incentive-item {
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    padding: 5px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
    width: 100%;
  
    display: flex;
    flex-direction: column;
    position: relative;
    gap: 5px;
    justify-content: center;
  }
  .pi-incentive-item:not(:first-child)::after {
    content: '';
    position: absolute;
    background-color: #e5e5e5;
    height: 2px;
    width: 20px;
    top: 50%;
    left: -22px;
  }
  
  
  .pi-incentive-item.achieved:not(:first-child)::after {
    content: '';
    position: absolute;
    background-color: #d1bba0;
    height: 2px;
    width: 20px;
    top: 50%;
    left: -22px;
  }

  .pi-incentive-item.achieved {
    border-color: #d1bba0;
    background: #ffffff;
  }
  
  .pi-incentive-item.ineligible {
    border-color: #ccc;
  }
  
  .pi-incentive-item.ineligible .pi-icon,
  .pi-incentive-item.ineligible .pi-content {
    opacity: 0.6;
  }
  
  .pi-incentive-item.ineligible .pi-variations {
    pointer-events: none;
    opacity: 0.4;
  }
  
  
  .pi-incentive-item:before {
      content: "x";
      position: absolute;
      top: 0px;
      right: 0px;
      width: 24px;
      height: 24px;
      background: #ccc;
      color: white;
      border-radius: 0px 10px 0px 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: bold;
      line-height: 26px;
  }
  

  .pi-incentive-item.achieved::before {
    content: "✓";
    position: absolute;
    top: 0px;
    right: 0px;
    width: 24px;
    height: 24px;
    background: #d1bba0;
    color: white;
    border-radius: 0px 10px 0px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
  }
  
  .pi-icon {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .pi-icon svg {
    width: 60px;
    height: 60px;
    color: #000;
  }
  
  .pi-icon img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
  }
  
  .pi-content h4 {
    margin: 0 0 0 0;
    font-size: 12px;
    font-weight: 400 !important;
    color: #333;
  }
  
  .pi-price {
    font-size: 14px;
    font-weight: 500;
  }
  
  .pi-attribute-group {
    margin-bottom: 5px;
  }
  
  .pi-attribute-label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
  }
  
  .pi-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
  }
  
  .pi-swatch {
    border: 2px solid #ddd;
    background: transparent !important;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    min-width: 20px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-radius: 100% !important;
  }
  
  .pi-swatch:hover:not(.out-of-stock):not(:disabled) {
    border-color: #2c5aa0;
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px rgb(0 0 0 / 84%);
  }
  
  .pi-swatch.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px rgb(0 0 0 / 84%);
  }
  
  .pi-swatch.out-of-stock {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  .pi-swatch.out-of-stock::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 80%;
    background: #ff4444;
    transform: translate(-50%, -50%) rotate(45deg);
  }
  
  /* Image swatches */
  .pi-swatch.img-btn {
    padding: 2px;
    width: 20px;
    height: 20px;
    min-height: 20px;
  }
  
  .pi-swatch__img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    border-radius: 100%;
  }
  
  /* Color swatches */
  .pi-swatch.color-btn {
    width: 20px;
    height: 20px;
    padding: 2px;
    max-height: 20px;
    min-height: 20px;
  }
  
  .pi-swatch__color {
    width: 100%;
    height: 100%;
    border-radius: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  /* Text swatches */
  .pi-swatch.txt-btn {
    padding: 8px 12px;
    min-width: auto;
    height: auto;
    font-size: 13px;
  }
  
  .pi-swatch__text {
    color: #555;
    font-weight: 500;
  }
  
  .pi-swatch.selected .pi-swatch__text {
    color: #2c5aa0;
  }
  
  .pi-progress-message {
    text-align: center;
    font-size: 14px;
    color: #000;
    padding: 10px 0px;
  }
  
  /* Free gift styling */
  .pi-free-gift-price {
    color: #4caf50;
    font-weight: bold;
    font-size: 12px;
    background: #f8fff8;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #4caf50;
  }
  
  /* Cart updates animation */
  .pi-incentives-container.updating {
    opacity: 0.7;
    transition: opacity 0.3s ease;
  }
  
  .pi-incentives-container.updating::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2c5aa0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
  }
  
  /* Responsive adjustments */
  @media (max-width: 768px) {
    .pi-incentives-grid {
      grid-template-columns: 1fr;
    }
  
    .pi-incentive-item {
      padding: 5px;
    }
  
    .pi-swatches {
      justify-content: flex-start;
    }
    .pi-icon img {
        width: 50px;
        height: 50px;
        object-fit: cover;
        border-radius: 8px;
    }
  }
  
  /* Animation for achievement */
  @keyframes achievement {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.05);
    }
    100% {
      transform: scale(1);
    }
  }
  
  .pi-incentive-item.just-achieved {
    animation: achievement 0.6s ease;
  }
  
  /* Loading state */
  .pi-incentive-item.loading {
    opacity: 0.6;
    pointer-events: none;
  }
  
  .pi-incentive-item.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2c5aa0;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% {
      transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
      transform: translate(-50%, -50%) rotate(360deg);
    }
  }
  
  /* Variation selection message */
  .pi-variation-message {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff9800;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    animation: fadeInOut 3s ease;
  }
  
  @keyframes fadeInOut {
    0% {
      opacity: 0;
      transform: translateX(-50%) translateY(10px);
    }
    20% {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    80% {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    100% {
      opacity: 0;
      transform: translateX(-50%) translateY(-10px);
    }
  }
  
  /* Ensure "Dovana" label is styled consistently everywhere */
  .pi-free-gift-price {
    color: #00a32a !important;
    font-weight: bold !important;
    font-size: 14px !important;
  }
  
  /* Mini cart specific styling */
  .woocommerce-mini-cart .pi-free-gift-price {
    color: #00a32a !important;
    font-weight: bold !important;
  }
  
  /* Cart page styling */
  .woocommerce-cart-form .pi-free-gift-price {
    color: #00a32a !important;
    font-weight: bold !important;
  }
  
  /* Checkout page styling */
  .woocommerce-checkout .pi-free-gift-price {
    color: #00a32a !important;
    font-weight: bold !important;
  }
  
  /* Ensure free gift items are easily identifiable */
  .cart_item[data-pi-free-gift="true"] {
    background-color: #f0f9f0;
    border-left: 3px solid #00a32a;
  }
  
  /* Mini cart free gift items */
  .woocommerce-mini-cart-item[data-pi-free-gift="true"] {
    background-color: #f0f9f0;
    border-left: 3px solid #00a32a;
    padding-left: 8px;
  }
  
  /* ==================== NEW MODAL STYLES ==================== */
  
  /* Modal Overlay */
  .pi-modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.75);
      z-index: 99999;
      display: none;
      justify-content: center;
      align-items: center;
      padding: 20px;
      box-sizing: border-box;
  }
  
  .pi-modal-overlay.show {
      display: flex;
  }
  
  /* Prevent body scroll when modal is open */
  body.pi-modal-open {
      overflow: hidden;
  }
  
  /* Modal Content */
  .pi-modal-content {
      background: #fefbf7;
      border-radius: 12px;
      max-width: 400px;
      width: 100%;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
      position: relative;
  }
  
  /* Modal Header */
  .pi-modal-header {
    padding: 20px 15px 0px 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    flex-direction: column;
  }
  .pi-modal-header p{
    margin:0 !important; 
  }
  .pi-modal-header h3 {
      margin: 0;
      font-size: 20px;
      font-weight: 600;
      color: #333;
  }
  
  .pi-modal-close {
      background: none;
      border: none !important;
      font-size: 28px !important;
      color: #666;
      cursor: pointer;
      padding: 0 !important;
      width: 32px !important;
      height: 32px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: center !important;
      border-radius: 50%;
      transition: all 0.2s ease;
      background: none !important;
      position: absolute !important;
      right: 5px !important;
      top: 0 !important;
  }
  
  .pi-modal-close:hover {
      background-color: #f0f0f0;
      color: #333;
  }
  
  /* Modal Body */
  .pi-modal-body {
      padding: 20px 24px 20px 24px;
      overflow-y: auto;
      flex: 1;
  }
  
  .pi-modal-body > p {
      margin: 0 0 24px 0;
      font-size: 16px;
      color: #666;
  }
  
  /* Gift Items Grid */
.pi-modal-gifts {
    display: flex;
    flex-direction: column;
    gap: 0px;
    /*border: 1px solid #e1e1e1; */
    border-radius: 12px;
    background: #fffefa;
}
  
  /* Individual Gift Item */
  .pi-modal-gift-item {
    display: flex;
    gap: 15px;
    padding: 15px;
  }
  
  .pi-modal-gift-item:hover {
      border-color: #ccc;
  }
  
  /* Gift Image */
  .pi-modal-gift-image {
      flex-shrink: 0;
      width: 80px;
      height: 80px;
      border-radius: 8px;
      overflow: hidden;
      background-color: #f5f5f5;
      display: flex;
      align-items: center;
      justify-content: center;
  }
  
  .pi-modal-gift-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      border-radius: 8px;
  }
  
  /* Gift Details */
  .pi-modal-gift-details {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 5px;
  }
  
  .pi-modal-gift-name {
      margin: 0;
      font-size: 16px;
      font-weight: 600;
      color: #333;
      line-height: 1.3;
  }
  
  /* Price Section */
  .pi-modal-gift-price {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
  }
  
  .pi-regular-price {
      font-size: 16px;
      color: #999;
      text-decoration: line-through;
      font-weight: 500;
  }
  
  .pi-gift-text {
      background: linear-gradient(135deg, #4CAF50, #45a049);
      color: white;
      padding: 2px 12px;
      border-radius: 20px;
      font-size: 12px;
      font-weight: bold;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      display: none;
  }
  
  /* Variations Section in Modal - Override main styles for modal context */
  .pi-modal-variations {
      margin-top: 0px;
  }
  
  .pi-modal-variations .pi-attribute-group {
      margin-bottom: 0px;
  }
  
  .pi-modal-variations .pi-attribute-label {
      display: block;
      font-weight: 600;
      color: #333;
      margin-bottom: 8px;
      font-size: 14px;
  }
  
  .pi-modal-variations .pi-selected-value {
    color: #000000;
    font-weight: 700;
  }
  
  /* Modal Swatches - Different from main swatches */
  .pi-modal-variations .pi-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }
  
  .pi-modal-variations .pi-swatch {
      border: 1px solid #ddd;
      background: white;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s ease;
      padding: 0;
      overflow: hidden;
      min-width: 30px;
      min-height: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
  }
  
  .pi-modal-variations .pi-swatch:hover:not(.disabled) {
      border-color: #000000;
      transform: translateY(-1px);
      box-shadow: 0 2px 8px #000000;
  }
  
  .pi-modal-variations .pi-swatch.selected {
    border-color: #000000;
    background-color: #f8fff8;
    box-shadow: 0 0 0 1px #000000;
  }
  
  .pi-modal-variations .pi-swatch.disabled {
      opacity: 0.4;
      cursor: not-allowed;
      background-color: #f5f5f5;
  }
  
  /* Modal Color Swatches */
  .pi-modal-variations .pi-swatch.color-btn {
      width: 30px;
      height: 30px;
  }
  
  .pi-modal-variations .pi-swatch__color {
      width: 22px;
      height: 22px;
      border-radius: 20px;
      border: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  /* Modal Image Swatches */
  .pi-modal-variations .pi-swatch.img-btn {
      width: 30px;
      height: 30px;
  }
  
  .pi-modal-variations .pi-swatch__img {
      width: 22px;
      height: 22px;
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      border-radius: 20px;
  }
  
  /* Modal Text Swatches */
  .pi-modal-variations .pi-swatch.txt-btn {
      padding: 8px 12px;
      min-width: auto;
      height: auto;
  }
  
  .pi-modal-variations .pi-swatch__text {
      font-size: 13px;
      font-weight: 500;
      color: #333;
      white-space: nowrap;
  }
  
  /* Modal Footer */
  .pi-modal-footer {
      padding: 16px 24px 24px;
      flex-shrink: 0;
      display: flex;
      justify-content: center;
  }
  
  /* Add Gifts Button */
  .pi-add-gifts-button {
    background: #000000 !important;
    color: white !important;
    border: none;
    padding: 14px 32px;
    border-radius: 5px !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.3px;
    min-width: 200px;
}
  
  .pi-add-gifts-button:hover:not(:disabled) {
      background: #292929 !important;
  }
  
  .pi-add-gifts-button:disabled,
  .pi-add-gifts-button.disabled {
      background: #ccc;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
      opacity: 0.6;
  }
  
  .pi-incentives-grid .pi-incentive-item .pi-variations {
    display: none !important;
  }
  /* Modal Responsive Design */
  @media (max-width: 768px) {
      .pi-modal-content {
          margin: 10px;
          max-height: calc(100vh - 20px);
      }
      
      .pi-modal-header {
          padding: 20px 16px 12px;
      }
      
      .pi-modal-header h3 {
          font-size: 20px;
      }
      
      .pi-modal-body {
          padding: 20px 16px;
      }
      
      .pi-modal-footer {
          padding: 12px 16px 20px;
      }
      
      .pi-modal-gift-item {
          /* flex-direction: column; */
          gap: 16px;
          padding: 16px;
      }
      
      .pi-modal-gift-image {
          align-self: center;
          width: 100px;
          height: 100px;
      }
      
      .pi-add-gifts-button {
          width: 100%;
          min-width: auto;
      }
  }
  
  @media (max-width: 480px) {
      .pi-modal-variations .pi-swatches {
          gap: 6px;
      }
      
      .pi-modal-variations .pi-swatch {
          min-width: 30px;
          min-height: 30px;
      }
      
      .pi-modal-variations .pi-swatch.color-btn {
          width: 30px;
          height: 30px;
      }
      
      .pi-modal-variations .pi-swatch__color {
          width: 22px;
          height: 22px;
      }
      
      .pi-modal-variations .pi-swatch.img-btn {
          width: 30px;
          height: 30px;
      }
      
      .pi-modal-variations .pi-swatch__img {
          width: 22px;
          height: 22px;
      }
  }