// Subscription Detail Page Styles
.arraysubs-subscription-detail {
  padding: 20px;

  .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;

    &__status {
      display: flex;
      gap: 5px;

      .status-badge {
        display: inline-block;
        padding: 6px 12px;
        border-radius: 4px;
        font-size: 13px;
        font-weight: 600;
        text-transform: uppercase;

        &.status-pending {
          background: #fef5e7;
          color: #d68910;
        }

        &.status-active {
          background: #d4edda;
          color: #155724;
        }

        &.status-on-hold {
          background: #fff3cd;
          color: #856404;
        }

        &.status-cancelled,
        &.status-expired {
          background: #f8d7da;
          color: #721c24;
        }

        &.status-trial {
          background: #d1ecf1;
          color: #0c5460;
        }

        &.status-waiting-cancel {
          background: #fef3c7;
          color: #92400e;
          display: inline-flex;
          align-items: center;
          font-size: 12px;
        }
      }
    }

    &__actions {
      display: flex;
      gap: 10px;
      align-items: center;

      .button {
        display: inline-flex;
        align-items: center;

        svg {
          flex-shrink: 0;
        }
      }
    }
  }

  .detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;

    @media (max-width: 1200px) {
      grid-template-columns: 1fr;
    }
  }

  .detail-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    overflow: hidden;

    &--full {
      grid-column: 1 / -1;
    }

    &__header {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 15px 20px;
      background: #f9f9f9;
      border-bottom: 1px solid #ccd0d4;

      svg {
        flex-shrink: 0;
      }

      h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
      }
    }

    &__body {
      padding: 20px;
    }
  }

  .info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;

    .info-item {
      display: flex;
      align-items: flex-start;
      gap: 10px;

      strong {
        min-width: 140px;
        color: #555;
        font-weight: 500;
      }

      a {
        color: #2271b1;
        text-decoration: none;

        &:hover {
          color: #135e96;
          text-decoration: underline;
        }
      }
    }
  }

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

    .product-image {
      width: 80px;
      height: 80px;
      object-fit: cover;
      border-radius: 4px;
      border: 1px solid #ddd;
    }

    .info-list {
      flex: 1;
    }
  }

  address {
    font-style: normal;
    line-height: 1.8;
  }

  .arraysubs-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
  }

  .description {
    color: #666;
    font-style: italic;
    margin: 0;
  }

  // Refund styling in Order History table
  .refund-badge {
    margin-left: auto;
    padding: 4px 10px;
    background: #fef5e7;
    color: #d68910;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
  }

  .order-row--refunded {
    background-color: #fff5f5 !important;

    td {
      color: #999;
      text-decoration: line-through;
      text-decoration-color: #dc3232;
    }

    // Don't strikethrough amounts and actions
    td:nth-child(4),
    td:nth-child(5),
    td:last-child {
      text-decoration: none;
    }
  }

  .refund-amount {
    color: #dc3232;
    font-weight: 500;

    &--full {
      font-weight: 600;
    }
  }

  .refund-row {
    background-color: #fcfcfc !important;

    td {
      font-size: 12px;
      color: #666;
      padding: 8px 10px !important;

      &:first-child {
        padding-left: 20px !important;
        color: #999;
      }
    }
  }

  // Cancellation Details Card styles
  .info-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin: 8px 0;
    border-top: 1px solid #e0e0e0;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;

    svg {
      flex-shrink: 0;
    }
  }

  .info-item {
    &--full {
      flex-direction: column;
      gap: 6px;

      strong {
        min-width: auto;
      }
    }

    &__text {
      margin: 0;
      padding: 10px 12px;
      background: #f9f9f9;
      border: 1px solid #e0e0e0;
      border-radius: 4px;
      font-size: 13px;
      line-height: 1.6;
      color: #333;
    }

    &__list {
      margin: 0;
      padding-left: 20px;
      list-style: disc;

      li {
        margin-bottom: 4px;
        color: #555;
      }
    }

    &__success {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: #155724;
      font-weight: 500;

      svg {
        color: #28a745;
      }
    }

    &__muted {
      color: #888;
      font-style: italic;
    }
  }

  // Shipping detail list
  .arraysubs-detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
    margin: 0;

    dt {
      font-weight: 500;
      color: #555;
    }

    dd {
      margin: 0;
      color: #333;
    }
  }

  // Shipping type badges
  .shipping-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;

    &--one-time {
      background: #e7f3ff;
      color: var(--arraysubs-fb-primary-color, #0073aa);
    }

    &--recurring {
      background: #d4edda;
      color: #155724;
    }
  }

  // Gateway Payment Method Card
  .arraysubs-gateway-card {
    .detail-card__header {
      position: relative;
    }

    &__actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
    }
  }

  .arraysubs-gateway-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: auto;

    &--active {
      background: #d4edda;
      color: #155724;
    }

    &--detached {
      background: #e2e3e5;
      color: #383d41;
    }

    &--errored {
      background: #f8d7da;
      color: #721c24;
    }
  }

  .arraysubs-payment-method-display {
    font-weight: 500;
  }

  .arraysubs-pm-expired {
    color: #dc3232;

    .arraysubs-pm-expired-badge {
      display: inline-block;
      margin-left: 6px;
      padding: 1px 6px;
      background: #f8d7da;
      color: #721c24;
      border-radius: 3px;
      font-size: 11px;
      font-weight: 600;
    }
  }

  .arraysubs-btn--small {
    padding: 2px 10px !important;
    font-size: 12px !important;
    height: auto !important;
    min-height: 28px;

    svg {
      vertical-align: middle;
    }
  }
}

.arraysubs-prorated-refund-modal {
  display: flex;
  flex-direction: column;
  gap: 16px;

  &__summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;

    @media (max-width: 640px) {
      grid-template-columns: 1fr;
    }

    > div {
      border: 1px solid #dcdcde;
      border-radius: 4px;
      padding: 12px;
      background: #f6f7f7;
    }

    span {
      display: block;
      margin-bottom: 6px;
      color: #646970;
      font-size: 12px;
      font-weight: 600;
      text-transform: uppercase;
    }

    strong {
      color: #1d2327;
      font-size: 18px;
    }
  }

  &__field {
    display: flex;
    flex-direction: column;
    gap: 6px;

    label {
      font-weight: 600;
    }

    input,
    textarea {
      width: 100%;
      max-width: 100%;
    }
  }

  &__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
  }

  &__notice {
    border-left: 4px solid #d63638;
    padding: 12px;
    background: #fcf0f1;
    color: #8a2424;
  }

  &__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
}

// Spin animation for refresh icon
.arraysubs-spin {
  animation: spin 1s linear infinite;
}

// Coupon discount card
.arraysubs-coupon-card {
  .arraysubs-coupon-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: auto;

    &--active {
      background: #d4edda;
      color: #155724;
    }

    &--expired {
      background: #e2e3e5;
      color: #383d41;
    }
  }

  .arraysubs-coupon-deleted {
    color: #999;
    font-size: 12px;
  }
}
