/* Create Subscription Page Styles */

.subscription-page {
  background-color: #f9f9f9;
  min-height: 80vh;
  padding: 40px 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.subscription-header {
  text-align: center;
  margin-bottom: 40px;
}

.subscription-header h1 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.subscription-header h1 i {
  color: #ef4444;
}

.subscription-header p {
  font-size: 1.1rem;
  color: #666;
  margin: 0;
}

.subscription-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

/* Product Preview Section */
.product-preview {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 20px;
}

.product-preview-loading {
  text-align: center;
  padding: 40px 20px;
}

.product-preview-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ef4444;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.product-preview-loading p {
  color: #666;
  font-size: 16px;
}

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

.product-info {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.product-image {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-details h3 {
  font-size: 1.3rem;
  color: #333;
  margin: 0 0 10px 0;
  line-height: 1.3;
}

.product-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ef4444;
  margin-bottom: 10px;
}

.product-sku {
  color: #666;
  font-size: 0.9rem;
}

/* Subscription Pricing Styles */
.product-price {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.original-price {
  text-decoration: line-through;
  color: #999;
  font-size: 1.2rem;
  font-weight: 500;
}

.discounted-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ef4444;
}

.subscription-savings {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.9rem;
  color: #22c55e;
  font-weight: 500;
  margin-bottom: 10px;
}

.subscription-savings i {
  color: #22c55e;
}

/* Subscription Form */
.subscription-form-container {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.form-section {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 1px solid #f0f0f0;
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.form-section h3 {
  font-size: 1.2rem;
  color: #333;
  margin: 0 0 15px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-section h3 i {
  color: #ef4444;
  font-size: 1.1rem;
}

/* Quantity Controls */
.quantity-control {
  display: flex;
  align-items: center;
  gap: 0;
  width: fit-content;
}

/* Quantity selector in product info section */
.quantity-selector-row {
  margin: 15px 0;
  display: flex;
  justify-content: center;
}

/* Quantity row in summary section */
.summary-row.quantity-row .quantity-control {
  margin-left: 0;
}

.quantity-btn {
  width: 45px;
  height: 45px;
  border: 2px solid #e0e0e0;
  background: #f8f9fa;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
}

.quantity-btn:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.quantity-btn.decrease {
  border-radius: 6px 0 0 6px;
}

.quantity-btn.increase {
  border-radius: 0 6px 6px 0;
}

.quantity-input {
  width: 70px;
  height: 45px;
  border: 2px solid #e0e0e0;
  border-left: none;
  border-right: none;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  background: white;
}

.quantity-input:focus {
  outline: none;
  border-color: #ef4444;
}

/* Interval Controls */
.interval-control {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}

.interval-count {
  display: flex;
  align-items: center;
  gap: 10px;
}

.interval-count label {
  font-weight: 500;
  color: #333;
}

.interval-select {
  height: 40px;
  padding: 0 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  background: white;
  cursor: pointer;
}

.interval-select:focus {
  outline: none;
  border-color: #ef4444;
}

.interval-preview {
  background: #f8f9fa;
  padding: 10px 15px;
  border-radius: 6px;
  border-left: 4px solid #ef4444;
}

.interval-preview span {
  color: #333;
  font-weight: 500;
}

.next-delivery-date {
  background: #e8f5e8;
  padding: 10px 15px;
  border-radius: 6px;
  border-left: 4px solid #22c55e;
  margin-top: 8px;
}

.next-delivery-date span {
  color: #166534;
  font-weight: 500;
  font-size: 0.95rem;
}

#next-delivery-date {
  font-weight: 600;
  color: #15803d;
}

/* Date Input */
.start-date-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-input {
  width: 200px;
  height: 45px;
  padding: 0 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
}

.date-input:focus {
  outline: none;
  border-color: #ef4444;
}

.date-input:disabled {
  background-color: #f5f5f5;
  color: #666;
  cursor: not-allowed;
}

.date-help {
  color: #666;
  font-size: 14px;
}

/* Card Type Controls */
.card-type-control {
  margin-bottom: 20px;
}

/* Card Controls */
.card-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-select {
  height: 45px;
  padding: 0 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  background: white;
  cursor: pointer;
}

.card-select:focus {
  outline: none;
  border-color: #ef4444;
}

.card-help {
  color: #666;
  font-size: 14px;
}

/* Custom Card Form */
.custom-card-fields {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.card-row {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.card-field {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.card-field.full-width {
  flex: 1 1 100%;
  min-width: 100%;
}

.card-field label {
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.card-input {
  height: 45px;
  padding: 0 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  background: white;
  transition: border-color 0.2s ease;
}

.card-input:focus {
  outline: none;
  border-color: #ef4444;
}

.card-input::placeholder {
  color: #999;
}

/* Existing Card Section */
.existing-card-section {
  margin-top: 15px;
}

/* Address Type Controls */
.address-type-control {
  margin-bottom: 20px;
}

.radio-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radio-input {
  width: 18px;
  height: 18px;
  border: 2px solid #e0e0e0;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  accent-color: #ef4444;
}

.radio-input:checked {
  border-color: #ef4444;
}

.radio-label {
  cursor: pointer;
  color: #333;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  user-select: none;
}

.radio-label i {
  color: #ef4444;
  font-size: 14px;
}

.radio-input:checked + .radio-label {
  color: #ef4444;
}

/* Address Controls */
.address-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.address-select {
  height: 45px;
  padding: 0 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  background: white;
  cursor: pointer;
}

.address-select:focus {
  outline: none;
  border-color: #ef4444;
}

.address-help {
  color: #666;
  font-size: 14px;
}

/* Existing Address Section */
.existing-address-section {
  margin-top: 20px;
  padding: 20px;
  border: 2px solid #f0f0f0;
  border-radius: 8px;
  background: #fafafa;
}

.address-preview {
  margin-top: 15px;
}

.address-preview .address-input {
  background-color: #f8f9fa;
  color: #666;
  cursor: not-allowed;
}

.address-preview .address-input:disabled {
  opacity: 0.8;
}

/* Custom Address Fields */
.custom-address-fields {
  margin-top: 20px;
  padding: 20px;
  border: 2px solid #f0f0f0;
  border-radius: 8px;
  background: #fafafa;
}

.address-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.address-row:last-child {
  margin-bottom: 0;
}

.address-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.address-field label {
  font-weight: 500;
  color: #333;
  font-size: 14px;
}

.address-input {
  height: 40px;
  padding: 0 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 16px;
  background: white;
}

.address-input:focus {
  outline: none;
  border-color: #ef4444;
}

.address-input::placeholder {
  color: #999;
}

/* Save Address Option */
.save-address-option {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #333;
  font-size: 14px;
  font-weight: 500;
  user-select: none;
}

.checkbox-input {
  width: 16px;
  height: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  accent-color: #ef4444;
}

.checkbox-input:checked {
  border-color: #ef4444;
}

.checkmark {
  position: relative;
}

.checkbox-label:hover .checkbox-input {
  border-color: #ef4444;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 25px;
  border-top: 2px solid #f0f0f0;
}

.btn-secondary,
.btn-primary {
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: #666;
  border-color: #e0e0e0;
}

.btn-secondary:hover {
  background: #f5f5f5;
  border-color: #ccc;
  color: #333;
}

.btn-primary {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.btn-primary:hover {
  background: #dc2626;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Product Summary Section */
.subscription-summary {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 2px solid #f0f0f0;
}

.subscription-summary h4 {
  color: #333;
  margin: 0 0 15px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
}

.subscription-summary h4 i {
  color: #ef4444;
}

.summary-details {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row.total {
  font-weight: 700;
  font-size: 1.1rem;
  color: #ef4444;
  border-top: 2px solid #e9ecef;
  margin-top: 10px;
  padding-top: 15px;
}

.summary-row span:first-child {
  color: #666;
  min-width: 120px;
  margin-right: 15px;
  flex-shrink: 0;
}

.summary-row span:last-child {
  color: #333;
  font-weight: 500;
}

.summary-row.total span {
  color: #ef4444;
}

/* Product Error */
.product-error {
  text-align: center;
  padding: 40px 20px;
}

.product-error i {
  font-size: 60px;
  color: #ef4444;
  margin-bottom: 20px;
  opacity: 0.8;
}

.product-error h3 {
  color: #333;
  margin: 0 0 15px 0;
  font-size: 1.5rem;
}

.product-error p {
  color: #666;
  margin: 0 0 25px 0;
  line-height: 1.5;
}

/* Loading Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.loading-content {
  background: white;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.loading-content .spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ef4444;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loading-content p {
  color: #333;
  font-size: 16px;
  margin: 0;
}

/* Responsive Design */
@media (max-width: 992px) {
  .subscription-content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .product-preview {
    position: static;
  }
}

@media (max-width: 768px) {
  .subscription-header h1 {
    font-size: 2rem;
    flex-direction: column;
    gap: 10px;
  }

  .product-info {
    flex-direction: column;
    text-align: center;
  }

  .product-image {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }

  .interval-control {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .form-actions {
    justify-content: center;
    flex-direction: column;
  }

  .btn-secondary,
  .btn-primary {
    width: 100%;
    justify-content: center;
  }

  /* Mobile pricing adjustments */
  .product-price {
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }

  .original-price {
    font-size: 1rem;
  }

  .discounted-price {
    font-size: 1.3rem;
  }

  .subscription-savings {
    justify-content: center;
    text-align: center;
  }

  /* Mobile address adjustments */
  .address-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Mobile radio button adjustments */
  .radio-group {
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .subscription-form-container,
  .product-preview {
    padding: 20px;
  }

  .quantity-control {
    margin: 0 auto;
  }
}
