/* Mola Bonuses Frontend Styles */

.mola-bonus-widget {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  margin: 20px 0;
}

.mola-bonus-widget h3 {
  margin: 0 0 15px 0;
  font-size: 18px;
}

.mola-bonus-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
}

.mola-bonus-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  text-align: center;
}

.mola-bonus-item .value {
  font-size: 24px;
  font-weight: bold;
}

.mola-bonus-item .label {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 5px;
}

.mola-loyalty-level {
  background: #f5f5f5;
  padding: 15px;
  margin: 15px 0;
}

.mola-loyalty-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  margin-right: 10px;
}

.mola-loyalty-badge.basic {
  background: #e0e0e0;
  color: #333;
}

.mola-loyalty-badge.community {
  background: #667eea;
  color: white;
}

.mola-loyalty-badge.vip {
  background: #f39c12;
  color: white;
}

.mola-progress-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  margin: 10px 0;
  overflow: hidden;
}

.mola-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.mola-bonus-apply {
  margin: 20px 0;
  padding: 20px;
  background: #fff;
  border: 1px solid #ddd;
}

.mola-bonus-apply h4 {
  margin: 0 0 15px 0;
}

.mola-bonus-apply-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.mola-bonus-apply-form input[type="number"] {
  flex: 1;
  max-width: 200px;
  padding: 10px;
  border: 1px solid #ddd;
}

.mola-bonus-apply-form button {
  padding: 10px 20px;
}

.mola-bonus-applied-message {
  color: #155724;
  margin: 15px 0;
}

.mola-bonus-message {
  margin: 12px 0 0;
}

.mola-bonus-history {
  margin: 20px 0;
}

.mola-bonus-history-item {
  padding: 15px;
  border-left: 4px solid #ddd;
  margin: 10px 0;
  background: #f9f9f9;
}

.mola-bonus-history-item.accrual {
  border-left-color: #28a745;
}

.mola-bonus-history-item.deduction {
  border-left-color: #dc3545;
}

.mola-bonus-history-item.activation {
  border-left-color: #667eea;
}

.mola-bonus-history-item .date {
  color: #999;
  font-size: 12px;
}

.mola-bonus-history-item .amount {
  font-weight: bold;
  font-size: 16px;
}

.mola-bonus-history-item.accrual .amount {
  color: #28a745;
}

.mola-bonus-history-item.deduction .amount {
  color: #dc3545;
}

/* Cart bonus notification */
.cart-sale-items-notice {
  background: #ffc107;
  color: #333;
  padding: 15px;
  margin: 15px 0;
}

.cart-bonus-discount {
  font-weight: bold;
  color: #667eea;
}

