/**
 * Subscription styling for cart and checkout
 */

/* Cart and Checkout Subscription Options */
.thb-subscription-option {
  border-top: 1px solid #e5e5e5;
  background-color: #f8f9fa;
}

.thb-subscription-option th,
.thb-subscription-option td {
  padding: 15px 10px;
  vertical-align: top;
}

.thb-subscription-toggle {
  margin-bottom: 15px;
}

.thb-subscription-toggle label {
  display: flex;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
  margin: 0;
}

.thb-subscription-toggle input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.2);
}

.thb-subscription-options {
  padding: 15px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 10px;
}

.thb-subscription-frequency,
.thb-subscription-next-delivery {
  margin-bottom: 15px;
}

.thb-subscription-frequency label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  color: #333;
}

.thb-subscription-frequency select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.4;
  height: auto;
  min-height: 40px;
  vertical-align: middle;
  background-color: #fff;
  background-image: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 16px 12px;
  padding-right: 40px;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.thb-subscription-frequency select:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

.thb-subscription-frequency select:hover {
  border-color: #999;
}

.thb-subscription-frequency select option {
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
}

.thb-subscription-delivery-info {
  font-size: 14px;
  color: #666;
  margin: 0;
  padding: 10px;
  background-color: #f0f8ff;
  border: 1px solid #b8daff;
  border-radius: 4px;
  border-left: 4px solid #007cba;
}

.thb-subscription-discount {
  background-color: #e8f5e8;
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 15px;
  border-left: 4px solid #28a745;
}

.thb-subscription-savings {
  color: #28a745;
  font-weight: 600;
  margin: 0 0 8px 0;
  font-size: 14px;
}

.thb-subscription-total {
  margin: 0;
  font-size: 16px;
}

.thb-subscription-amount {
  color: #28a745;
  font-weight: 700;
}

/* Account Page Subscriptions */
.thb-subscription-account {
  margin-top: 20px;
}

.thb-subscription-account h2 {
  margin-bottom: 20px;
  color: #333;
}

.subscription-status {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.subscription-status.status-active {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.subscription-status.status-paused {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.subscription-status.status-cancelled {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.subscription-status.status-expired {
  background-color: #f1f1f1;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.subscription-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.subscription-actions .button {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.4;
  border-radius: 3px;
  text-decoration: none;
  border: 1px solid #ddd;
  background-color: #fff;
  color: #333;
  transition: all 0.2s ease;
}

.subscription-actions .button:hover {
  background-color: #f8f9fa;
  border-color: #999;
  text-decoration: none;
}

.subscription-actions .thb-pause-subscription:hover,
.subscription-actions .thb-cancel-subscription:hover {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.subscription-actions .thb-resume-subscription:hover {
  background-color: #28a745;
  border-color: #28a745;
  color: #fff;
}

.subscription-actions .thb-view-subscription:hover {
  background-color: #007cba;
  border-color: #007cba;
  color: #fff;
}

/* Responsive Design */
@media (max-width: 768px) {
  .thb-subscription-option th,
  .thb-subscription-option td {
    display: block;
    width: 100%;
    padding: 10px;
  }

  .thb-subscription-option th {
    background-color: #f0f0f0;
    font-weight: 600;
    border-bottom: none;
  }

  .thb-subscription-options {
    padding: 10px;
  }

  .thb-subscription-frequency select {
    font-size: 16px;
    min-height: 44px;
    padding: 12px 14px;
    padding-right: 44px;
  }

  .subscription-actions {
    flex-direction: column;
  }

  .subscription-actions .button {
    text-align: center;
    margin-bottom: 5px;
  }
}

/* WooCommerce table compatibility */
.woocommerce-cart-form .thb-subscription-option,
.woocommerce-checkout .thb-subscription-option {
  background-color: #f8f9fa;
}

.woocommerce table.shop_table .thb-subscription-option th,
.woocommerce table.shop_table .thb-subscription-option td {
  border: 1px solid #e5e5e5;
}

/* Loading state */
.thb-subscription-loading {
  opacity: 0.6;
  pointer-events: none;
}

.thb-subscription-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #333;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