.mola-account-bonus-summary {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  margin: 0 0 2.4rem;
  padding: 2.4rem;
  border: 0.1rem solid var(--color-border-10, #e8e8e8);
  background: var(--color-bg, #fff);
  color: var(--color-text-high, #111);
  font-size: 1.4rem;
  line-height: 142.857%;
}

.mola-account-bonus-summary__item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mola-account-bonus-summary__label {
  display: block;
  color: var(--color-text-high-80, #666);
  font-size: 1.4rem;
}

.mola-account-bonus-summary__value {
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.2;
}

.mola-account-bonus-summary__link {
  display: inline-flex;
  align-items: center;
  margin-top: 0.4rem;
  color: var(--color-text-high, #111);
  font-size: 1.4rem;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
  transition: color 0.325s;
}

.mola-account-bonus-summary__link:hover {
  color: var(--color-text-high-80, #666);
}

.account .woocommerce:has(.mola-account-bonus-summary) {
  display: grid;
  grid-template-columns: 30.5rem 1fr;
  align-items: start;
  gap: 4rem;
}

.account .woocommerce:has(.mola-account-bonus-summary) .mola-account-bonus-summary {
  grid-column: 1;
  grid-row: 1;
}

.account .woocommerce:has(.mola-account-bonus-summary) .woocommerce-MyAccount-navigation {
  grid-column: 1;
  grid-row: 2;
}

.account .woocommerce:has(.mola-account-bonus-summary) .woocommerce-MyAccount-content {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.mola-account-bonus-summary__item span,
.checkout__bonus-balance {
  display: block;
  color: var(--color-text-high-80, #666);
  font-size: 1.4rem;
  margin-bottom: 0;
}

.mola-account-bonus-summary__item strong {
  font-size: 2rem;
}

.account .woocommerce-MyAccount-navigation-link--bonuses a:before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='9' width='16' height='11' rx='1.5'/%3E%3Cpath d='M4 13h16M12 9v11M12 9H8.5A2.5 2.5 0 1 1 12 6.5V9ZM12 9h3.5A2.5 2.5 0 1 0 12 6.5V9Z'/%3E%3C/svg%3E") no-repeat 50%/1.7rem;
}

.mola-account-bonuses {
  min-width: 0;
}

.mola-account-bonuses__level {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 20px 0;
}

.mola-account-bonuses__level span,
.mola-account-bonuses__level small {
  color: #666;
}

.mola-account-bonuses__table {
  border: 1px solid #e4e4e4;
  overflow: hidden;
  margin: 0 0 24px;
}

.mola-account-bonuses__row {
  display: grid;
  grid-template-columns: 1fr 1.2fr repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid #e4e4e4;
}

.mola-account-bonuses__row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mola-account-bonuses__row:first-child {
  border-top: 0;
}

.mola-account-bonuses__row--head {
  background: #f7f7f7;
  font-weight: 600;
}

.mola-account-bonuses__history-item {
  display: grid;
  grid-template-columns: 150px 90px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.mola-account-bonuses__history-item span {
  color: #777;
}

.mola-account-bonuses__history-item em {
  font-style: normal;
}

.mola-cart-accrual-bonus {
  margin: 8px 0 14px;
  color: #211f20;
  font-size: 14px;
}

.mola-product-bonus {
  display: inline-block;
  margin-left: 10px;
  color: #211f20;
  font-size: 14px;
  white-space: nowrap;
  background: #eeae9b;
}

.mola-product-bonus__hint {
  color: #777;
  font-weight: 400;
}

/* Checkout page */
.checkout__bonus-section {
  margin: 20px 0;
}

.checkout__bonus-section--coupon {
  margin: 0 0 32px;
}

.checkout__bonus-section h3 {
  margin: 0 0 15px 0;
}

.checkout__bonus-apply {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 15px 0;
}

.checkout__bonus-apply span {
  flex: 1 1 220px;
}

.checkout__bonus-apply input {
  flex: 1;
  max-width: 200px;
  padding: 10px;
  border: 1px solid #ddd;
}

.checkout__bonus-apply button {
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  cursor: pointer;
}

.checkout__bonus-apply button:hover {
  background: #764ba2;
}

.checkout__bonus-info {
  background: white;
  padding: 15px;
  border: 1px solid #ddd;
  margin: 15px 0;
}

.checkout__bonus-info .label {
  color: #666;
  font-size: 12px;
}

.checkout__bonus-info .value {
  font-size: 18px;
  font-weight: bold;
  color: #667eea;
}

.checkout__bonus-message {
  margin: 12px 0 0;
}

/* Loading state */
.mola-bonus-loading {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .mola-account-bonuses__table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mola-account-bonuses__row {
    min-width: 760px;
  }
}

@media (max-width: 1279.98px) {
  .account .woocommerce:has(.mola-account-bonus-summary) {
    grid-template-columns: 27rem 1fr;
  }
}

@media (max-width: 768px) {
  .mola-bonus-info {
    grid-template-columns: repeat(2, 1fr);
  }

  .mola-account-bonuses__history-item {
    grid-template-columns: 1fr;
  }

  .mola-account-bonus-summary {
    margin-bottom: 0;
  }

  .mola-account-bonuses__level {
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .mola-account-bonuses__table {
    margin-right: -16px;
    padding-bottom: 4px;
  }

  .mola-account-bonuses__row {
    grid-template-columns: 1fr 1.2fr repeat(3, minmax(110px, 1fr));
    min-width: 700px;
    font-size: 14px;
  }

  .mola-bonus-apply-form {
    flex-direction: column;
  }

  .mola-bonus-apply-form input[type="number"] {
    max-width: 100%;
  }

  .checkout__bonus-apply {
    flex-direction: column;
  }

  .checkout__bonus-apply input {
    max-width: 100%;
  }
}

@media (max-width: 1023.98px) {
  .account .woocommerce:has(.mola-account-bonus-summary) {
    grid-template-columns: 23rem 1fr;
  }
}

@media (max-width: 768.98px) {
  .account .woocommerce:has(.mola-account-bonus-summary) {
    grid-template-columns: 19.6rem 1fr;
  }
}

@media (max-width: 639.98px) {
  .account .woocommerce:has(.mola-account-bonus-summary) {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 2.4rem;
  }

  .account .woocommerce:has(.mola-account-bonus-summary) .woocommerce-MyAccount-content {
    width: 100%;
  }

  .mola-account-bonus-summary {
    width: 100%;
  }
}
